memory: trace FlatView creation and destruction

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2017-09-21 12:34:00 +02:00
parent 202fc01b05
commit 02d9651d6a
4 changed files with 7 additions and 1 deletions

View File

@ -48,7 +48,6 @@
typedef struct MemoryRegionOps MemoryRegionOps; typedef struct MemoryRegionOps MemoryRegionOps;
typedef struct MemoryRegionMmio MemoryRegionMmio; typedef struct MemoryRegionMmio MemoryRegionMmio;
typedef struct FlatView FlatView;
struct MemoryRegionMmio { struct MemoryRegionMmio {
CPUReadMemoryFunc *read[3]; CPUReadMemoryFunc *read[3];

View File

@ -30,6 +30,7 @@ typedef struct DisplaySurface DisplaySurface;
typedef struct DriveInfo DriveInfo; typedef struct DriveInfo DriveInfo;
typedef struct Error Error; typedef struct Error Error;
typedef struct EventNotifier EventNotifier; typedef struct EventNotifier EventNotifier;
typedef struct FlatView FlatView;
typedef struct FWCfgEntry FWCfgEntry; typedef struct FWCfgEntry FWCfgEntry;
typedef struct FWCfgIoState FWCfgIoState; typedef struct FWCfgIoState FWCfgIoState;
typedef struct FWCfgMemState FWCfgMemState; typedef struct FWCfgMemState FWCfgMemState;

View File

@ -270,6 +270,7 @@ static FlatView *flatview_new(MemoryRegion *mr_root)
view->ref = 1; view->ref = 1;
view->root = mr_root; view->root = mr_root;
memory_region_ref(mr_root); memory_region_ref(mr_root);
trace_flatview_new(view, mr_root);
return view; return view;
} }
@ -295,6 +296,7 @@ static void flatview_destroy(FlatView *view)
{ {
int i; int i;
trace_flatview_destroy(view, view->root);
if (view->dispatch) { if (view->dispatch) {
address_space_dispatch_free(view->dispatch); address_space_dispatch_free(view->dispatch);
} }
@ -314,6 +316,7 @@ static bool flatview_ref(FlatView *view)
static void flatview_unref(FlatView *view) static void flatview_unref(FlatView *view)
{ {
if (atomic_fetch_dec(&view->ref) == 1) { if (atomic_fetch_dec(&view->ref) == 1) {
trace_flatview_destroy_rcu(view, view->root);
call_rcu(view, flatview_destroy, rcu); call_rcu(view, flatview_destroy, rcu);
} }
} }

View File

@ -64,6 +64,9 @@ memory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned siz
memory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr 0x%"PRIx64" value 0x%"PRIx64" size %u" memory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
memory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u" memory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
memory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u" memory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
flatview_new(FlatView *view, MemoryRegion *root) "%p (root %p)"
flatview_destroy(FlatView *view, MemoryRegion *root) "%p (root %p)"
flatview_destroy_rcu(FlatView *view, MemoryRegion *root) "%p (root %p)"
### Guest events, keep at bottom ### Guest events, keep at bottom