qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 3/8] memory: Introduce memory_region_transaction_depth_{in


From: David Hildenbrand
Subject: Re: [PATCH v3 3/8] memory: Introduce memory_region_transaction_depth_{inc|dec}()
Date: Wed, 28 Jul 2021 22:06:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 28.07.21 20:31, Peter Xu wrote:
memory_region_transaction_{begin|commit}() could be too big when finalizing a
memory region.  E.g., we should never attempt to update address space topology
during the finalize() of a memory region.  Provide helpers for further use.

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

diff --git a/softmmu/memory.c b/softmmu/memory.c
index bfedaf9c4d..725d57ec17 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1079,10 +1079,20 @@ static void address_space_update_topology(AddressSpace 
*as)
      address_space_set_flatview(as);
  }
+static void memory_region_transaction_depth_inc(void)
+{
+    memory_region_transaction_depth++;
+}
+
+static void memory_region_transaction_depth_dec(void)
+{
+    memory_region_transaction_depth--;
+}
+
  void memory_region_transaction_begin(void)
  {
      qemu_flush_coalesced_mmio_buffer();
-    ++memory_region_transaction_depth;
+    memory_region_transaction_depth_inc();
  }
void memory_region_transaction_commit(void)
@@ -1092,7 +1102,7 @@ void memory_region_transaction_commit(void)
      assert(memory_region_transaction_depth);
      assert(qemu_mutex_iothread_locked());
- --memory_region_transaction_depth;
+    memory_region_transaction_depth_dec();
      if (!memory_region_transaction_depth) {
          if (memory_region_update_pending) {
              flatviews_reset();


Reviewed-by: David Hildenbrand <david@redhat.com>

--
Thanks,

David / dhildenb




reply via email to

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