@samitouri / QOSamiQemu / commits / 0102503dc5

system/memory: add a tracepoint for memory_region_finalize

cosmetic: add a tracepoint to track when memory regions are getting freed. Useful for debugging and tracking all freed memory regions. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Ani Sinha <anisinha@redhat.com> Message-ID: <20260817142010.80693-5-anisinha@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Ani Sinha committed Aug 17, 2026 at 19:49 UTC 0102503dc58d5f34e49f4d9cb7020271aa90b149
2 files changed +2
system/memory.c
+1
@@ -1691,6 +1691,7 @@ static void memory_region_finalize(Object *obj)
1691 {
1692 MemoryRegion *mr = MEMORY_REGION(obj);
1693
1694 + trace_memory_region_finalize(mr->name);
1695 /*
1696 * Each memory region (that can be freed) must have an owner, and it
1697 * always has the same lifecycle of its owner. It means when reaching
system/trace-events
+1
@@ -25,6 +25,7 @@ flatview_new(void *view, void *root) "%p (root %p)"
25 flatview_destroy(void *view, void *root) "%p (root %p)"
26 flatview_destroy_rcu(void *view, void *root) "%p (root %p)"
27 global_dirty_changed(unsigned int bitmask) "bitmask 0x%"PRIx32
28 +memory_region_finalize(const char* name) "mr %s"
29
30 # physmem.c
31 address_space_map(void *as, uint64_t addr, uint64_t len, bool is_write, uint32_t attrs) "as:%p addr 0x%"PRIx64":%"PRIx64" write:%d attrs:0x%x"