fix tracing for modules
v3 cover fix tracing for modules
First version that actually works. Only qxl covered for this RfC, other modules will follow once the basics are hashed out.
v3:
- handle initialization of modular tracepoints.
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.
More context:
https://bugzilla.redhat.com/show_bug.cgi?id=1898700
https://bugzilla.redhat.com/show_bug.cgi?id=1869642
take care,
Gerd
Gerd Hoffmann (8):
meson: add trace_events_config[]
meson: move up hw subdir (specifically before trace subdir)
meson: add module_trace & module_trace_src
meson: move qxl trace events to separate file
trace: iter init tweaks
trace: add trace_event_iter_init_group trace/simple: pass iter to st_write_event_mapping trace/simple: add st_init_group
trace/control.h | 30 ++++++++++++++--- trace/simple.h | 1 + hw/display/qxl-render.c | 1 + hw/display/qxl.c | 1 + monitor/misc.c | 4 +-- trace/control-target.c | 2 +- trace/control.c | 39 ++++++++++++++++----- trace/qmp.c | 6 ++-- trace/simple.c | 22 +++++++++--- hw/display/meson.build | 5 +++ hw/display/trace-events | 67 ------------------------------------- hw/display/trace-events-qxl | 66 ++++++++++++++++++++++++++++++++++++ meson.build | 7 ++-- trace/meson.build | 37 +++++++++++++++----- 14 files changed, 187 insertions(+), 101 deletions(-) create mode 100644 hw/display/trace-events-qxl
Signature · 1 line
2.29.2
PATCH v3 1/8 meson: add trace_events_config[]
It's an array of dicts, where each dict holds the configuration for one trace-events file. For now just fill it from trace_events_subdirs.
--- meson.build | 1 + trace/meson.build | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
meson.build +1 -0
@@ -1677,6 +1677,7 @@ target_softmmu_arch = {} # TODO: add each directory to the subdirs from its own meson.build, once # we have those +trace_events_config = [] trace_events_subdirs = [ 'accel/kvm', 'accel/tcg',
trace/meson.build +16 -5
@@ -2,12 +2,23 @@ specific_ss.add(files('control-target.c')) trace_events_files = [] -foreach dir : [ '.' ] + trace_events_subdirs - trace_events_file = meson.source_root() / dir / 'trace-events' + +trace_events_config += { + 'file' : meson.source_root() / 'trace-events', + 'group' : 'root', +} +foreach dir : trace_events_subdirs + trace_events_config += { + 'file' : meson.source_root() / dir / 'trace-events', + 'group' : dir.underscorify(), + } +endforeach + +foreach c : trace_events_config + trace_events_file = c.get('file') trace_events_files += [ trace_events_file ] - group_name = dir == '.' ? 'root' : dir.underscorify() - group = '--group=' + group_name - fmt = '@0@-' + group_name + '.@1@' + group = '--group=' + c.get('group') + fmt = '@0@-' + c.get('group') + '.@1@' trace_h = custom_target(fmt.format('trace', 'h'), output: fmt.format('trace', 'h'),
Signature · 1 line
2.29.2
Re: [PATCH v3 1/8] meson: add trace_events_config[]
Quoted 8 lines · Gerd Hoffmann
It's an array of dicts, where each dict holds the configuration for one trace-events file. For now just fill it from
trace_events_subdirs.Signed-off-by Gerd Hoffmann <[email protected]>--- meson.build | 1 + trace/meson.build | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
PATCH v3 2/8 meson: move up hw subdir (specifically before trace subdir)
In reply to Gerd HoffmannNeeded so trace/meson.build can see
stuff done in hw/*/meson.build.
--- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meson.build +2 -1
@@ -1777,6 +1777,8 @@ if 'CONFIG_VHOST_USER' in config_host vhost_user = libvhost_user.get_variable('vhost_user_dep') endif +subdir('hw') + subdir('qapi') subdir('qobject') subdir('stubs')
@@ -1863,7 +1865,6 @@ subdir('migration') subdir('monitor') subdir('net') subdir('replay') -subdir('hw') subdir('accel') subdir('plugins') subdir('bsd-user')
Signature · 1 line
2.29.2
Re: [PATCH v3 2/8] meson: move up hw subdir (specifically before trace subdir)
Quoted 13 lines · Gerd Hoffmann
Needed so trace/meson.build can see
stuff done in hw/*/meson.build.Signed-off-by Gerd Hoffmann <[email protected]>--- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)meson.build +0
-0
meson.build if 'CONFIG_VHOST_USER' in config_host · line 1782
Quoted 6 lines
meson.build +2
-0@@ -1777,6 +1777,8 @@ if 'CONFIG_VHOST_USER' in config_host vhost_user = libvhost_user.get_variable('vhost_user_dep') endif +subdir('hw') + subdir('qapi')
Please add a comment into the meson.build file explaining the ordering requirement. This will prevent people accidentally breaking this in the future.
PATCH v3 3/8 meson: add module_trace & module_trace_src
In reply to Gerd Hoffmannmodule_trace is a dict which keeps track of the trace source files for a module.
module_trace_src collects the trace source files for a given trace-events file, which then either added to the source set or to a new module_trace dict depending on whenever they are for a module or core qemu.
--- meson.build | 3 ++- trace/meson.build | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
meson.build +2 -1
@@ -1890,7 +1890,8 @@ foreach d, list : modules foreach m, module_ss : list if enable_modules and targetos != 'windows' module_ss = module_ss.apply(config_all, strict: false) - sl = static_library(d + '-' + m, [genh, module_ss.sources()], + module_trace_src = module_trace.get(d + '-' + m, []) + sl = static_library(d + '-' + m, [genh, module_ss.sources(), module_trace_src], dependencies: [modulecommon, module_ss.dependencies()], pic: true) if d == 'block' block_mods += sl
trace/meson.build +12 -4
@@ -2,6 +2,7 @@ specific_ss.add(files('control-target.c')) trace_events_files = [] +module_trace = {} trace_events_config += { 'file' : meson.source_root() / 'trace-events',
@@ -19,6 +20,8 @@ foreach c : trace_events_config trace_events_files += [ trace_events_file ] group = '--group=' + c.get('group') fmt = '@0@-' + c.get('group') + '.@1@' + mod = c.get('module', '') + module_trace_src = [] trace_h = custom_target(fmt.format('trace', 'h'), output: fmt.format('trace', 'h'),
@@ -34,10 +37,10 @@ foreach c : trace_events_config output: fmt.format('trace-ust', 'h'), input: trace_events_file, command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ]) - trace_ss.add(trace_ust_h, lttng, urcubp) + module_trace_src += [ trace_ust_h, lttng, urcubp ] genh += trace_ust_h endif - trace_ss.add(trace_h, trace_c) + module_trace_src += [ trace_h, trace_c ] if 'CONFIG_TRACE_DTRACE' in config_host trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'), output: fmt.format('trace-dtrace', 'dtrace'),
@@ -47,17 +50,22 @@ foreach c : trace_events_config output: fmt.format('trace-dtrace', 'h'), input: trace_dtrace, command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ]) - trace_ss.add(trace_dtrace_h) + module_trace_src += trace_dtrace_h if host_machine.system() != 'darwin' trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'), output: fmt.format('trace-dtrace', 'o'), input: trace_dtrace, command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ]) - trace_ss.add(trace_dtrace_o) + module_trace_src += trace_dtrace_o endif genh += trace_dtrace_h endif + if enable_modules and mod != '' + module_trace += { mod : module_trace_src } + else + trace_ss.add(module_trace_src) + endif endforeach trace_events_all = custom_target('trace-events-all',
Signature · 1 line
2.29.2
Re: [PATCH v3 3/8] meson: add module_trace & module_trace_src
Quoted 7 lines · Gerd Hoffmann
module_traceis a dict which keeps track of the trace source files for a module.
module_trace_srccollects the trace source files for a given trace-events file, which then either added to the source set or to a newmodule_tracedict depending on whenever they are for a module or core qemu.
Quoted 5 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- meson.build | 3 ++- trace/meson.build | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
PATCH v3 4/8 meson: move qxl trace events to separate file
In reply to Gerd HoffmannMove qxl trace events to separate trace-events-qxl file.
--- hw/display/qxl-render.c | 1 + hw/display/qxl.c | 1 + hw/display/meson.build | 5 +++ hw/display/trace-events | 67 ------------------------------------- hw/display/trace-events-qxl | 66 ++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 67 deletions(-) create mode 100644 hw/display/trace-events-qxl
hw/display/qxl-render.c +1 -0
@@ -23,6 +23,7 @@#include "qxl.h" #include "sysemu/runstate.h" #include "trace.h" +#include "trace/trace-hw_display_qxl.h" static void qxl_blit (PCIQXLDevice *qxl,QXLRect *rect) {
hw/display/qxl.c +1 -0
@@ -33,6 +33,7 @@#include "migration/blocker.h" #include "migration/vmstate.h" #include "trace.h" +#include "trace/trace-hw_display_qxl.h" #include "qxl.h"
hw/display/meson.build +5 -0
@@ -42,6 +42,11 @@ if config_all_devices.has_key('CONFIG_QXL') qxl_ss = ss.source_set() qxl_ss.add(when: 'CONFIG_QXL', if_true: [files('qxl.c', 'qxl-logger.c', 'qxl-render.c'), pixman, spice]) + trace_events_config += { + 'file' : meson.source_root() / 'hw' / 'display' / 'trace-events-qxl', + 'group' : 'hw_display_qxl', + 'module' : 'hw-display-qxl', + } hw_display_modules += {'qxl': qxl_ss} endif
hw/display/trace-events +0 -67
73 lines not on this page · raw message
hw/display/trace-events-qxl new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.29.2
Re: [PATCH v3 4/8] meson: move qxl trace events to separate file
Quoted 11 lines · Gerd Hoffmann
Move qxl trace events to separate trace-events-qxl file.
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/display/qxl-render.c | 1 + hw/display/qxl.c | 1 + hw/display/meson.build | 5 +++ hw/display/trace-events | 67 ------------------------------------- hw/display/trace-events-qxl | 66 ++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 67 deletions(-) create mode 100644 hw/display/trace-events-qxl
Re: [PATCH v3 4/8] meson: move qxl trace events to separate file
In reply to Gerd HoffmannQuoted 17 lines · Gerd Hoffmann
Move qxl trace events to separate trace-events-qxl file.
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/display/qxl-render.c | 1 + hw/display/qxl.c | 1 + hw/display/meson.build | 5 +++ hw/display/trace-events | 67 ------------------------------------- hw/display/trace-events-qxl | 66 ++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 67 deletions(-) create mode 100644 hw/display/trace-events-qxlhw/display/qxl-render.c +0
-0
hw/display/qxl-render.c line 26
Quoted 4 lines
hw/display/qxl-render.c +1
-0@@ -23,6 +23,7 @@#include "qxl.h" #include "sysemu/runstate.h" #include "trace.h" +#include "trace/trace-hw_display_qxl.h"
I'm not a fan of this, as it feels like we're setting up a completely different naming convention from the one that already exists.
The previous "trace.h" header is relative to the source directory. ie, "trace.h" is pulling in "hw/display/trace.h".
IMHO, we should be generating 'trace-qxl.h', alongside the existing trace.h, so we can use a bare "trace-qxl.h" include that refers to "hw/display/trace-qxl.h".
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v3 5/8 trace: iter init tweaks
In reply to Gerd HoffmannRename trace_event_iter_init() to trace_event_iter_init_pattern(), add trace_event_iter_init_all() for interating over all events.
--- trace/control.h | 17 +++++++++++++---- monitor/misc.c | 4 ++-- trace/control-target.c | 2 +- trace/control.c | 16 +++++++++++----- trace/qmp.c | 6 +++--- trace/simple.c | 2 +- 6 files changed, 31 insertions(+), 16 deletions(-)
trace/control.h +13 -4
@@ -20,15 +20,24 @@ typedef struct TraceEventIter {/** -* trace_event_iter_init: +* trace_event_iter_init_all: * @iter: the event iterator struct -* @pattern: optional pattern to filter events on name * * Initialize the event iterator struct @iter, -* optionally using @pattern to filter out events +* for all events. +*/ +void trace_event_iter_init_all (TraceEventIter *iter); + +/** +* trace_event_iter_init_pattern: +* @iter: the event iterator struct +* @pattern: pattern to filter events on name +* +* Initialize the event iterator struct @iter, +* using @pattern to filter out events * with non-matching names. */ -void trace_event_iter_init (TraceEventIter *iter,const char *pattern); +void trace_event_iter_init_pattern (TraceEventIter *iter,const char *pattern);/** * trace_event_iter_next:
monitor/misc.c +2 -2
@@ -2025,7 +2025,7 @@ void info_trace_events_completion(ReadLineState *rs, int nb_args, const char *stTraceEventIter iter;TraceEvent *ev;char *pattern =g_strdup_printf ("%s*" , str); -trace_event_iter_init (&iter, pattern); +trace_event_iter_init_pattern (&iter, pattern);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {readline_add_completion (rs,trace_event_get_name (ev)); }
@@ -2043,7 +2043,7 @@ void trace_event_completion(ReadLineState *rs, int nb_args, const char *str)TraceEventIter iter;TraceEvent *ev;char *pattern =g_strdup_printf ("%s*" , str); -trace_event_iter_init (&iter, pattern); +trace_event_iter_init_pattern (&iter, pattern);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {readline_add_completion (rs,trace_event_get_name (ev)); }
trace/control-target.c +1 -1
@@ -127,7 +127,7 @@ void trace_init_vcpu(CPUState *vcpu) {TraceEventIter iter;TraceEvent *ev; -trace_event_iter_init (&iter,NULL ); +trace_event_iter_init_all (&iter);while ((ev =trace_event_iter_next (&iter)) !=NULL ) { if (trace_event_is_vcpu(ev) && trace_event_get_state_static(ev) &&
trace/control.c +11 -5
@@ -90,7 +90,7 @@ TraceEvent *trace_event_name(const char *name)TraceEventIter iter;TraceEvent *ev; -trace_event_iter_init (&iter,NULL ); +trace_event_iter_init_all (&iter);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (strcmp (trace_event_get_name (ev), name) ==0 ) {return ev;
@@ -99,10 +99,16 @@ TraceEvent *trace_event_name(const char *name)return NULL ; } -void trace_event_iter_init (TraceEventIter *iter,const char *pattern) +void trace_event_iter_init_all (TraceEventIter *iter) { iter->event =0 ; iter->group =0 ; + iter->pattern =NULL ; +} + +void trace_event_iter_init_pattern (TraceEventIter *iter,const char *pattern) +{ +trace_event_iter_init_all (iter); iter->pattern = pattern; }
@@ -129,7 +135,7 @@ void trace_list_events(FILE *f) {TraceEventIter iter;TraceEvent *ev; -trace_event_iter_init (&iter,NULL ); +trace_event_iter_init_all (&iter);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {fprintf (f,"%s\n" ,trace_event_get_name (ev)); }
@@ -149,7 +155,7 @@ static void do_trace_enable_events(const char *line_buf)TraceEvent *ev;bool is_pattern =trace_event_is_pattern (line_ptr); -trace_event_iter_init (&iter, line_ptr); +trace_event_iter_init_pattern (&iter, line_ptr);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (!trace_event_get_state_static (ev)) {if (!is_pattern) {
@@ -257,7 +263,7 @@ void trace_fini_vcpu(CPUState *vcpu)trace_guest_cpu_exit (vcpu); -trace_event_iter_init (&iter,NULL ); +trace_event_iter_init_all (&iter);while ((ev =trace_event_iter_next (&iter)) !=NULL ) { if (trace_event_is_vcpu(ev) && trace_event_get_state_static(ev) &&
trace/qmp.c +3 -3
@@ -55,7 +55,7 @@ static bool check_events(bool has_vcpu, bool ignore_unavailable, bool is_pattern/* error for unavailable events */ TraceEventIter iter;TraceEvent *ev; -trace_event_iter_init (&iter, name); +trace_event_iter_init_pattern (&iter, name);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (!ignore_unavailable && !trace_event_get_state_static (ev)) {error_setg (errp,"event \"%s\" is disabled" ,trace_event_get_name (ev));
@@ -90,7 +90,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name, }/* Get states (all errors checked above) */ -trace_event_iter_init (&iter, name); +trace_event_iter_init_pattern (&iter, name);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {TraceEventInfo *value;bool is_vcpu =trace_event_is_vcpu (ev);
@@ -153,7 +153,7 @@ void qmp_trace_event_set_state(const char *name, bool enable, }/* Apply changes (all errors checked above) */ -trace_event_iter_init (&iter, name); +trace_event_iter_init_pattern (&iter, name);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (!trace_event_get_state_static (ev) || (has_vcpu && !trace_event_is_vcpu (ev))) {
trace/simple.c +1 -1
@@ -286,7 +286,7 @@ static int st_write_event_mapping(void)TraceEventIter iter;TraceEvent *ev; -trace_event_iter_init (&iter,NULL ); +trace_event_iter_init_all (&iter);while ((ev =trace_event_iter_next (&iter)) !=NULL ) {uint64_t id =trace_event_get_id (ev);const char *name =trace_event_get_name (ev);
Signature · 1 line
2.29.2
Re: [PATCH v3 5/8] trace: iter init tweaks
Quoted 4 lines · Gerd Hoffmann
Rename
trace_event_iter_init()totrace_event_iter_init_pattern(), addtrace_event_iter_init_all()for interating over all events.Signed-off-by Gerd Hoffmann <[email protected]>
Quoted 8 lines
--- trace/control.h | 17 +++++++++++++---- monitor/misc.c | 4 ++-- trace/control-target.c | 2 +- trace/control.c | 16 +++++++++++----- trace/qmp.c | 6 +++--- trace/simple.c | 2 +- 6 files changed, 31 insertions(+), 16 deletions(-)
PATCH v3 6/8 trace: add trace_event_iter_init_group
In reply to Gerd HoffmannThis allows to interate over an event group.
--- trace/control.h | 13 +++++++++++++ trace/control.c | 19 ++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-)
trace/control.h +13 -0
@@ -13,8 +13,11 @@#include "event-internal.h" typedef struct TraceEventIter { +/* iter state */ size_t event;size_t group; +/* filter conditions */ +size_t group_id;const char *pattern; }TraceEventIter ;
@@ -39,6 +42,16 @@ void trace_event_iter_init_all(TraceEventIter *iter);*/ void trace_event_iter_init_pattern (TraceEventIter *iter,const char *pattern); +/** +* trace_event_iter_init_group: +* @iter: the event iterator struct +* @group_id: group_id to filter events by group. +* +* Initialize the event iterator struct @iter, +* using @group_id to filter for events in the group. +*/ +void trace_event_iter_init_group (TraceEventIter *iter,size_t group_id); +/** * trace_event_iter_next: * @iter: the event iterator struct
trace/control.c +16 -3
@@ -103,6 +103,7 @@ void trace_event_iter_init_all(TraceEventIter *iter) { iter->event =0 ; iter->group =0 ; + iter->group_id =-1 ; iter->pattern =NULL ; }
@@ -112,20 +113,32 @@ void trace_event_iter_init_pattern(TraceEventIter *iter, const char *pattern) iter->pattern = pattern; } +void trace_event_iter_init_group (TraceEventIter *iter,size_t group_id) +{ +trace_event_iter_init_all (iter); + iter->group_id = group_id; +} +TraceEvent *trace_event_iter_next (TraceEventIter *iter) {while (iter->group < nevent_groups && event_groups[iter->group].events[iter->event] !=NULL ) {TraceEvent *ev = event_groups[iter->group].events[iter->event]; +size_t group = iter->group; iter->event++;if (event_groups[iter->group].events[iter->event] ==NULL ) { iter->event =0 ; iter->group++; } -if (!iter->pattern || -g_pattern_match_simple (iter->pattern,trace_event_get_name (ev))) { -return ev; +if (iter->pattern && + !g_pattern_match_simple (iter->pattern,trace_event_get_name (ev))) { +continue ; } +if (iter->group_id !=-1 && + iter->group_id != group) { +continue ; + } +return ev; }return NULL ;
Signature · 1 line
2.29.2
Re: [PATCH v3 6/8] trace: add trace_event_iter_init_group
Quoted 7 lines · Gerd Hoffmann
This allows to interate over an event group.
Signed-off-by Gerd Hoffmann <[email protected]>--- trace/control.h | 13 +++++++++++++ trace/control.c | 19 ++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-)
PATCH v3 7/8 trace/simple: pass iter to st_write_event_mapping
In reply to Gerd HoffmannPass an iter to st_write_event_mapping, so the function can interate different things depending on how we initialize the iter.
--- trace/simple.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
trace/simple.c +5 -5
@@ -280,14 +280,12 @@ void trace_record_finish(TraceBufferRecord *rec) } } -static int st_write_event_mapping (void ) +static int st_write_event_mapping (TraceEventIter *iter) {uint64_t type =TRACE_RECORD_TYPE_MAPPING ; -TraceEventIter iter;TraceEvent *ev; -trace_event_iter_init_all (&iter); -while ((ev =trace_event_iter_next (&iter)) !=NULL ) { +while ((ev =trace_event_iter_next (iter)) !=NULL ) {uint64_t id =trace_event_get_id (ev);const char *name =trace_event_get_name (ev);uint32_t len =strlen (name);
@@ -309,6 +307,7 @@ static int st_write_event_mapping(void)*/ bool st_set_trace_file_enabled (bool enable) { +TraceEventIter iter;bool was_enabled = trace_fp;if (enable == !!trace_fp) {
@@ -333,8 +332,9 @@ bool st_set_trace_file_enabled(bool enable)return was_enabled; } +trace_event_iter_init_all (&iter);if (fwrite (&header,sizeof header,1 , trace_fp) !=1 || -st_write_event_mapping () <0 ) { +st_write_event_mapping (&iter) <0 ) {fclose (trace_fp); trace_fp =NULL ;return was_enabled;
Signature · 1 line
2.29.2
Re: [PATCH v3 7/8] trace/simple: pass iter to st_write_event_mapping
Quoted 7 lines · Gerd Hoffmann
Pass an iter to
st_write_event_mapping, so the function can interate different things depending on how we initialize the iter.Signed-off-by Gerd Hoffmann <[email protected]>--- trace/simple.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
PATCH v3 8/8 trace/simple: add st_init_group
In reply to Gerd HoffmannAdd helper function and call it for each trace event group added. Makes sure that events added at module load time are initialized properly.
--- trace/simple.h | 1 + trace/control.c | 4 ++++ trace/simple.c | 12 ++++++++++++ 3 files changed, 17 insertions(+)
trace/simple.h +1 -0
@@ -15,6 +15,7 @@ void st_print_trace_file_status(void);bool st_set_trace_file_enabled (bool enable);void st_set_trace_file (const char *file);bool st_init (void ); +void st_init_group (size_t group);void st_flush_trace_buffer (void ); typedef struct {
trace/control.c +4 -0
@@ -81,6 +81,10 @@ void trace_event_register_group(TraceEvent **events) event_groups =g_renew (TraceEventGroup, event_groups, nevent_groups +1 ); event_groups[nevent_groups].events = events; nevent_groups++; + +#ifdef CONFIG_TRACE_SIMPLE +st_init_group (nevent_groups -1 ); +#endif }
trace/simple.c +12 -0
@@ -422,3 +422,15 @@ bool st_init(void)atexit (st_flush_trace_buffer);return true; } + +void st_init_group (size_t group) +{ +TraceEventIter iter; + +if (!trace_writeout_enabled) { +return ; + } + +trace_event_iter_init_group (&iter, group); +st_write_event_mapping (&iter); +}
Signature · 1 line
2.29.2
Re: [PATCH v3 8/8] trace/simple: add st_init_group
Quoted 10 lines · Gerd Hoffmann
Add helper function and call it for each trace event group added. Makes sure that events added at module load time are initialized properly.
Signed-off-by Gerd Hoffmann <[email protected]>--- trace/simple.h | 1 + trace/control.c | 4 ++++ trace/simple.c | 12 ++++++++++++ 3 files changed, 17 insertions(+)
Quoted 5 lines · Gerd Hoffmann
First version that actually works. Only qxl covered for this RfC, other modules will follow once the basics are hashed out.
v3:
- handle initialization of modular tracepoints.
Cool, this looks promising!
Quoted 5 lines
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.
Two ideas:
Global trace event name list
----------------------------
Build *some* global information about all trace events, including modules, into the main QEMU binary. For example, generate an array of all trace event names so QEMU can always print an error if a non-existent trace event name is used. (This is similar to the trace-events-all file, which is a global list of all trace events.)
Module name prefixes
--------------------
Allow an optional module/group prefix like qxl:my_trace_event. When the user says:
--trace qxl:my_trace_event
QEMU knows that this trace event belongs to the "qxl" module/group. It will not attempt to load it until the qxl module registers itself.
If "my_trace_event" doesn't exist in the qxl module:
1. If the qxl module is not loaded we don't hit an error. Nevermind.
2. When the qxl module is loaded pending events are resolved and an error is printed.
Hi,
Quoted 23 lines
Quoted 5 lines
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.Two ideas:
Global trace event name list
----------------------------
Build *some* global information about all trace events, including modules, into the main QEMU binary. For example, generate an array of all trace event names so QEMU can always print an error if a non-existent trace event name is used. (This is similar to the trace-events-all file, which is a global list of all trace events.)Module name prefixes
--------------------
Allow an optional module/group prefix like qxl:my_trace_event. When the user says:--trace qxl:my_trace_event
Quoted 7 lines
QEMU knows that this trace event belongs to the "qxl" module/group. It will not attempt to load it until the qxl module registers itself.
If "
my_trace_event" doesn't exist in the qxl module:
1. If the qxl module is not loaded we don't hit an error. Nevermind.
2. When the qxl module is loaded pending events are resolved and an error is printed.
Finally found the time to look at this again...
So, we already have a "group". Which is basically the sub-directory of the trace-events file right now, and it seems to be mostly a build system thing. We get many small lists instead of one huge, but there seems to be no other effect. We could change that though, by giving each group an (optional?) prefix.
There also is a probe prefix, apparently used by dtrace only. Not sure how to deal with that. It prefix is qemu-<target-type>-<target-name>. Giving qemu modules its own dtrace prefix looks sensible to me. That would probably something like "qemu-module-<name>".
take care,
Gerd
Quoted 33 lines · Gerd Hoffmann
Hi,
Quoted 23 lines
Quoted 5 lines
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.Two ideas:
Global trace event name list
----------------------------
Build *some* global information about all trace events, including modules, into the main QEMU binary. For example, generate an array of all trace event names so QEMU can always print an error if a non-existent trace event name is used. (This is similar to the trace-events-all file, which is a global list of all trace events.)Module name prefixes
--------------------
Allow an optional module/group prefix like qxl:my_trace_event. When the user says:--trace qxl:my_trace_event
Quoted 7 lines
QEMU knows that this trace event belongs to the "qxl" module/group. It will not attempt to load it until the qxl module registers itself.
If "
my_trace_event" doesn't exist in the qxl module:
1. If the qxl module is not loaded we don't hit an error. Nevermind.
2. When the qxl module is loaded pending events are resolved and an error is printed.
Quoted 7 lines
Finally found the time to look at this again...
So, we already have a "group". Which is basically the sub-directory of the trace-events file right now, and it seems to be mostly a build system thing. We get many small lists instead of one huge, but there seems to be no other effect. We could change that though, by giving each group an (optional?) prefix.
Yes. This reminds me of an idea that was mentioned at the beginning of this effort: maybe QEMU modules should always have their own directory in the source tree instead of being alongside other source files that are built into the main binary.
Quoted 4 lines
There also is a probe prefix, apparently used by dtrace only. Not sure how to deal with that. It prefix is qemu-<target-type>-<target-name>. Giving qemu modules its own dtrace prefix looks sensible to me. That would probably something like "qemu-module-<name>".
I think the DTrace prefix needs to be the same as the executable name, but I'm not sure. I also don't know how that extends to shared libraries like QEMU modules. I'm afraid you would need to investigate the DTrace prefix.
Stefan
Quoted 42 lines · Stefan Hajnoczi
Quoted 33 lines · Gerd Hoffmann
Hi,
Quoted 23 lines
Quoted 5 lines
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.Two ideas:
Global trace event name list
----------------------------
Build *some* global information about all trace events, including modules, into the main QEMU binary. For example, generate an array of all trace event names so QEMU can always print an error if a non-existent trace event name is used. (This is similar to the trace-events-all file, which is a global list of all trace events.)Module name prefixes
--------------------
Allow an optional module/group prefix like qxl:my_trace_event. When the user says:--trace qxl:my_trace_event
Quoted 7 lines
QEMU knows that this trace event belongs to the "qxl" module/group. It will not attempt to load it until the qxl module registers itself.
If "
my_trace_event" doesn't exist in the qxl module:
1. If the qxl module is not loaded we don't hit an error. Nevermind.
2. When the qxl module is loaded pending events are resolved and an error is printed.Quoted 7 lines
Finally found the time to look at this again...
So, we already have a "group". Which is basically the sub-directory of the trace-events file right now, and it seems to be mostly a build system thing. We get many small lists instead of one huge, but there seems to be no other effect. We could change that though, by giving each group an (optional?) prefix.
Quoted 4 lines
Yes. This reminds me of an idea that was mentioned at the beginning of this effort: maybe QEMU modules should always have their own directory in the source tree instead of being alongside other source files that are built into the main binary.
This implies that each time we modularize something, we have to move its source code. It is possible, but it wouldn't be by preferred choice.
Quoted 9 lines
Quoted 4 lines
There also is a probe prefix, apparently used by dtrace only. Not sure how to deal with that. It prefix is qemu-<target-type>-<target-name>. Giving qemu modules its own dtrace prefix looks sensible to me. That would probably something like "qemu-module-<name>".
I think the DTrace prefix needs to be the same as the executable name, but I'm not sure. I also don't know how that extends to shared libraries like QEMU modules. I'm afraid you would need to investigate the DTrace prefix.
I'm not aware of any requirement for dtrace prefix to match the executable name. We don't even have an executable called "qemu" so we're not matching even today.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 43 lines · Daniel P. Berrangé
Quoted 42 lines · Stefan Hajnoczi
Quoted 40 lines · Gerd Hoffmann
Hi,
Quoted 23 lines
Quoted 5 lines
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.Two ideas:
Global trace event name list
----------------------------
Build *some* global information about all trace events, including modules, into the main QEMU binary. For example, generate an array of all trace event names so QEMU can always print an error if a non-existent trace event name is used. (This is similar to the trace-events-all file, which is a global list of all trace events.)Module name prefixes
--------------------
Allow an optional module/group prefix like qxl:my_trace_event. When the user says:--trace qxl:my_trace_event
Quoted 7 lines
QEMU knows that this trace event belongs to the "qxl" module/group. It will not attempt to load it until the qxl module registers itself.
If "
my_trace_event" doesn't exist in the qxl module:
1. If the qxl module is not loaded we don't hit an error. Nevermind.
2. When the qxl module is loaded pending events are resolved and an error is printed.Finally found the time to look at this again...
So, we already have a "group". Which is basically the sub-directory of the trace-events file right now, and it seems to be mostly a build system thing. We get many small lists instead of one huge, but there seems to be no other effect. We could change that though, by giving each group an (optional?) prefix.
Quoted 8 lines
Quoted 4 lines
Yes. This reminds me of an idea that was mentioned at the beginning of this effort: maybe QEMU modules should always have their own directory in the source tree instead of being alongside other source files that are built into the main binary.
This implies that each time we modularize something, we have to move its source code. It is possible, but it wouldn't be by preferred choice.
If it bothers you then it probably bothers others too. Let's leave it.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
There also is a probe prefix, apparently used by dtrace only. Not sure how to deal with that. It prefix is qemu-<target-type>-<target-name>. Giving qemu modules its own dtrace prefix looks sensible to me. That would probably something like "qemu-module-<name>".
Quoted 8 lines
Quoted 4 lines
I think the DTrace prefix needs to be the same as the executable name, but I'm not sure. I also don't know how that extends to shared libraries like QEMU modules. I'm afraid you would need to investigate the DTrace prefix.
I'm not aware of any requirement for dtrace prefix to match the executable name. We don't even have an executable called "qemu" so we're not matching even today.
Great, thanks for the other email reply where you showed how the SystemTap tapsetsuse the prefix!
Stefan
Quoted 41 lines · Gerd Hoffmann
Hi,
Quoted 23 lines
Quoted 5 lines
TODO:
Enabling modular tracepoints via -trace cmd line doesn't work yet. Guess we need to store the list somewhere for later re-processing. Error handling is tricky, specifically the "tracepoint doesn't exist" error. Suggestions / ideas are welcome.Two ideas:
Global trace event name list
----------------------------
Build *some* global information about all trace events, including modules, into the main QEMU binary. For example, generate an array of all trace event names so QEMU can always print an error if a non-existent trace event name is used. (This is similar to the trace-events-all file, which is a global list of all trace events.)Module name prefixes
--------------------
Allow an optional module/group prefix like qxl:my_trace_event. When the user says:--trace qxl:my_trace_event
Quoted 7 lines
QEMU knows that this trace event belongs to the "qxl" module/group. It will not attempt to load it until the qxl module registers itself.
If "
my_trace_event" doesn't exist in the qxl module:
1. If the qxl module is not loaded we don't hit an error. Nevermind.
2. When the qxl module is loaded pending events are resolved and an error is printed.Finally found the time to look at this again...
So, we already have a "group". Which is basically the sub-directory of the trace-events file right now, and it seems to be mostly a build system thing. We get many small lists instead of one huge, but there seems to be no other effect. We could change that though, by giving each group an (optional?) prefix.
Quoted 4 lines
There also is a probe prefix, apparently used by dtrace only. Not sure how to deal with that. It prefix is qemu-<target-type>-<target-name>. Giving qemu modules its own dtrace prefix looks sensible to me. That would probably something like "qemu-module-<name>".
The prefix is used by the systemtap backend. It lets us define friendly probes, scoped for each QEMU emulator target.
eg a trace point "dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:
probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait") probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-ppc64").mark("dma_map_wait") probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-aarch64").mark("dma_map_wait")
there is nothing here that reqiures us to change the prefix for a module - we can carry on using the same systemtap probe name whether modules are used or not.
Currently we kind of unofficially have a convention that the name of a trace point should reflect its functional area. So all QXL related probes have a name prefix "qxl_".
We could make that explicit, by having the trace-events files support a group, IOW instead of
qxl_destroy_primary(int qid) "%d"
qxl_enter_vga_mode(int qid) "%d"
qxl_exit_vga_mode(int qid) "%d"
We could say that a dot separates the group from the probe name, and thus have
qxl.destroy_primary(int qid) "%d"
qxl.enter_vga_mode(int qid) "%d"
qxl.exit_vga_mode(int qid) "%d"
this would be backwards compatible, as we can turn the "." back into a "_" for all existing trace backends, except stp.
NB this is all tagential to use of modules at a build system /runtime level. I think this explicit grouping of probes would make sense for everything, to make the naming convention explicit instead of implicit.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Hi,
Quoted 6 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait") probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-ppc64").mark("dma_map_wait")
Probe qemu.system.ppc64.dma_map_wait = ...
Can I trace qemu started from build directory? Seems scripts/qemu-trace-stap doesn't support that.
Quoted 6 lines
qxl.destroy_primary(int qid)"%d"
qxl.enter_vga_mode(int qid)"%d"
qxl.exit_vga_mode(int qid)"%d"this would be backwards compatible, as we can turn the "." back into a "_" for all existing trace backends, except stp.
Hmm, not sure I like this inconsistency. I think names should be the same no matter which trace backend is used.
take care,
Gerd
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:
Quoted 7 lines
Quoted 2 lines
probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait") probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-ppc64").mark("dma_map_wait")
Probe qemu.system.ppc64.dma_map_wait = ...
Can I trace qemu started from build directory? Seems
scripts/qemu-trace-stapdoesn't support that.
We should really generate extra equiv .stp files just for running from the build.
Quoted 9 lines
Quoted 6 lines
qxl.destroy_primary(int qid)"%d"
qxl.enter_vga_mode(int qid)"%d"
qxl.exit_vga_mode(int qid)"%d"this would be backwards compatible, as we can turn the "." back into a "_" for all existing trace backends, except stp.
Hmm, not sure I like this inconsistency. I think names should be the same no matter which trace backend is used.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 10 lines · Daniel P. Berrangé
Quoted 9 lines · Gerd Hoffmann
Hi,
Quoted 6 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait") probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-ppc64").mark("dma_map_wait")
Quoted 7 lines
Quoted 4 lines
Probe qemu.system.ppc64.dma_map_wait = ...
Can I trace qemu started from build directory? Seems
scripts/qemu-trace-stapdoesn't support that.We should really generate extra equiv .stp files just for running from the build.
Well, "make install" with --prefix=$HOME/qemu-install fixed that for the time being.
Now I have this:
kraxel@sirius ~/qemu-install/bin# sudo ./qemu-trace-stap -v run ./qemu-system-x86_64 "qxl_soft_reset"
Using tapset dir '/home/kraxel/qemu-install/share/systemtap/tapset' for binary './qemu-system-x86_64'
Compiling script 'probe qemu.system.x86_64.log.qxl_soft_reset {}'
semantic error: unresolved function pid: identifier 'pid' at /home/kraxel/qemu-install/share/systemtap/tapset/qemu-system-x86_64-log.stp:5451:41
source: printf("%d@%d qxl_soft_reset %d\n", pid(), gettimeofday_ns(), qid)
^Pass 2: analysis failed. [man error::pass2]
Any clue why pid() isn't known?
thanks,
Gerd
Quoted 28 lines · Gerd Hoffmann
Quoted 10 lines · Daniel P. Berrangé
Quoted 9 lines · Gerd Hoffmann
Hi,
Quoted 6 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait") probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-ppc64").mark("dma_map_wait")
Quoted 7 lines
Quoted 4 lines
Probe qemu.system.ppc64.dma_map_wait = ...
Can I trace qemu started from build directory? Seems
scripts/qemu-trace-stapdoesn't support that.We should really generate extra equiv .stp files just for running from the build.
Well, "make install" with --prefix=$HOME/qemu-install fixed that for the time being.
Now I have this:
kraxel@sirius ~/qemu-install/bin# sudo ./qemu-trace-stap -v run ./qemu-system-x86_64 "
qxl_soft_reset"
Using tapset dir '/home/kraxel/qemu-install/share/systemtap/tapset' for binary './qemu-system-x86_64'
Compiling script 'probe qemu.system.x86_64.log.qxl_soft_reset {}'
semantic error: unresolved function pid: identifier 'pid' at/home/kraxel/qemu-install/share/systemtap/tapset/qemu-system-x86_64-log.stp:5451:41
Quoted 6 lines
source: printf("%d@%d qxl_soft_reset %d\n", pid(), gettimeofday_ns(), qid) ^Pass 2: analysis failed. [man
error::pass2]Any clue why
pid()isn't known?
Hmm, strange, makes me think we have a bug causing it to not pull in global functions.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Hi,
Quoted 12 lines
Quoted 12 lines
Well, "make install" with --prefix=$HOME/qemu-install fixed that for the time being.
Now I have this:
kraxel@sirius ~/qemu-install/bin# sudo ./qemu-trace-stap -v run ./qemu-system-x86_64 "
qxl_soft_reset"
Using tapset dir '/home/kraxel/qemu-install/share/systemtap/tapset' for binary './qemu-system-x86_64'
Compiling script 'probe qemu.system.x86_64.log.qxl_soft_reset {}'
semantic error: unresolved function pid: identifier 'pid' at/home/kraxel/qemu-install/share/systemtap/tapset/qemu-system-x86_64-log.stp:5451:41source: printf("%d@%d qxl_soft_reset %d\n", pid(), gettimeofday_ns(), qid) ^
Quoted 6 lines
Quoted 3 lines
Pass 2: analysis failed. [man
error::pass2]Any clue why
pid()isn't known?Hmm, strange, makes me think we have a bug causing it to not pull in global functions.
Hmm. 5.1.0 fails the same way. 5.2.0 fails in a different way. Seems we had temporary breakage in 5.2.0 (was that the module thing which needed some workaround?). Given 5.1.0 fails too I suspect this is a systemtap change (/me runs fedora 33). Googling didn't found much, other than indicating pid() is used frequently in examples and tutorials.
stap-prep asked for kernel-debuginfo, but installing that (huge package with 3.5G(!) installed size) hasn't changed the situation. Guess I only actually need that if I want trace the kernel not userspace?
take care,
Gerd
Hi,
Quoted 5 lines
Quoted 2 lines
semantic error: unresolved function pid: identifier 'pid' at
/home/kraxel/qemu-install/share/systemtap/tapset/qemu-system-x86_64-log.stp:5451:41source: printf("%d@%d qxl_soft_reset %d\n", pid(), gettimeofday_ns(), qid)Hmm, strange, makes me think we have a bug causing it to not pull in global functions.
Yep. qemu-trace-stap sets SYSTEMTAP_TAPSET to /home/kraxel/qemu-install/share/systemtap/tapset. Which makes stap use that exclusively and ignore /usr/share/systemtap/tapset. Which in turn makes pid() disappear because that apparently is defined somewhere in those tapsets.
IOW: It's broken for any $prefix != "/usr".
Using stap -I /home/kraxel/qemu-install/share/systemtap/tapset seems to work fine, I guess qemu-trace-stap should use that instead ...
take care,
Gerd
Hi,
Quoted 5 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait")
So, that changes with modules, we need the module name now, i.e.
probe qemu.system.x86_64.qxl_soft_reset = \
process("/home/kraxel/qemu-install/lib/qemu/hw-display-qxl.so").mark("qxl_soft_reset")We could repeat that in every qemu-system-$arch.stp file.
We could also have one stp file per module, with probes like this:
probe qemu.modules.qxl_soft_reset = \
process("/home/kraxel/qemu-install/lib/qemu/hw-display-qxl.so").mark("qxl_soft_reset")The later looks like a better fit to me, but has the drawback that the tracepoints have different names in modular and non-modular builds ...
take care,
Gerd
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:
Quoted 8 lines
Quoted 1 line
probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait")
So, that changes with modules, we need the module name now, i.e.
probe qemu.system.x86_64.qxl_soft_reset = \ process("/home/kraxel/qemu-install/lib/qemu/hw-display-qxl.so").mark("qxl_soft_reset")We could repeat that in every qemu-system-$arch.stp file.
This would have the surprise the 'qemu.system.x86_64.qxl_soft_reset' probes will fire even for qemu-system-ppc64 / qemu-system-xxxxx etc because we've not restricted the scope as the original probe did.
If we can't fix that, then we must use the second option to avoid the surprise IMHO
Quoted 7 lines
We could also have one stp file per module, with probes like this:
probe qemu.modules.qxl_soft_reset = \ process("/home/kraxel/qemu-install/lib/qemu/hw-display-qxl.so").mark("qxl_soft_reset")The later looks like a better fit to me, but has the drawback that the tracepoints have different names in modular and non-modular builds ...
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 11 lines · Daniel P. Berrangé
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait")
So, that changes with modules, we need the module name now, i.e.
Quoted 8 lines
Quoted 4 lines
probe qemu.system.x86_64.qxl_soft_reset = \ process("/home/kraxel/qemu-install/lib/qemu/hw-display-qxl.so").mark("qxl_soft_reset")We could repeat that in every qemu-system-$arch.stp file.
This would have the surprise the 'qemu.system.x86_64.qxl_soft_reset' probes will fire even for qemu-system-ppc64 / qemu-system-xxxxx etc because we've not restricted the scope as the original probe did.
Oh, right.
Quoted 2 lines
If we can't fix that, then we must use the second option to avoid the surprise IMHO
Yep. Got that working. Only problem is qemu-trace-stap is broken now and it seems there is no easy way out. Right now qemu-trace-stap can simply work with a constant prefix, with that change the prefix can be either qemu.system.$arch or qemu.system.modules and I suspect there is no way around listing tracepoints to figure the correct name ...
take care,
Gerd
PS: https://git.kraxel.org/cgit/qemu/log/?h=sirius/trace-modules
Quoted 23 lines · Gerd Hoffmann
Quoted 11 lines · Daniel P. Berrangé
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
eg a trace point "
dma_map_wait" gets mapped to probes in many .stp files, once per target, because we need to match based on the executable path:probe qemu.system.x86_64.dma_map_wait = process("/usr/libexec/qemu-system-x86_64").mark("dma_map_wait")
So, that changes with modules, we need the module name now, i.e.
Quoted 8 lines
Quoted 4 lines
probe qemu.system.x86_64.qxl_soft_reset = \ process("/home/kraxel/qemu-install/lib/qemu/hw-display-qxl.so").mark("qxl_soft_reset")We could repeat that in every qemu-system-$arch.stp file.
This would have the surprise the 'qemu.system.x86_64.qxl_soft_reset' probes will fire even for qemu-system-ppc64 / qemu-system-xxxxx etc because we've not restricted the scope as the original probe did.
Oh, right.
Quoted 8 lines
Quoted 2 lines
If we can't fix that, then we must use the second option to avoid the surprise IMHO
Yep. Got that working. Only problem is qemu-trace-stap is broken now and it seems there is no easy way out. Right now qemu-trace-stap can simply work with a constant prefix, with that change the prefix can be either qemu.system.$arch or qemu.system.modules and I suspect there is no way around listing tracepoints to figure the correct name ...
Maybe just don't change the probe names, and declare that people have to tell stap to filter by pid if you want exact matches
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|