qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 05/12] vfio: Support for RamDiscardMgr in the !vIOMMU case


From: David Hildenbrand
Subject: Re: [PATCH v6 05/12] vfio: Support for RamDiscardMgr in the !vIOMMU case
Date: Mon, 22 Feb 2021 15:43:57 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

On 22.02.21 14:20, Paolo Bonzini wrote:
On 22/02/21 12:57, David Hildenbrand wrote:

+static int vfio_sync_ram_discard_listener_dirty_bitmap(VFIOContainer 
*container,
+                                                   MemoryRegionSection 
*section)
+{
+    RamDiscardMgr *rdm = memory_region_get_ram_discard_mgr(section->mr);
+    RamDiscardMgrClass *rdmc = RAM_DISCARD_MGR_GET_CLASS(rdm);
+    VFIORamDiscardListener tmp_vrdl, *vrdl = NULL;
+
+    QLIST_FOREACH(vrdl, &container->vrdl_list, next) {
+        if (vrdl->mr == section->mr &&
+            vrdl->offset_within_region == section->offset_within_region) {
+            break;
+        }
+    }
+
+    if (!vrdl) {
+        hw_error("vfio: Trying to sync missing RAM discard listener");
+    }
+
+    tmp_vrdl = *vrdl;
+    ram_discard_listener_init(&tmp_vrdl.listener,
+                              vfio_ram_discard_notify_dirty_bitmap, NULL, 
NULL);
+    return rdmc->replay_populated(rdm, section->mr, &tmp_vrdl.listener);
+}
+

Can you explain why this is related to the sync_dirty_bitmap call?  This
needs a comment in vfio_sync_dirty_bitmap.

We can only synchronize the parts that actually got mapped via VFIO. So I have to walk all parts that are populated (and thus, were mapped via VFIO). This is similar to the IOMMU notifier handling.


Also, why can't you just pass vrdl to the call?

I have to modify the callbacks. Similarly done for memory_region_iommu_replay().

--
Thanks,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]