qemu-devel
[Top][All Lists]
Advanced

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

[PATCH RFC 2/4] memory: Use rcu list variance for address_spaces modific


From: Peter Xu
Subject: [PATCH RFC 2/4] memory: Use rcu list variance for address_spaces modifications
Date: Sat, 25 Feb 2023 11:31:39 -0500

AddressSpace should be safe to RCU since it's released with call_rcu.
Change the list insert/removal to use RCU variances.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 softmmu/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/softmmu/memory.c b/softmmu/memory.c
index a63e0bcbb7..c48e9cc6ed 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -3079,7 +3079,7 @@ void address_space_init(AddressSpace *as, MemoryRegion 
*root, const char *name)
     as->ioeventfd_nb = 0;
     as->ioeventfds = NULL;
     QTAILQ_INIT(&as->listeners);
-    QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
+    QTAILQ_INSERT_TAIL_RCU(&address_spaces, as, address_spaces_link);
     as->name = g_strdup(name ? name : "anonymous");
     address_space_update_topology(as);
     address_space_update_ioeventfds(as);
@@ -3103,7 +3103,7 @@ void address_space_destroy(AddressSpace *as)
     memory_region_transaction_begin();
     as->root = NULL;
     memory_region_transaction_commit();
-    QTAILQ_REMOVE(&address_spaces, as, address_spaces_link);
+    QTAILQ_REMOVE_RCU(&address_spaces, as, address_spaces_link);
 
     /* At this point, as->dispatch and as->current_map are dummy
      * entries that the guest should never use.  Wait for the old
-- 
2.39.1




reply via email to

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