From d15566b6a91973dbf83c92a9678bd3ac4939af75 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Fri, 29 Jul 2016 07:41:27 +0200 Subject: [PATCH 16/16] trace: remove malloc tracing RH-Author: Miroslav Rezanina Message-id: <1469778087-316-1-git-send-email-mrezanin@redhat.com> Patchwork-id: 71514 O-Subject: [RHEL-7.3 qemu-kvm PATCH] trace: remove malloc tracing Bugzilla: 1360137 RH-Acked-by: Fam Zheng RH-Acked-by: Markus Armbruster RH-Acked-by: Laszlo Ersek RH-Acked-by: Laurent Vivier From: Paolo Bonzini 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 Reviewed-by: Alberto Garcia Message-id: 1442417924-25831-1-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit 98cf48f60aa4999f5b2808569a193a401a390e6a) Signed-off-by: Miroslav Rezanina --- trace-events | 3 --- vl.c | 26 -------------------------- 2 files changed, 29 deletions(-) diff --git a/trace-events b/trace-events index af5147a..6cd46e9 100644 --- a/trace-events +++ b/trace-events @@ -474,9 +474,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" qemu_system_shutdown_request(void) "" qemu_system_powerdown_request(void) "" diff --git a/vl.c b/vl.c index 35b927e..9756361 100644 --- a/vl.c +++ b/vl.c @@ -2738,26 +2738,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 object_set_property(const char *name, const char *value, void *opaque) { Object *obj = OBJECT(opaque); @@ -2832,11 +2812,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; FILE *vmstate_dump_file = NULL; @@ -2845,7 +2820,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); if (!g_thread_supported()) { #if !GLIB_CHECK_VERSION(2, 31, 0) g_thread_init(NULL); -- 1.8.3.1