[OE-core] [PATCHv2 1/8] qemu: Backport malloc-trace disabling

Jussi Kukkonen jussi.kukkonen at intel.com
Mon Nov 9 12:43:58 UTC 2015


Allocation tracing has been removed from GLib 2.46 and trying to use
it results in an ugly warning: Backport patch to not use it in Qemu.

Signed-off-by: Jussi Kukkonen <jussi.kukkonen at intel.com>
---
 .../qemu/qemu/trace-remove-malloc-tracing.patch    | 97 ++++++++++++++++++++++
 meta/recipes-devtools/qemu/qemu_2.4.0.bb           |  1 +
 2 files changed, 98 insertions(+)
 create mode 100644 meta/recipes-devtools/qemu/qemu/trace-remove-malloc-tracing.patch

diff --git a/meta/recipes-devtools/qemu/qemu/trace-remove-malloc-tracing.patch b/meta/recipes-devtools/qemu/qemu/trace-remove-malloc-tracing.patch
new file mode 100644
index 0000000..73d699f
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/trace-remove-malloc-tracing.patch
@@ -0,0 +1,97 @@
+From 98cf48f60aa4999f5b2808569a193a401a390e6a Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini at redhat.com>
+Date: Wed, 16 Sep 2015 17:38:44 +0200
+Subject: [PATCH] trace: remove malloc tracing
+
+The malloc vtable is not supported anymore in glib, because it broke
+when constructors called g_malloc.  Remove tracing of g_malloc,
+g_realloc and g_free calls.
+
+Note that, for systemtap users, glib also provides tracepoints
+glib.mem_alloc, glib.mem_free, glib.mem_realloc, glib.slice_alloc
+and glib.slice_free.
+
+Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
+Reviewed-by: Alberto Garcia <berto at igalia.com>
+Message-id: 1442417924-25831-1-git-send-email-pbonzini at redhat.com
+Signed-off-by: Stefan Hajnoczi <stefanha at redhat.com>
+
+
+For Yocto:
+Upstream-Status: Backport [commit 98cf48f60a, included in 2.4.1]
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen at intel.com>
+
+---
+ trace-events |    3 ---
+ vl.c         |   27 ---------------------------
+ 2 files changed, 0 insertions(+), 30 deletions(-)
+
+diff --git a/trace-events b/trace-events
+index 6790292..b813ae4 100644
+--- a/trace-events
++++ b/trace-events
+@@ -603,9 +603,6 @@ scsi_request_sense(int target, int lun, int tag) "target %d lun %d tag %d"
+ vm_state_notify(int running, int reason) "running %d reason %d"
+ load_file(const char *name, const char *path) "name %s location %s"
+ runstate_set(int new_state) "new state %d"
+-g_malloc(size_t size, void *ptr) "size %zu ptr %p"
+-g_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
+-g_free(void *ptr) "ptr %p"
+ system_wakeup_request(int reason) "reason=%d"
+ qemu_system_shutdown_request(void) ""
+ qemu_system_powerdown_request(void) ""
+diff --git a/vl.c b/vl.c
+index f2bd8d2..ea9e0e6 100644
+--- a/vl.c
++++ b/vl.c
+@@ -2703,26 +2703,6 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
+     return popt;
+ }
+ 
+-static gpointer malloc_and_trace(gsize n_bytes)
+-{
+-    void *ptr = malloc(n_bytes);
+-    trace_g_malloc(n_bytes, ptr);
+-    return ptr;
+-}
+-
+-static gpointer realloc_and_trace(gpointer mem, gsize n_bytes)
+-{
+-    void *ptr = realloc(mem, n_bytes);
+-    trace_g_realloc(mem, n_bytes, ptr);
+-    return ptr;
+-}
+-
+-static void free_and_trace(gpointer mem)
+-{
+-    trace_g_free(mem);
+-    free(mem);
+-}
+-
+ static int machine_set_property(void *opaque,
+                                 const char *name, const char *value,
+                                 Error **errp)
+@@ -2950,11 +2930,6 @@ int main(int argc, char **argv, char **envp)
+     bool userconfig = true;
+     const char *log_mask = NULL;
+     const char *log_file = NULL;
+-    GMemVTable mem_trace = {
+-        .malloc = malloc_and_trace,
+-        .realloc = realloc_and_trace,
+-        .free = free_and_trace,
+-    };
+     const char *trace_events = NULL;
+     const char *trace_file = NULL;
+     ram_addr_t maxram_size;
+@@ -2970,8 +2945,6 @@ int main(int argc, char **argv, char **envp)
+     error_set_progname(argv[0]);
+     qemu_init_exec_dir(argv[0]);
+ 
+-    g_mem_set_vtable(&mem_trace);
+-
+     module_call_init(MODULE_INIT_QOM);
+ 
+     qemu_add_opts(&qemu_drive_opts);
+-- 
+1.7.0.4
+
diff --git a/meta/recipes-devtools/qemu/qemu_2.4.0.bb b/meta/recipes-devtools/qemu/qemu_2.4.0.bb
index 1505b80..7fdae32 100644
--- a/meta/recipes-devtools/qemu/qemu_2.4.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_2.4.0.bb
@@ -10,6 +10,7 @@ SRC_URI += "file://configure-fix-Darwin-target-detection.patch \
             file://smc91c111_fix2.patch \
             file://smc91c111_fix3.patch \
             file://no-valgrind.patch \
+            file://trace-remove-malloc-tracing.patch \
            "
 SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2"
 SRC_URI[md5sum] = "186ee8194140a484a455f8e3c74589f4"
-- 
2.1.4



More information about the Openembedded-core mailing list