Blame SOURCES/kvm-memory-trace-FlatView-creation-and-destruction.patch

4a2fec
From b546f002c27078f5aa7c29d85615e8b0b28a26b1 Mon Sep 17 00:00:00 2001
4a2fec
From: David Gibson <dgibson@redhat.com>
4a2fec
Date: Thu, 16 Nov 2017 03:07:30 +0100
4a2fec
Subject: [PATCH 26/30] memory: trace FlatView creation and destruction
4a2fec
4a2fec
RH-Author: David Gibson <dgibson@redhat.com>
4a2fec
Message-id: <20171116030732.8560-21-dgibson@redhat.com>
4a2fec
Patchwork-id: 77706
4a2fec
O-Subject: [PATCH 20/22] memory: trace FlatView creation and destruction
4a2fec
Bugzilla: 1481593
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
4a2fec
From: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
4a2fec
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
(cherry picked from commit 02d9651d6a46479e9d70b72dca34e43605d06cda)
4a2fec
4a2fec
Signed-off-by: David Gibson <dgibson@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 include/exec/memory.h   | 1 -
4a2fec
 include/qemu/typedefs.h | 1 +
4a2fec
 memory.c                | 3 +++
4a2fec
 trace-events            | 3 +++
4a2fec
 4 files changed, 7 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/include/exec/memory.h b/include/exec/memory.h
4a2fec
index 8d772b9..b100df6 100644
4a2fec
--- a/include/exec/memory.h
4a2fec
+++ b/include/exec/memory.h
4a2fec
@@ -48,7 +48,6 @@
4a2fec
 
4a2fec
 typedef struct MemoryRegionOps MemoryRegionOps;
4a2fec
 typedef struct MemoryRegionMmio MemoryRegionMmio;
4a2fec
-typedef struct FlatView FlatView;
4a2fec
 
4a2fec
 struct MemoryRegionMmio {
4a2fec
     CPUReadMemoryFunc *read[3];
4a2fec
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
4a2fec
index 39bc835..d44dfc7 100644
4a2fec
--- a/include/qemu/typedefs.h
4a2fec
+++ b/include/qemu/typedefs.h
4a2fec
@@ -30,6 +30,7 @@ typedef struct DisplaySurface DisplaySurface;
4a2fec
 typedef struct DriveInfo DriveInfo;
4a2fec
 typedef struct Error Error;
4a2fec
 typedef struct EventNotifier EventNotifier;
4a2fec
+typedef struct FlatView FlatView;
4a2fec
 typedef struct FWCfgEntry FWCfgEntry;
4a2fec
 typedef struct FWCfgIoState FWCfgIoState;
4a2fec
 typedef struct FWCfgMemState FWCfgMemState;
4a2fec
diff --git a/memory.c b/memory.c
4a2fec
index 93b4221..8733efc 100644
4a2fec
--- a/memory.c
4a2fec
+++ b/memory.c
4a2fec
@@ -270,6 +270,7 @@ static FlatView *flatview_new(MemoryRegion *mr_root)
4a2fec
     view->ref = 1;
4a2fec
     view->root = mr_root;
4a2fec
     memory_region_ref(mr_root);
4a2fec
+    trace_flatview_new(view, mr_root);
4a2fec
 
4a2fec
     return view;
4a2fec
 }
4a2fec
@@ -295,6 +296,7 @@ static void flatview_destroy(FlatView *view)
4a2fec
 {
4a2fec
     int i;
4a2fec
 
4a2fec
+    trace_flatview_destroy(view, view->root);
4a2fec
     if (view->dispatch) {
4a2fec
         address_space_dispatch_free(view->dispatch);
4a2fec
     }
4a2fec
@@ -314,6 +316,7 @@ static bool flatview_ref(FlatView *view)
4a2fec
 static void flatview_unref(FlatView *view)
4a2fec
 {
4a2fec
     if (atomic_fetch_dec(&view->ref) == 1) {
4a2fec
+        trace_flatview_destroy_rcu(view, view->root);
4a2fec
         call_rcu(view, flatview_destroy, rcu);
4a2fec
     }
4a2fec
 }
4a2fec
diff --git a/trace-events b/trace-events
4a2fec
index 1f50f56..1d2eb5d 100644
4a2fec
--- a/trace-events
4a2fec
+++ b/trace-events
4a2fec
@@ -64,6 +64,9 @@ memory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned siz
4a2fec
 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"
4a2fec
 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"
4a2fec
 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"
4a2fec
+flatview_new(FlatView *view, MemoryRegion *root) "%p (root %p)"
4a2fec
+flatview_destroy(FlatView *view, MemoryRegion *root) "%p (root %p)"
4a2fec
+flatview_destroy_rcu(FlatView *view, MemoryRegion *root) "%p (root %p)"
4a2fec
 
4a2fec
 ### Guest events, keep at bottom
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec