On 23.07.21 21:34, 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 <pet...@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..1a3e9ff8ad 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_push(void)
+{
+    memory_region_transaction_depth++;
+}
+
+static void memory_region_transaction_pop(void)
+{
+    memory_region_transaction_depth--;
+}
+

push/pop has to me stack semantics, meaning we do more than just increment/decrement the depth.

I'd have used

memory_region_transaction_depth_inc() / memory_region_transaction_depth_dec()


LGTM

--
Thanks,

David / dhildenb


Reply via email to