On 8/13/2025 8:54 AM, Cédric Le Goater wrote:
Steve,
On 6/10/25 17:39, Steve Sistare wrote:
If there are multiple containers and unmap-all fails for some container, we
need to remap vaddr for the other containers for which unmap-all succeeded.
Recover by walking all address ranges of all containers to restore the vaddr
for each. Do so by invoking the vfio listener callback, and passing a new
"remap" flag that tells it to restore a mapping without re-allocating new
userland data structures.
Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
Reviewed-by: Cédric Le Goater <c...@redhat.com>
---
[...]
@@ -558,7 +570,12 @@ static void vfio_listener_region_add(MemoryListener
*listener,
* about changes.
*/
if (memory_region_has_ram_discard_manager(section->mr)) {
- vfio_ram_discard_register_listener(bcontainer, section);
+ if (!cpr_remap) {
+ vfio_ram_discard_register_listener(bcontainer, section);
+ } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
+ section)) {
+ goto fail;
vfio_cpr_ram_discard_register_listener() can fail without setting
an 'Error *' variable. I don't think this will generate a QEMU crash
(we are in the !bcontainer->initialized case) but it would be better
addressed if &err was set.
Thanks, I just posted a fix - steve