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

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