|
|
9ae3a8 |
From d15566b6a91973dbf83c92a9678bd3ac4939af75 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 29 Jul 2016 07:41:27 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 16/16] trace: remove malloc tracing
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1469778087-316-1-git-send-email-mrezanin@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 71514
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH] trace: remove malloc tracing
|
|
|
9ae3a8 |
Bugzilla: 1360137
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The malloc vtable is not supported anymore in glib, because it broke
|
|
|
9ae3a8 |
when constructors called g_malloc. Remove tracing of g_malloc,
|
|
|
9ae3a8 |
g_realloc and g_free calls.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Note that, for systemtap users, glib also provides tracepoints
|
|
|
9ae3a8 |
glib.mem_alloc, glib.mem_free, glib.mem_realloc, glib.slice_alloc
|
|
|
9ae3a8 |
and glib.slice_free.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
|
|
9ae3a8 |
Message-id: 1442417924-25831-1-git-send-email-pbonzini@redhat.com
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 98cf48f60aa4999f5b2808569a193a401a390e6a)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
trace-events | 3 ---
|
|
|
9ae3a8 |
vl.c | 26 --------------------------
|
|
|
9ae3a8 |
2 files changed, 29 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/trace-events b/trace-events
|
|
|
9ae3a8 |
index af5147a..6cd46e9 100644
|
|
|
9ae3a8 |
--- a/trace-events
|
|
|
9ae3a8 |
+++ b/trace-events
|
|
|
9ae3a8 |
@@ -474,9 +474,6 @@ scsi_request_sense(int target, int lun, int tag) "target %d lun %d tag %d"
|
|
|
9ae3a8 |
vm_state_notify(int running, int reason) "running %d reason %d"
|
|
|
9ae3a8 |
load_file(const char *name, const char *path) "name %s location %s"
|
|
|
9ae3a8 |
runstate_set(int new_state) "new state %d"
|
|
|
9ae3a8 |
-g_malloc(size_t size, void *ptr) "size %zu ptr %p"
|
|
|
9ae3a8 |
-g_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
|
|
|
9ae3a8 |
-g_free(void *ptr) "ptr %p"
|
|
|
9ae3a8 |
qemu_system_shutdown_request(void) ""
|
|
|
9ae3a8 |
qemu_system_powerdown_request(void) ""
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/vl.c b/vl.c
|
|
|
9ae3a8 |
index 35b927e..9756361 100644
|
|
|
9ae3a8 |
--- a/vl.c
|
|
|
9ae3a8 |
+++ b/vl.c
|
|
|
9ae3a8 |
@@ -2738,26 +2738,6 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
|
|
|
9ae3a8 |
return popt;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static gpointer malloc_and_trace(gsize n_bytes)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- void *ptr = malloc(n_bytes);
|
|
|
9ae3a8 |
- trace_g_malloc(n_bytes, ptr);
|
|
|
9ae3a8 |
- return ptr;
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-static gpointer realloc_and_trace(gpointer mem, gsize n_bytes)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- void *ptr = realloc(mem, n_bytes);
|
|
|
9ae3a8 |
- trace_g_realloc(mem, n_bytes, ptr);
|
|
|
9ae3a8 |
- return ptr;
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-static void free_and_trace(gpointer mem)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- trace_g_free(mem);
|
|
|
9ae3a8 |
- free(mem);
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
static int object_set_property(const char *name, const char *value, void *opaque)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
Object *obj = OBJECT(opaque);
|
|
|
9ae3a8 |
@@ -2832,11 +2812,6 @@ int main(int argc, char **argv, char **envp)
|
|
|
9ae3a8 |
bool userconfig = true;
|
|
|
9ae3a8 |
const char *log_mask = NULL;
|
|
|
9ae3a8 |
const char *log_file = NULL;
|
|
|
9ae3a8 |
- GMemVTable mem_trace = {
|
|
|
9ae3a8 |
- .malloc = malloc_and_trace,
|
|
|
9ae3a8 |
- .realloc = realloc_and_trace,
|
|
|
9ae3a8 |
- .free = free_and_trace,
|
|
|
9ae3a8 |
- };
|
|
|
9ae3a8 |
const char *trace_events = NULL;
|
|
|
9ae3a8 |
const char *trace_file = NULL;
|
|
|
9ae3a8 |
FILE *vmstate_dump_file = NULL;
|
|
|
9ae3a8 |
@@ -2845,7 +2820,6 @@ int main(int argc, char **argv, char **envp)
|
|
|
9ae3a8 |
error_set_progname(argv[0]);
|
|
|
9ae3a8 |
qemu_init_exec_dir(argv[0]);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- g_mem_set_vtable(&mem_trace);
|
|
|
9ae3a8 |
if (!g_thread_supported()) {
|
|
|
9ae3a8 |
#if !GLIB_CHECK_VERSION(2, 31, 0)
|
|
|
9ae3a8 |
g_thread_init(NULL);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|