qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] trace: remove malloc tracing
@ 2015-09-16 15:38 Paolo Bonzini
  2015-10-07 15:21 ` Alberto Garcia
  2015-10-08 14:20 ` Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-09-16 15:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

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@redhat.com>
---
 trace-events |  3 ---
 vl.c         | 27 ---------------------------
 2 files changed, 30 deletions(-)

diff --git a/trace-events b/trace-events
index 1927c76..7901903 100644
--- a/trace-events
+++ b/trace-events
@@ -602,9 +602,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 3c6480d..e058753 100644
--- a/vl.c
+++ b/vl.c
@@ -2733,26 +2733,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)
@@ -2980,11 +2960,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;
@@ -3000,8 +2975,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);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] trace: remove malloc tracing
  2015-09-16 15:38 [Qemu-devel] [PATCH] trace: remove malloc tracing Paolo Bonzini
@ 2015-10-07 15:21 ` Alberto Garcia
  2015-10-08 14:20 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Alberto Garcia @ 2015-10-07 15:21 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, stefanha

On Wed, Sep 16, 2015 at 05:38:44PM +0200, Paolo Bonzini wrote:
> 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@redhat.com>

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] trace: remove malloc tracing
  2015-09-16 15:38 [Qemu-devel] [PATCH] trace: remove malloc tracing Paolo Bonzini
  2015-10-07 15:21 ` Alberto Garcia
@ 2015-10-08 14:20 ` Stefan Hajnoczi
  2015-10-08 14:31   ` Peter Maydell
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2015-10-08 14:20 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Wed, Sep 16, 2015 at 05:38:44PM +0200, Paolo Bonzini wrote:
> 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@redhat.com>
> ---
>  trace-events |  3 ---
>  vl.c         | 27 ---------------------------
>  2 files changed, 30 deletions(-)

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] trace: remove malloc tracing
  2015-10-08 14:20 ` Stefan Hajnoczi
@ 2015-10-08 14:31   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-10-08 14:31 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Paolo Bonzini, QEMU Developers

On 8 October 2015 at 15:20, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> On Wed, Sep 16, 2015 at 05:38:44PM +0200, Paolo Bonzini wrote:
>> 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@redhat.com>
>> ---
>>  trace-events |  3 ---
>>  vl.c         | 27 ---------------------------
>>  2 files changed, 30 deletions(-)
>
> Thanks, applied to my tracing tree:
> https://github.com/stefanha/qemu/commits/tracing

There was an alternative earlier reviewed patch on list for this:
http://patchwork.ozlabs.org/patch/514730/

That one retains the support for glib versions which support it.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-08 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 15:38 [Qemu-devel] [PATCH] trace: remove malloc tracing Paolo Bonzini
2015-10-07 15:21 ` Alberto Garcia
2015-10-08 14:20 ` Stefan Hajnoczi
2015-10-08 14:31   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).