All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/13] [RfC] fix tracing for modules
@ 2021-06-01 13:24 Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful Gerd Hoffmann
                   ` (13 more replies)
  0 siblings, 14 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

First version that actually works.  Only qxl covered for this RfC,
other modules will follow once the basics are hashed out.

v4:
 - rebase to latest master.
 - fix systemtap tracing.
 - also cover virtio-gpu modules.
 - pick up some review tags.
 - misc minor tweaks.

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 (13):
  qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful.
  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
  meson: add trace_events_config[]
  meson: move up hw subdir (specifically before trace subdir)
  meson: add module_trace & module_trace_src
  trace/stap: build stap files for modules
  meson: move qxl trace events to separate file
  virtio-gpu: split trace points
  meson: move virtio trace events to separate file
  meson: move virtio-gl trace events to separate file

 hw/display/trace-qxl.h            |  1 +
 hw/display/trace-virtio-gl.h      |  1 +
 hw/display/trace-virtio.h         |  1 +
 trace/control.h                   | 30 ++++++++--
 trace/simple.h                    |  1 +
 hw/display/qxl-render.c           |  2 +-
 hw/display/qxl.c                  |  2 +-
 hw/display/virtio-gpu-base.c      |  2 +-
 hw/display/virtio-gpu-virgl.c     | 50 ++++++++--------
 hw/display/virtio-gpu.c           |  2 +-
 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            | 12 ++++
 hw/display/trace-events           | 95 -------------------------------
 hw/display/trace-events-qxl       | 66 +++++++++++++++++++++
 hw/display/trace-events-virtio    | 16 ++++++
 hw/display/trace-events-virtio-gl | 18 ++++++
 meson.build                       | 43 +++++++++++++-
 scripts/qemu-trace-stap           | 14 ++---
 trace/meson.build                 | 36 +++++++++---
 23 files changed, 298 insertions(+), 167 deletions(-)
 create mode 100644 hw/display/trace-qxl.h
 create mode 100644 hw/display/trace-virtio-gl.h
 create mode 100644 hw/display/trace-virtio.h
 create mode 100644 hw/display/trace-events-qxl
 create mode 100644 hw/display/trace-events-virtio
 create mode 100644 hw/display/trace-events-virtio-gl

-- 
2.31.1




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

* [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful.
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-09 12:39   ` Stefan Hajnoczi
  2021-06-09 15:21   ` Daniel P. Berrangé
  2021-06-01 13:24 ` [PATCH v4 02/13] trace: iter init tweaks Gerd Hoffmann
                   ` (12 subsequent siblings)
  13 siblings, 2 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Setting SYSTEMTAP_TAPSET to some value other than
/usr/share/systemtap/tapsets results in systemtap not finding the
standard tapset library any more, which in turn breaks tracing because
pid() and other standard systemtap functions are not available any more.

So using SYSTEMTAP_TAPSET to point systemtap to the qemu probes will
only work for the prefix=/usr installs because both qemu and system
tapsets in the same directory then.  All other prefixes are broken.

Fix that by using the "-I $tapsetdir" command line switch instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 scripts/qemu-trace-stap | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/scripts/qemu-trace-stap b/scripts/qemu-trace-stap
index 90527eb974f4..eb6e951ff235 100755
--- a/scripts/qemu-trace-stap
+++ b/scripts/qemu-trace-stap
@@ -55,11 +55,6 @@ def tapset_dir(binary):
     return os.path.realpath(tapset)
 
 
-def tapset_env(tapset_dir):
-    tenv = copy.copy(os.environ)
-    tenv["SYSTEMTAP_TAPSET"] = tapset_dir
-    return tenv
-
 def cmd_run(args):
     prefix = probe_prefix(args.binary)
     tapsets = tapset_dir(args.binary)
@@ -81,11 +76,11 @@ def cmd_run(args):
 
     # We request an 8MB buffer, since the stap default 1MB buffer
     # can be easily overflowed by frequently firing QEMU traces
-    stapargs = ["stap", "-s", "8"]
+    stapargs = ["stap", "-s", "8", "-I", tapsets ]
     if args.pid is not None:
         stapargs.extend(["-x", args.pid])
     stapargs.extend(["-e", script])
-    subprocess.call(stapargs, env=tapset_env(tapsets))
+    subprocess.call(stapargs)
 
 
 def cmd_list(args):
@@ -101,10 +96,9 @@ def cmd_list(args):
 
         if verbose:
             print("Listing probes with name '%s'" % script)
-        proc = subprocess.Popen(["stap", "-l", script],
+        proc = subprocess.Popen(["stap", "-I", tapsets, "-l", script],
                                 stdout=subprocess.PIPE,
-                                universal_newlines=True,
-                                env=tapset_env(tapsets))
+                                universal_newlines=True)
         out, err = proc.communicate()
         if proc.returncode != 0:
             print("No probes found, are the tapsets installed in %s" % tapset_dir(args.binary))
-- 
2.31.1



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

* [PATCH v4 02/13] trace: iter init tweaks
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 03/13] trace: add trace_event_iter_init_group Gerd Hoffmann
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Rename trace_event_iter_init() to trace_event_iter_init_pattern(),
add trace_event_iter_init_all() for interating over all events.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 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(-)

diff --git a/trace/control.h b/trace/control.h
index 9522a7b318e2..ce40bd040574 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -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:
diff --git a/monitor/misc.c b/monitor/misc.c
index f3a393ea590b..f9b86bf4a778 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1833,7 +1833,7 @@ void info_trace_events_completion(ReadLineState *rs, int nb_args, const char *st
         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));
         }
@@ -1851,7 +1851,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));
         }
diff --git a/trace/control-target.c b/trace/control-target.c
index e293eeed7c00..8418673c18cf 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -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) &&
diff --git a/trace/control.c b/trace/control.c
index 4be38e1af28d..ed38e813b23d 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -91,7 +91,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;
@@ -100,10 +100,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;
 }
 
@@ -130,7 +136,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));
     }
@@ -150,7 +156,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) {
@@ -256,7 +262,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) &&
diff --git a/trace/qmp.c b/trace/qmp.c
index 85f81e47cc6d..3b4f4702b4f0 100644
--- a/trace/qmp.c
+++ b/trace/qmp.c
@@ -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))) {
diff --git a/trace/simple.c b/trace/simple.c
index 9cd2ed1fb3f4..97b6f85168e7 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -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);
-- 
2.31.1



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

* [PATCH v4 03/13] trace: add trace_event_iter_init_group
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 02/13] trace: iter init tweaks Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 04/13] trace/simple: pass iter to st_write_event_mapping Gerd Hoffmann
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

This allows to interate over an event group.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace/control.h | 13 +++++++++++++
 trace/control.c | 19 ++++++++++++++++---
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/trace/control.h b/trace/control.h
index ce40bd040574..23b8393b297e 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -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
diff --git a/trace/control.c b/trace/control.c
index ed38e813b23d..2c904b7ee4c6 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -104,6 +104,7 @@ void trace_event_iter_init_all(TraceEventIter *iter)
 {
     iter->event = 0;
     iter->group = 0;
+    iter->group_id = -1;
     iter->pattern = NULL;
 }
 
@@ -113,20 +114,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;
-- 
2.31.1



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

* [PATCH v4 04/13] trace/simple: pass iter to st_write_event_mapping
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 03/13] trace: add trace_event_iter_init_group Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 05/13] trace/simple: add st_init_group Gerd Hoffmann
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, 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 <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace/simple.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/trace/simple.c b/trace/simple.c
index 97b6f85168e7..ec2156d135cb 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -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;
-- 
2.31.1



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

* [PATCH v4 05/13] trace/simple: add st_init_group
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 04/13] trace/simple: pass iter to st_write_event_mapping Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 06/13] meson: add trace_events_config[] Gerd Hoffmann
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, 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 <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace/simple.h  |  1 +
 trace/control.c |  4 ++++
 trace/simple.c  | 12 ++++++++++++
 3 files changed, 17 insertions(+)

diff --git a/trace/simple.h b/trace/simple.h
index 26ccbc8b8ae3..ee1983ce5617 100644
--- a/trace/simple.h
+++ b/trace/simple.h
@@ -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 {
diff --git a/trace/control.c b/trace/control.c
index 2c904b7ee4c6..d5b68e846eeb 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -82,6 +82,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
 }
 
 
diff --git a/trace/simple.c b/trace/simple.c
index ec2156d135cb..ac499edee0d5 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -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);
+}
-- 
2.31.1



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

* [PATCH v4 06/13] meson: add trace_events_config[]
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 05/13] trace/simple: add st_init_group Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 07/13] meson: move up hw subdir (specifically before trace subdir) Gerd Hoffmann
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, 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 <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 meson.build       |  1 +
 trace/meson.build | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index a45f1a844f13..84a9e17533cb 100644
--- a/meson.build
+++ b/meson.build
@@ -1774,6 +1774,7 @@ target_user_arch = {}
 
 # TODO: add each directory to the subdirs from its own meson.build, once
 # we have those
+trace_events_config = []
 trace_events_subdirs = [
   'crypto',
   'qapi',
diff --git a/trace/meson.build b/trace/meson.build
index 08f83a15c316..bc946495a714 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -2,10 +2,22 @@
 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_name = c.get('group')
   group = '--group=' + group_name
   fmt = '@0@-' + group_name + '.@1@'
 
-- 
2.31.1



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

* [PATCH v4 07/13] meson: move up hw subdir (specifically before trace subdir)
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 06/13] meson: add trace_events_config[] Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-09 12:42   ` Stefan Hajnoczi
  2021-06-01 13:24 ` [PATCH v4 08/13] meson: add module_trace & module_trace_src Gerd Hoffmann
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Needed so trace/meson.build can see trace_events_config[]
changes done in hw/*/meson.build.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 84a9e17533cb..b1f2e7920977 100644
--- a/meson.build
+++ b/meson.build
@@ -1878,6 +1878,10 @@ if 'CONFIG_VHOST_USER' in config_host
   vhost_user = libvhost_user.get_variable('vhost_user_dep')
 endif
 
+# any subdir updating trace_events_config[] must
+# come before the 'trace' subdir.
+subdir('hw')
+
 subdir('qapi')
 subdir('qobject')
 subdir('stubs')
@@ -1988,7 +1992,6 @@ subdir('monitor')
 subdir('net')
 subdir('replay')
 subdir('semihosting')
-subdir('hw')
 subdir('accel')
 subdir('plugins')
 subdir('bsd-user')
-- 
2.31.1



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

* [PATCH v4 08/13] meson: add module_trace & module_trace_src
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 07/13] meson: move up hw subdir (specifically before trace subdir) Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 09/13] trace/stap: build stap files for modules Gerd Hoffmann
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

module_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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 meson.build       |  5 ++++-
 trace/meson.build | 17 ++++++++++++-----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index b1f2e7920977..0e1c2f995d79 100644
--- a/meson.build
+++ b/meson.build
@@ -1763,6 +1763,7 @@ user_ss = ss.source_set()
 util_ss = ss.source_set()
 
 modules = {}
+module_trace = {}
 hw_arch = {}
 target_arch = {}
 target_softmmu_arch = {}
@@ -2017,7 +2018,9 @@ 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_cfg = module_trace.get(d + '-' + m, {})
+      module_trace_src = module_trace_cfg.get('src', [])
+      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
diff --git a/trace/meson.build b/trace/meson.build
index bc946495a714..834ebaa7cc5f 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -17,9 +17,11 @@ endforeach
 foreach c : trace_events_config
   trace_events_file = c.get('file')
   trace_events_files += [ trace_events_file ]
-  group_name = c.get('group')
+  module_name = c.get('module', '')
+  group_name = c.get('group', module_name.underscorify())
   group = '--group=' + group_name
   fmt = '@0@-' + group_name + '.@1@'
+  module_trace_src = []
 
   trace_h = custom_target(fmt.format('trace', 'h'),
                           output: fmt.format('trace', 'h'),
@@ -38,10 +40,10 @@ foreach c : trace_events_config
                                 input: trace_events_file,
                                 command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
                                 depend_files: tracetool_depends)
-    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'),
@@ -52,17 +54,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 module_name != ''
+    module_trace += { module_name : { 'src' : module_trace_src } }
+  else
+    trace_ss.add(module_trace_src)
+  endif
 endforeach
 
 trace_events_all = custom_target('trace-events-all',
-- 
2.31.1



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

* [PATCH v4 09/13] trace/stap: build stap files for modules
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 08/13] meson: add module_trace & module_trace_src Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-09 12:48   ` Stefan Hajnoczi
  2021-06-01 13:24 ` [PATCH v4 10/13] meson: move qxl trace events to separate file Gerd Hoffmann
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 meson.build       | 32 ++++++++++++++++++++++++++++++++
 trace/meson.build |  5 +++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 0e1c2f995d79..51fc261a22d3 100644
--- a/meson.build
+++ b/meson.build
@@ -2020,6 +2020,7 @@ foreach d, list : modules
       module_ss = module_ss.apply(config_all, strict: false)
       module_trace_cfg = module_trace.get(d + '-' + m, {})
       module_trace_src = module_trace_cfg.get('src', [])
+      module_trace_evt = module_trace_cfg.get('evt', '')
       sl = static_library(d + '-' + m, [genh, module_ss.sources(), module_trace_src],
                           dependencies: [modulecommon, module_ss.dependencies()], pic: true)
       if d == 'block'
@@ -2027,6 +2028,37 @@ foreach d, list : modules
       else
         softmmu_mods += sl
       endif
+      if 'CONFIG_TRACE_SYSTEMTAP' in config_host and module_trace_evt != ''
+        modname = d + '-' + m
+	modlib = modname + '.so'
+        foreach stp: [
+          {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / modlib, 'install': false},
+          {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / qemu_moddir / modlib, 'install': true},
+          {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
+          {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
+        ]
+          foreach target : target_dirs
+            config_target = config_target_mak[target]
+            target_name = config_target['TARGET_NAME']
+            if target.endswith('-softmmu')
+              custom_target(modname + '-' + target_name + stp['ext'],
+                            input: module_trace_evt,
+                            output: modname + '-' + target_name + stp['ext'],
+                            install: stp['install'],
+                            install_dir: get_option('datadir') / 'systemtap/tapset',
+                            command: [
+                              tracetool, '--group=all', '--format=' + stp['fmt'],
+                              '--binary=' + stp['bin'],
+                              '--target-name=' + target_name,
+                              '--target-type=system',
+                              '--probe-prefix=qemu.system.' + target_name,
+                              '@INPUT@', '@OUTPUT@'
+                            ],
+                            depend_files: tracetool_depends)
+            endif
+          endforeach
+        endforeach
+      endif
     else
       if d == 'block'
         block_ss.add_all(module_ss)
diff --git a/trace/meson.build b/trace/meson.build
index 834ebaa7cc5f..82332a4a772b 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -16,7 +16,6 @@ endforeach
 
 foreach c : trace_events_config
   trace_events_file = c.get('file')
-  trace_events_files += [ trace_events_file ]
   module_name = c.get('module', '')
   group_name = c.get('group', module_name.underscorify())
   group = '--group=' + group_name
@@ -66,9 +65,11 @@ foreach c : trace_events_config
     genh += trace_dtrace_h
   endif
   if enable_modules and module_name != ''
-    module_trace += { module_name : { 'src' : module_trace_src } }
+    module_trace += { module_name : { 'src' : module_trace_src,
+                                      'evt' : trace_events_file } }
   else
     trace_ss.add(module_trace_src)
+    trace_events_files += [ trace_events_file ]
   endif
 endforeach
 
-- 
2.31.1



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

* [PATCH v4 10/13] meson: move qxl trace events to separate file
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 09/13] trace/stap: build stap files for modules Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-01 13:24 ` [PATCH v4 11/13] virtio-gpu: split trace points Gerd Hoffmann
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Move qxl trace events to separate trace-events-qxl file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/display/trace-qxl.h      |  1 +
 hw/display/qxl-render.c     |  2 +-
 hw/display/qxl.c            |  2 +-
 hw/display/meson.build      |  4 +++
 hw/display/trace-events     | 67 -------------------------------------
 hw/display/trace-events-qxl | 66 ++++++++++++++++++++++++++++++++++++
 6 files changed, 73 insertions(+), 69 deletions(-)
 create mode 100644 hw/display/trace-qxl.h
 create mode 100644 hw/display/trace-events-qxl

diff --git a/hw/display/trace-qxl.h b/hw/display/trace-qxl.h
new file mode 100644
index 000000000000..aa6355abc34e
--- /dev/null
+++ b/hw/display/trace-qxl.h
@@ -0,0 +1 @@
+#include "trace/trace-hw_display_qxl.h"
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index d28849b12176..7a61a750f5a0 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -22,7 +22,7 @@
 #include "qemu/osdep.h"
 #include "qxl.h"
 #include "sysemu/runstate.h"
-#include "trace.h"
+#include "trace-qxl.h"
 
 static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
 {
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 6e1f8ff1b2a7..9d936cbac049 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -32,7 +32,7 @@
 #include "sysemu/runstate.h"
 #include "migration/blocker.h"
 #include "migration/vmstate.h"
-#include "trace.h"
+#include "trace-qxl.h"
 
 #include "qxl.h"
 
diff --git a/hw/display/meson.build b/hw/display/meson.build
index e1f473c1dff5..ac98861986d1 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -42,6 +42,10 @@ 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',
+    'module' : 'hw-display-qxl',
+  }
   hw_display_modules += {'qxl': qxl_ss}
 endif
 
diff --git a/hw/display/trace-events b/hw/display/trace-events
index e47264af5da1..d9606677a436 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -50,73 +50,6 @@ virtio_gpu_update_cursor(uint32_t scanout, uint32_t x, uint32_t y, const char *t
 virtio_gpu_fence_ctrl(uint64_t fence, uint32_t type) "fence 0x%" PRIx64 ", type 0x%x"
 virtio_gpu_fence_resp(uint64_t fence) "fence 0x%" PRIx64
 
-# qxl.c
-disable qxl_interface_set_mm_time(int qid, uint32_t mm_time) "%d %d"
-disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u"
-qxl_create_guest_primary(int qid, uint32_t width, uint32_t height, uint64_t mem, uint32_t format, uint32_t position) "%d %ux%u mem=0x%" PRIx64 " %u,%u"
-qxl_create_guest_primary_rest(int qid, int32_t stride, uint32_t type, uint32_t flags) "%d %d,%d,%d"
-qxl_destroy_primary(int qid) "%d"
-qxl_enter_vga_mode(int qid) "%d"
-qxl_exit_vga_mode(int qid) "%d"
-qxl_hard_reset(int qid, int64_t loadvm) "%d loadvm=%"PRId64
-qxl_interface_async_complete_io(int qid, uint32_t current_async, void *cookie) "%d current=%d cookie=%p"
-qxl_interface_attach_worker(int qid) "%d"
-qxl_interface_get_init_info(int qid) "%d"
-qxl_interface_set_compression_level(int qid, int64_t level) "%d %"PRId64
-qxl_interface_update_area_complete(int qid, uint32_t surface_id, uint32_t dirty_left, uint32_t dirty_right, uint32_t dirty_top, uint32_t dirty_bottom) "%d surface=%d [%d,%d,%d,%d]"
-qxl_interface_update_area_complete_rest(int qid, uint32_t num_updated_rects) "%d #=%d"
-qxl_interface_update_area_complete_overflow(int qid, int max) "%d max=%d"
-qxl_interface_update_area_complete_schedule_bh(int qid, uint32_t num_dirty) "%d #dirty=%d"
-qxl_io_destroy_primary_ignored(int qid, const char *mode) "%d %s"
-qxl_io_log(int qid, const char *log_buf) "%d %s"
-qxl_io_read_unexpected(int qid) "%d"
-qxl_io_unexpected_vga_mode(int qid, uint64_t addr, uint64_t val, const char *desc) "%d 0x%"PRIx64"=%"PRIu64" (%s)"
-qxl_io_write(int qid, const char *mode, uint64_t addr, const char *aname, uint64_t val, unsigned size, int async) "%d %s addr=%"PRIu64 " (%s) val=%"PRIu64" size=%u async=%d"
-qxl_memslot_add_guest(int qid, uint32_t slot_id, uint64_t guest_start, uint64_t guest_end) "%d %u: guest phys 0x%"PRIx64 " - 0x%" PRIx64
-qxl_post_load(int qid, const char *mode) "%d %s"
-qxl_pre_load(int qid) "%d"
-qxl_pre_save(int qid) "%d"
-qxl_reset_surfaces(int qid) "%d"
-qxl_ring_command_check(int qid, const char *mode) "%d %s"
-qxl_ring_command_get(int qid, const char *mode) "%d %s"
-qxl_ring_command_req_notification(int qid) "%d"
-qxl_ring_cursor_check(int qid, const char *mode) "%d %s"
-qxl_ring_cursor_get(int qid, const char *mode) "%d %s"
-qxl_ring_cursor_req_notification(int qid) "%d"
-qxl_ring_res_push(int qid, const char *mode, uint32_t surface_count, uint32_t free_res, void *last_release, const char *notify) "%d %s s#=%d res#=%d last=%p notify=%s"
-qxl_ring_res_push_rest(int qid, uint32_t ring_has, uint32_t ring_size, uint32_t prod, uint32_t cons) "%d ring %d/%d [%d,%d]"
-qxl_ring_res_put(int qid, uint32_t free_res) "%d #res=%d"
-qxl_set_mode(int qid, int modenr, uint32_t x_res, uint32_t y_res, uint32_t bits, uint64_t devmem) "%d mode=%d [ x=%d y=%d @ bpp=%d devmem=0x%" PRIx64 " ]"
-qxl_soft_reset(int qid) "%d"
-qxl_spice_destroy_surfaces_complete(int qid) "%d"
-qxl_spice_destroy_surfaces(int qid, int async) "%d async=%d"
-qxl_spice_destroy_surface_wait_complete(int qid, uint32_t id) "%d sid=%d"
-qxl_spice_destroy_surface_wait(int qid, uint32_t id, int async) "%d sid=%d async=%d"
-qxl_spice_flush_surfaces_async(int qid, uint32_t surface_count, uint32_t num_free_res) "%d s#=%d, res#=%d"
-qxl_spice_monitors_config(int qid) "%d"
-qxl_spice_loadvm_commands(int qid, void *ext, uint32_t count) "%d ext=%p count=%d"
-qxl_spice_oom(int qid) "%d"
-qxl_spice_reset_cursor(int qid) "%d"
-qxl_spice_reset_image_cache(int qid) "%d"
-qxl_spice_reset_memslots(int qid) "%d"
-qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) "%d sid=%d [%d,%d,%d,%d]"
-qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t clear_dirty_region) "%d #d=%d clear=%d"
-qxl_surfaces_dirty(int qid, uint64_t offset, uint64_t size) "%d offset=0x%"PRIx64" size=0x%"PRIx64
-qxl_send_events(int qid, uint32_t events) "%d %d"
-qxl_send_events_vm_stopped(int qid, uint32_t events) "%d %d"
-qxl_set_guest_bug(int qid) "%d"
-qxl_interrupt_client_monitors_config(int qid, int num_heads, void *heads) "%d %d %p"
-qxl_client_monitors_config_unsupported_by_guest(int qid, uint32_t int_mask, void *client_monitors_config) "%d 0x%X %p"
-qxl_client_monitors_config_unsupported_by_device(int qid, int revision) "%d revision=%d"
-qxl_client_monitors_config_capped(int qid, int requested, int limit) "%d %d %d"
-qxl_client_monitors_config_crc(int qid, unsigned size, uint32_t crc32) "%d %u %u"
-qxl_set_client_capabilities_unsupported_by_revision(int qid, int revision) "%d revision=%d"
-
-# qxl-render.c
-qxl_render_blit(int32_t stride, int32_t left, int32_t right, int32_t top, int32_t bottom) "stride=%d [%d, %d, %d, %d]"
-qxl_render_guest_primary_resized(int32_t width, int32_t height, int32_t stride, int32_t bytes_pp, int32_t bits_pp) "%dx%d, stride %d, bpp %d, depth %d"
-qxl_render_update_area_done(void *cookie) "%p"
-
 # vga.c
 vga_std_read_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x"
 vga_std_write_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x"
diff --git a/hw/display/trace-events-qxl b/hw/display/trace-events-qxl
new file mode 100644
index 000000000000..1146bd1640d2
--- /dev/null
+++ b/hw/display/trace-events-qxl
@@ -0,0 +1,66 @@
+# qxl.c
+disable qxl_interface_set_mm_time(int qid, uint32_t mm_time) "%d %d"
+disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u"
+qxl_create_guest_primary(int qid, uint32_t width, uint32_t height, uint64_t mem, uint32_t format, uint32_t position) "%d %ux%u mem=0x%" PRIx64 " %u,%u"
+qxl_create_guest_primary_rest(int qid, int32_t stride, uint32_t type, uint32_t flags) "%d %d,%d,%d"
+qxl_destroy_primary(int qid) "%d"
+qxl_enter_vga_mode(int qid) "%d"
+qxl_exit_vga_mode(int qid) "%d"
+qxl_hard_reset(int qid, int64_t loadvm) "%d loadvm=%"PRId64
+qxl_interface_async_complete_io(int qid, uint32_t current_async, void *cookie) "%d current=%d cookie=%p"
+qxl_interface_attach_worker(int qid) "%d"
+qxl_interface_get_init_info(int qid) "%d"
+qxl_interface_set_compression_level(int qid, int64_t level) "%d %"PRId64
+qxl_interface_update_area_complete(int qid, uint32_t surface_id, uint32_t dirty_left, uint32_t dirty_right, uint32_t dirty_top, uint32_t dirty_bottom) "%d surface=%d [%d,%d,%d,%d]"
+qxl_interface_update_area_complete_rest(int qid, uint32_t num_updated_rects) "%d #=%d"
+qxl_interface_update_area_complete_overflow(int qid, int max) "%d max=%d"
+qxl_interface_update_area_complete_schedule_bh(int qid, uint32_t num_dirty) "%d #dirty=%d"
+qxl_io_destroy_primary_ignored(int qid, const char *mode) "%d %s"
+qxl_io_log(int qid, const char *log_buf) "%d %s"
+qxl_io_read_unexpected(int qid) "%d"
+qxl_io_unexpected_vga_mode(int qid, uint64_t addr, uint64_t val, const char *desc) "%d 0x%"PRIx64"=%"PRIu64" (%s)"
+qxl_io_write(int qid, const char *mode, uint64_t addr, const char *aname, uint64_t val, unsigned size, int async) "%d %s addr=%"PRIu64 " (%s) val=%"PRIu64" size=%u async=%d"
+qxl_memslot_add_guest(int qid, uint32_t slot_id, uint64_t guest_start, uint64_t guest_end) "%d %u: guest phys 0x%"PRIx64 " - 0x%" PRIx64
+qxl_post_load(int qid, const char *mode) "%d %s"
+qxl_pre_load(int qid) "%d"
+qxl_pre_save(int qid) "%d"
+qxl_reset_surfaces(int qid) "%d"
+qxl_ring_command_check(int qid, const char *mode) "%d %s"
+qxl_ring_command_get(int qid, const char *mode) "%d %s"
+qxl_ring_command_req_notification(int qid) "%d"
+qxl_ring_cursor_check(int qid, const char *mode) "%d %s"
+qxl_ring_cursor_get(int qid, const char *mode) "%d %s"
+qxl_ring_cursor_req_notification(int qid) "%d"
+qxl_ring_res_push(int qid, const char *mode, uint32_t surface_count, uint32_t free_res, void *last_release, const char *notify) "%d %s s#=%d res#=%d last=%p notify=%s"
+qxl_ring_res_push_rest(int qid, uint32_t ring_has, uint32_t ring_size, uint32_t prod, uint32_t cons) "%d ring %d/%d [%d,%d]"
+qxl_ring_res_put(int qid, uint32_t free_res) "%d #res=%d"
+qxl_set_mode(int qid, int modenr, uint32_t x_res, uint32_t y_res, uint32_t bits, uint64_t devmem) "%d mode=%d [ x=%d y=%d @ bpp=%d devmem=0x%" PRIx64 " ]"
+qxl_soft_reset(int qid) "%d"
+qxl_spice_destroy_surfaces_complete(int qid) "%d"
+qxl_spice_destroy_surfaces(int qid, int async) "%d async=%d"
+qxl_spice_destroy_surface_wait_complete(int qid, uint32_t id) "%d sid=%d"
+qxl_spice_destroy_surface_wait(int qid, uint32_t id, int async) "%d sid=%d async=%d"
+qxl_spice_flush_surfaces_async(int qid, uint32_t surface_count, uint32_t num_free_res) "%d s#=%d, res#=%d"
+qxl_spice_monitors_config(int qid) "%d"
+qxl_spice_loadvm_commands(int qid, void *ext, uint32_t count) "%d ext=%p count=%d"
+qxl_spice_oom(int qid) "%d"
+qxl_spice_reset_cursor(int qid) "%d"
+qxl_spice_reset_image_cache(int qid) "%d"
+qxl_spice_reset_memslots(int qid) "%d"
+qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) "%d sid=%d [%d,%d,%d,%d]"
+qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t clear_dirty_region) "%d #d=%d clear=%d"
+qxl_surfaces_dirty(int qid, uint64_t offset, uint64_t size) "%d offset=0x%"PRIx64" size=0x%"PRIx64
+qxl_send_events(int qid, uint32_t events) "%d %d"
+qxl_send_events_vm_stopped(int qid, uint32_t events) "%d %d"
+qxl_set_guest_bug(int qid) "%d"
+qxl_interrupt_client_monitors_config(int qid, int num_heads, void *heads) "%d %d %p"
+qxl_client_monitors_config_unsupported_by_guest(int qid, uint32_t int_mask, void *client_monitors_config) "%d 0x%X %p"
+qxl_client_monitors_config_unsupported_by_device(int qid, int revision) "%d revision=%d"
+qxl_client_monitors_config_capped(int qid, int requested, int limit) "%d %d %d"
+qxl_client_monitors_config_crc(int qid, unsigned size, uint32_t crc32) "%d %u %u"
+qxl_set_client_capabilities_unsupported_by_revision(int qid, int revision) "%d revision=%d"
+
+# qxl-render.c
+qxl_render_blit(int32_t stride, int32_t left, int32_t right, int32_t top, int32_t bottom) "stride=%d [%d, %d, %d, %d]"
+qxl_render_guest_primary_resized(int32_t width, int32_t height, int32_t stride, int32_t bytes_pp, int32_t bits_pp) "%dx%d, stride %d, bpp %d, depth %d"
+qxl_render_update_area_done(void *cookie) "%p"
-- 
2.31.1



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

* [PATCH v4 11/13] virtio-gpu: split trace points
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (9 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 10/13] meson: move qxl trace events to separate file Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-09 12:49   ` Stefan Hajnoczi
  2021-06-01 13:24 ` [PATCH v4 12/13] meson: move virtio trace events to separate file Gerd Hoffmann
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Create separate trace points for the simple and virgl
variants of the virtio-gpu device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu-virgl.c | 48 +++++++++++++++++------------------
 hw/display/trace-events       | 30 ++++++++++++++--------
 2 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 092c6dc380d9..ae48b98382ad 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -28,8 +28,8 @@ static void virgl_cmd_create_resource_2d(VirtIOGPU *g,
     struct virgl_renderer_resource_create_args args;
 
     VIRTIO_GPU_FILL_CMD(c2d);
-    trace_virtio_gpu_cmd_res_create_2d(c2d.resource_id, c2d.format,
-                                       c2d.width, c2d.height);
+    trace_virtio_gpu_gl_cmd_res_create_2d(c2d.resource_id, c2d.format,
+                                          c2d.width, c2d.height);
 
     args.handle = c2d.resource_id;
     args.target = 2;
@@ -52,8 +52,8 @@ static void virgl_cmd_create_resource_3d(VirtIOGPU *g,
     struct virgl_renderer_resource_create_args args;
 
     VIRTIO_GPU_FILL_CMD(c3d);
-    trace_virtio_gpu_cmd_res_create_3d(c3d.resource_id, c3d.format,
-                                       c3d.width, c3d.height, c3d.depth);
+    trace_virtio_gpu_gl_cmd_res_create_3d(c3d.resource_id, c3d.format,
+                                          c3d.width, c3d.height, c3d.depth);
 
     args.handle = c3d.resource_id;
     args.target = c3d.target;
@@ -77,7 +77,7 @@ static void virgl_cmd_resource_unref(VirtIOGPU *g,
     int num_iovs = 0;
 
     VIRTIO_GPU_FILL_CMD(unref);
-    trace_virtio_gpu_cmd_res_unref(unref.resource_id);
+    trace_virtio_gpu_gl_cmd_res_unref(unref.resource_id);
 
     virgl_renderer_resource_detach_iov(unref.resource_id,
                                        &res_iovs,
@@ -94,8 +94,8 @@ static void virgl_cmd_context_create(VirtIOGPU *g,
     struct virtio_gpu_ctx_create cc;
 
     VIRTIO_GPU_FILL_CMD(cc);
-    trace_virtio_gpu_cmd_ctx_create(cc.hdr.ctx_id,
-                                    cc.debug_name);
+    trace_virtio_gpu_gl_cmd_ctx_create(cc.hdr.ctx_id,
+                                       cc.debug_name);
 
     virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen,
                                   cc.debug_name);
@@ -107,7 +107,7 @@ static void virgl_cmd_context_destroy(VirtIOGPU *g,
     struct virtio_gpu_ctx_destroy cd;
 
     VIRTIO_GPU_FILL_CMD(cd);
-    trace_virtio_gpu_cmd_ctx_destroy(cd.hdr.ctx_id);
+    trace_virtio_gpu_gl_cmd_ctx_destroy(cd.hdr.ctx_id);
 
     virgl_renderer_context_destroy(cd.hdr.ctx_id);
 }
@@ -129,8 +129,8 @@ static void virgl_cmd_resource_flush(VirtIOGPU *g,
     int i;
 
     VIRTIO_GPU_FILL_CMD(rf);
-    trace_virtio_gpu_cmd_res_flush(rf.resource_id,
-                                   rf.r.width, rf.r.height, rf.r.x, rf.r.y);
+    trace_virtio_gpu_gl_cmd_res_flush(rf.resource_id,
+                                      rf.r.width, rf.r.height, rf.r.x, rf.r.y);
 
     for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
         if (g->parent_obj.scanout[i].resource_id != rf.resource_id) {
@@ -148,8 +148,8 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
     int ret;
 
     VIRTIO_GPU_FILL_CMD(ss);
-    trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,
-                                     ss.r.width, ss.r.height, ss.r.x, ss.r.y);
+    trace_virtio_gpu_gl_cmd_set_scanout(ss.scanout_id, ss.resource_id,
+                                        ss.r.width, ss.r.height, ss.r.x, ss.r.y);
 
     if (ss.scanout_id >= g->parent_obj.conf.max_outputs) {
         qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal scanout id specified %d",
@@ -194,7 +194,7 @@ static void virgl_cmd_submit_3d(VirtIOGPU *g,
     size_t s;
 
     VIRTIO_GPU_FILL_CMD(cs);
-    trace_virtio_gpu_cmd_ctx_submit(cs.hdr.ctx_id, cs.size);
+    trace_virtio_gpu_gl_cmd_ctx_submit(cs.hdr.ctx_id, cs.size);
 
     buf = g_malloc(cs.size);
     s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num,
@@ -224,7 +224,7 @@ static void virgl_cmd_transfer_to_host_2d(VirtIOGPU *g,
     struct virtio_gpu_box box;
 
     VIRTIO_GPU_FILL_CMD(t2d);
-    trace_virtio_gpu_cmd_res_xfer_toh_2d(t2d.resource_id);
+    trace_virtio_gpu_gl_cmd_res_xfer_toh_2d(t2d.resource_id);
 
     box.x = t2d.r.x;
     box.y = t2d.r.y;
@@ -248,7 +248,7 @@ static void virgl_cmd_transfer_to_host_3d(VirtIOGPU *g,
     struct virtio_gpu_transfer_host_3d t3d;
 
     VIRTIO_GPU_FILL_CMD(t3d);
-    trace_virtio_gpu_cmd_res_xfer_toh_3d(t3d.resource_id);
+    trace_virtio_gpu_gl_cmd_res_xfer_toh_3d(t3d.resource_id);
 
     virgl_renderer_transfer_write_iov(t3d.resource_id,
                                       t3d.hdr.ctx_id,
@@ -266,7 +266,7 @@ virgl_cmd_transfer_from_host_3d(VirtIOGPU *g,
     struct virtio_gpu_transfer_host_3d tf3d;
 
     VIRTIO_GPU_FILL_CMD(tf3d);
-    trace_virtio_gpu_cmd_res_xfer_fromh_3d(tf3d.resource_id);
+    trace_virtio_gpu_gl_cmd_res_xfer_fromh_3d(tf3d.resource_id);
 
     virgl_renderer_transfer_read_iov(tf3d.resource_id,
                                      tf3d.hdr.ctx_id,
@@ -287,7 +287,7 @@ static void virgl_resource_attach_backing(VirtIOGPU *g,
     int ret;
 
     VIRTIO_GPU_FILL_CMD(att_rb);
-    trace_virtio_gpu_cmd_res_back_attach(att_rb.resource_id);
+    trace_virtio_gpu_gl_cmd_res_back_attach(att_rb.resource_id);
 
     ret = virtio_gpu_create_mapping_iov(g, att_rb.nr_entries, sizeof(att_rb),
                                         cmd, NULL, &res_iovs, &res_niov);
@@ -311,7 +311,7 @@ static void virgl_resource_detach_backing(VirtIOGPU *g,
     int num_iovs = 0;
 
     VIRTIO_GPU_FILL_CMD(detach_rb);
-    trace_virtio_gpu_cmd_res_back_detach(detach_rb.resource_id);
+    trace_virtio_gpu_gl_cmd_res_back_detach(detach_rb.resource_id);
 
     virgl_renderer_resource_detach_iov(detach_rb.resource_id,
                                        &res_iovs,
@@ -329,8 +329,8 @@ static void virgl_cmd_ctx_attach_resource(VirtIOGPU *g,
     struct virtio_gpu_ctx_resource att_res;
 
     VIRTIO_GPU_FILL_CMD(att_res);
-    trace_virtio_gpu_cmd_ctx_res_attach(att_res.hdr.ctx_id,
-                                        att_res.resource_id);
+    trace_virtio_gpu_gl_cmd_ctx_res_attach(att_res.hdr.ctx_id,
+                                           att_res.resource_id);
 
     virgl_renderer_ctx_attach_resource(att_res.hdr.ctx_id, att_res.resource_id);
 }
@@ -341,8 +341,8 @@ static void virgl_cmd_ctx_detach_resource(VirtIOGPU *g,
     struct virtio_gpu_ctx_resource det_res;
 
     VIRTIO_GPU_FILL_CMD(det_res);
-    trace_virtio_gpu_cmd_ctx_res_detach(det_res.hdr.ctx_id,
-                                        det_res.resource_id);
+    trace_virtio_gpu_gl_cmd_ctx_res_detach(det_res.hdr.ctx_id,
+                                           det_res.resource_id);
 
     virgl_renderer_ctx_detach_resource(det_res.hdr.ctx_id, det_res.resource_id);
 }
@@ -483,7 +483,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
         return;
     }
 
-    trace_virtio_gpu_fence_ctrl(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type);
+    trace_virtio_gpu_gl_fence_ctrl(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type);
     virgl_renderer_create_fence(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type);
 }
 
@@ -500,7 +500,7 @@ static void virgl_write_fence(void *opaque, uint32_t fence)
         if (cmd->cmd_hdr.fence_id > fence) {
             continue;
         }
-        trace_virtio_gpu_fence_resp(cmd->cmd_hdr.fence_id);
+        trace_virtio_gpu_gl_fence_resp(cmd->cmd_hdr.fence_id);
         virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NODATA);
         QTAILQ_REMOVE(&g->fenceq, cmd, next);
         g_free(cmd);
diff --git a/hw/display/trace-events b/hw/display/trace-events
index d9606677a436..9c1c972c29c6 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -25,30 +25,38 @@ vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp"
 # virtio-gpu-base.c
 virtio_gpu_features(bool virgl) "virgl %d"
 
-# virtio-gpu-3d.c
 # virtio-gpu.c
 virtio_gpu_cmd_get_display_info(void) ""
 virtio_gpu_cmd_get_edid(uint32_t scanout) "scanout %d"
 virtio_gpu_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
 virtio_gpu_cmd_set_scanout_blob(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
 virtio_gpu_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
-virtio_gpu_cmd_res_create_3d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h, uint32_t d) "res 0x%x, fmt 0x%x, w %d, h %d, d %d"
 virtio_gpu_cmd_res_create_blob(uint32_t res, uint64_t size) "res 0x%x, size %" PRId64
 virtio_gpu_cmd_res_unref(uint32_t res) "res 0x%x"
 virtio_gpu_cmd_res_back_attach(uint32_t res) "res 0x%x"
 virtio_gpu_cmd_res_back_detach(uint32_t res) "res 0x%x"
 virtio_gpu_cmd_res_xfer_toh_2d(uint32_t res) "res 0x%x"
-virtio_gpu_cmd_res_xfer_toh_3d(uint32_t res) "res 0x%x"
-virtio_gpu_cmd_res_xfer_fromh_3d(uint32_t res) "res 0x%x"
 virtio_gpu_cmd_res_flush(uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "res 0x%x, w %d, h %d, x %d, y %d"
-virtio_gpu_cmd_ctx_create(uint32_t ctx, const char *name) "ctx 0x%x, name %s"
-virtio_gpu_cmd_ctx_destroy(uint32_t ctx) "ctx 0x%x"
-virtio_gpu_cmd_ctx_res_attach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
-virtio_gpu_cmd_ctx_res_detach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
-virtio_gpu_cmd_ctx_submit(uint32_t ctx, uint32_t size) "ctx 0x%x, size %d"
 virtio_gpu_update_cursor(uint32_t scanout, uint32_t x, uint32_t y, const char *type, uint32_t res) "scanout %d, x %d, y %d, %s, res 0x%x"
-virtio_gpu_fence_ctrl(uint64_t fence, uint32_t type) "fence 0x%" PRIx64 ", type 0x%x"
-virtio_gpu_fence_resp(uint64_t fence) "fence 0x%" PRIx64
+
+# virtio-gpu-virgl.c
+virtio_gpu_gl_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_gl_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
+virtio_gpu_gl_cmd_res_create_3d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h, uint32_t d) "res 0x%x, fmt 0x%x, w %d, h %d, d %d"
+virtio_gpu_gl_cmd_res_unref(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_back_attach(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_back_detach(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_xfer_toh_2d(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_xfer_toh_3d(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_xfer_fromh_3d(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_flush(uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_gl_cmd_ctx_create(uint32_t ctx, const char *name) "ctx 0x%x, name %s"
+virtio_gpu_gl_cmd_ctx_destroy(uint32_t ctx) "ctx 0x%x"
+virtio_gpu_gl_cmd_ctx_res_attach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
+virtio_gpu_gl_cmd_ctx_res_detach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
+virtio_gpu_gl_cmd_ctx_submit(uint32_t ctx, uint32_t size) "ctx 0x%x, size %d"
+virtio_gpu_gl_fence_ctrl(uint64_t fence, uint32_t type) "fence 0x%" PRIx64 ", type 0x%x"
+virtio_gpu_gl_fence_resp(uint64_t fence) "fence 0x%" PRIx64
 
 # vga.c
 vga_std_read_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x"
-- 
2.31.1



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

* [PATCH v4 12/13] meson: move virtio trace events to separate file
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (10 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 11/13] virtio-gpu: split trace points Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-09 15:11   ` Stefan Hajnoczi
  2021-06-01 13:24 ` [PATCH v4 13/13] meson: move virtio-gl " Gerd Hoffmann
  2021-06-09 15:14 ` [PATCH v4 00/13] [RfC] fix tracing for modules Stefan Hajnoczi
  13 siblings, 1 reply; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Move virtio-gpu trace events to separate trace-events-virtio file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/trace-virtio.h      |  1 +
 hw/display/virtio-gpu-base.c   |  2 +-
 hw/display/virtio-gpu.c        |  2 +-
 hw/display/meson.build         |  4 ++++
 hw/display/trace-events        | 17 -----------------
 hw/display/trace-events-virtio | 16 ++++++++++++++++
 6 files changed, 23 insertions(+), 19 deletions(-)
 create mode 100644 hw/display/trace-virtio.h
 create mode 100644 hw/display/trace-events-virtio

diff --git a/hw/display/trace-virtio.h b/hw/display/trace-virtio.h
new file mode 100644
index 000000000000..eb0d7dd8fc9f
--- /dev/null
+++ b/hw/display/trace-virtio.h
@@ -0,0 +1 @@
+#include "trace/trace-hw_display_virtio_gpu.h"
diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index dd294276cb38..4c654d5af594 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -17,7 +17,7 @@
 #include "migration/blocker.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "trace-virtio.h"
 
 void
 virtio_gpu_base_reset(VirtIOGPUBase *g)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4d549377cbc1..a7932126e3c7 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -15,7 +15,7 @@
 #include "qemu/units.h"
 #include "qemu/iov.h"
 #include "ui/console.h"
-#include "trace.h"
+#include "trace-virtio.h"
 #include "sysemu/dma.h"
 #include "sysemu/sysemu.h"
 #include "hw/virtio/virtio.h"
diff --git a/hw/display/meson.build b/hw/display/meson.build
index ac98861986d1..645a12a7af99 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -62,6 +62,10 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
                     if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman])
   virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'))
   virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c'))
+  trace_events_config += {
+    'file'   : meson.source_root() / 'hw' / 'display' / 'trace-events-virtio',
+    'module' : 'hw-display-virtio-gpu',
+  }
   hw_display_modules += {'virtio-gpu': virtio_gpu_ss}
 
   virtio_gpu_gl_ss = ss.source_set()
diff --git a/hw/display/trace-events b/hw/display/trace-events
index 9c1c972c29c6..27654aee8799 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -22,23 +22,6 @@ vmware_scratch_read(uint32_t index, uint32_t value) "index %d, value 0x%x"
 vmware_scratch_write(uint32_t index, uint32_t value) "index %d, value 0x%x"
 vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp"
 
-# virtio-gpu-base.c
-virtio_gpu_features(bool virgl) "virgl %d"
-
-# virtio-gpu.c
-virtio_gpu_cmd_get_display_info(void) ""
-virtio_gpu_cmd_get_edid(uint32_t scanout) "scanout %d"
-virtio_gpu_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
-virtio_gpu_cmd_set_scanout_blob(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
-virtio_gpu_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
-virtio_gpu_cmd_res_create_blob(uint32_t res, uint64_t size) "res 0x%x, size %" PRId64
-virtio_gpu_cmd_res_unref(uint32_t res) "res 0x%x"
-virtio_gpu_cmd_res_back_attach(uint32_t res) "res 0x%x"
-virtio_gpu_cmd_res_back_detach(uint32_t res) "res 0x%x"
-virtio_gpu_cmd_res_xfer_toh_2d(uint32_t res) "res 0x%x"
-virtio_gpu_cmd_res_flush(uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "res 0x%x, w %d, h %d, x %d, y %d"
-virtio_gpu_update_cursor(uint32_t scanout, uint32_t x, uint32_t y, const char *type, uint32_t res) "scanout %d, x %d, y %d, %s, res 0x%x"
-
 # virtio-gpu-virgl.c
 virtio_gpu_gl_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
 virtio_gpu_gl_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
diff --git a/hw/display/trace-events-virtio b/hw/display/trace-events-virtio
new file mode 100644
index 000000000000..52d5c5152f79
--- /dev/null
+++ b/hw/display/trace-events-virtio
@@ -0,0 +1,16 @@
+# virtio-gpu-base.c
+virtio_gpu_features(bool virgl) "virgl %d"
+
+# virtio-gpu.c
+virtio_gpu_cmd_get_display_info(void) ""
+virtio_gpu_cmd_get_edid(uint32_t scanout) "scanout %d"
+virtio_gpu_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_cmd_set_scanout_blob(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
+virtio_gpu_cmd_res_create_blob(uint32_t res, uint64_t size) "res 0x%x, size %" PRId64
+virtio_gpu_cmd_res_unref(uint32_t res) "res 0x%x"
+virtio_gpu_cmd_res_back_attach(uint32_t res) "res 0x%x"
+virtio_gpu_cmd_res_back_detach(uint32_t res) "res 0x%x"
+virtio_gpu_cmd_res_xfer_toh_2d(uint32_t res) "res 0x%x"
+virtio_gpu_cmd_res_flush(uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_update_cursor(uint32_t scanout, uint32_t x, uint32_t y, const char *type, uint32_t res) "scanout %d, x %d, y %d, %s, res 0x%x"
-- 
2.31.1



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

* [PATCH v4 13/13] meson: move virtio-gl trace events to separate file
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (11 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 12/13] meson: move virtio trace events to separate file Gerd Hoffmann
@ 2021-06-01 13:24 ` Gerd Hoffmann
  2021-06-09 15:12   ` Stefan Hajnoczi
  2021-06-09 15:14 ` [PATCH v4 00/13] [RfC] fix tracing for modules Stefan Hajnoczi
  13 siblings, 1 reply; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-01 13:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Stefan Hajnoczi, Gerd Hoffmann

Move virtio-gpu-gl trace events to separate trace-events-virtio-gl file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/trace-virtio-gl.h      |  1 +
 hw/display/virtio-gpu-virgl.c     |  2 +-
 hw/display/meson.build            |  4 ++++
 hw/display/trace-events           | 19 -------------------
 hw/display/trace-events-virtio-gl | 18 ++++++++++++++++++
 5 files changed, 24 insertions(+), 20 deletions(-)
 create mode 100644 hw/display/trace-virtio-gl.h
 create mode 100644 hw/display/trace-events-virtio-gl

diff --git a/hw/display/trace-virtio-gl.h b/hw/display/trace-virtio-gl.h
new file mode 100644
index 000000000000..7fbccbf8bd77
--- /dev/null
+++ b/hw/display/trace-virtio-gl.h
@@ -0,0 +1 @@
+#include "trace/trace-hw_display_virtio_gpu_gl.h"
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index ae48b98382ad..16f15ead4c76 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/iov.h"
-#include "trace.h"
+#include "trace-virtio-gl.h"
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-gpu.h"
 
diff --git a/hw/display/meson.build b/hw/display/meson.build
index 645a12a7af99..373a0dce7cca 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -71,6 +71,10 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
   virtio_gpu_gl_ss = ss.source_set()
   virtio_gpu_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRGL', opengl],
                        if_true: [files('virtio-gpu-gl.c', 'virtio-gpu-virgl.c'), pixman, virgl])
+  trace_events_config += {
+    'file'   : meson.source_root() / 'hw' / 'display' / 'trace-events-virtio-gl',
+    'module' : 'hw-display-virtio-gpu-gl',
+  }
   hw_display_modules += {'virtio-gpu-gl': virtio_gpu_gl_ss}
 endif
 
diff --git a/hw/display/trace-events b/hw/display/trace-events
index 27654aee8799..2127af5a14ef 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -22,25 +22,6 @@ vmware_scratch_read(uint32_t index, uint32_t value) "index %d, value 0x%x"
 vmware_scratch_write(uint32_t index, uint32_t value) "index %d, value 0x%x"
 vmware_setmode(uint32_t w, uint32_t h, uint32_t bpp) "%dx%d @ %d bpp"
 
-# virtio-gpu-virgl.c
-virtio_gpu_gl_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
-virtio_gpu_gl_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
-virtio_gpu_gl_cmd_res_create_3d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h, uint32_t d) "res 0x%x, fmt 0x%x, w %d, h %d, d %d"
-virtio_gpu_gl_cmd_res_unref(uint32_t res) "res 0x%x"
-virtio_gpu_gl_cmd_res_back_attach(uint32_t res) "res 0x%x"
-virtio_gpu_gl_cmd_res_back_detach(uint32_t res) "res 0x%x"
-virtio_gpu_gl_cmd_res_xfer_toh_2d(uint32_t res) "res 0x%x"
-virtio_gpu_gl_cmd_res_xfer_toh_3d(uint32_t res) "res 0x%x"
-virtio_gpu_gl_cmd_res_xfer_fromh_3d(uint32_t res) "res 0x%x"
-virtio_gpu_gl_cmd_res_flush(uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "res 0x%x, w %d, h %d, x %d, y %d"
-virtio_gpu_gl_cmd_ctx_create(uint32_t ctx, const char *name) "ctx 0x%x, name %s"
-virtio_gpu_gl_cmd_ctx_destroy(uint32_t ctx) "ctx 0x%x"
-virtio_gpu_gl_cmd_ctx_res_attach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
-virtio_gpu_gl_cmd_ctx_res_detach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
-virtio_gpu_gl_cmd_ctx_submit(uint32_t ctx, uint32_t size) "ctx 0x%x, size %d"
-virtio_gpu_gl_fence_ctrl(uint64_t fence, uint32_t type) "fence 0x%" PRIx64 ", type 0x%x"
-virtio_gpu_gl_fence_resp(uint64_t fence) "fence 0x%" PRIx64
-
 # vga.c
 vga_std_read_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x"
 vga_std_write_io(uint32_t addr, uint32_t val) "addr 0x%x, val 0x%x"
diff --git a/hw/display/trace-events-virtio-gl b/hw/display/trace-events-virtio-gl
new file mode 100644
index 000000000000..1ccb0388917f
--- /dev/null
+++ b/hw/display/trace-events-virtio-gl
@@ -0,0 +1,18 @@
+# virtio-gpu-virgl.c
+virtio_gpu_gl_cmd_set_scanout(uint32_t id, uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "id %d, res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_gl_cmd_res_create_2d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h) "res 0x%x, fmt 0x%x, w %d, h %d"
+virtio_gpu_gl_cmd_res_create_3d(uint32_t res, uint32_t fmt, uint32_t w, uint32_t h, uint32_t d) "res 0x%x, fmt 0x%x, w %d, h %d, d %d"
+virtio_gpu_gl_cmd_res_unref(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_back_attach(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_back_detach(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_xfer_toh_2d(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_xfer_toh_3d(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_xfer_fromh_3d(uint32_t res) "res 0x%x"
+virtio_gpu_gl_cmd_res_flush(uint32_t res, uint32_t w, uint32_t h, uint32_t x, uint32_t y) "res 0x%x, w %d, h %d, x %d, y %d"
+virtio_gpu_gl_cmd_ctx_create(uint32_t ctx, const char *name) "ctx 0x%x, name %s"
+virtio_gpu_gl_cmd_ctx_destroy(uint32_t ctx) "ctx 0x%x"
+virtio_gpu_gl_cmd_ctx_res_attach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
+virtio_gpu_gl_cmd_ctx_res_detach(uint32_t ctx, uint32_t res) "ctx 0x%x, res 0x%x"
+virtio_gpu_gl_cmd_ctx_submit(uint32_t ctx, uint32_t size) "ctx 0x%x, size %d"
+virtio_gpu_gl_fence_ctrl(uint64_t fence, uint32_t type) "fence 0x%" PRIx64 ", type 0x%x"
+virtio_gpu_gl_fence_resp(uint64_t fence) "fence 0x%" PRIx64
-- 
2.31.1



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

* Re: [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful.
  2021-06-01 13:24 ` [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful Gerd Hoffmann
@ 2021-06-09 12:39   ` Stefan Hajnoczi
  2021-06-09 15:21   ` Daniel P. Berrangé
  1 sibling, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 12:39 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 846 bytes --]

On Tue, Jun 01, 2021 at 03:24:02PM +0200, Gerd Hoffmann wrote:
> Setting SYSTEMTAP_TAPSET to some value other than
> /usr/share/systemtap/tapsets results in systemtap not finding the
> standard tapset library any more, which in turn breaks tracing because
> pid() and other standard systemtap functions are not available any more.
> 
> So using SYSTEMTAP_TAPSET to point systemtap to the qemu probes will
> only work for the prefix=/usr installs because both qemu and system
> tapsets in the same directory then.  All other prefixes are broken.
> 
> Fix that by using the "-I $tapsetdir" command line switch instead.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  scripts/qemu-trace-stap | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 07/13] meson: move up hw subdir (specifically before trace subdir)
  2021-06-01 13:24 ` [PATCH v4 07/13] meson: move up hw subdir (specifically before trace subdir) Gerd Hoffmann
@ 2021-06-09 12:42   ` Stefan Hajnoczi
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 12:42 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

On Tue, Jun 01, 2021 at 03:24:08PM +0200, Gerd Hoffmann wrote:
> Needed so trace/meson.build can see trace_events_config[]
> changes done in hw/*/meson.build.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  meson.build | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 09/13] trace/stap: build stap files for modules
  2021-06-01 13:24 ` [PATCH v4 09/13] trace/stap: build stap files for modules Gerd Hoffmann
@ 2021-06-09 12:48   ` Stefan Hajnoczi
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 12:48 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

On Tue, Jun 01, 2021 at 03:24:10PM +0200, Gerd Hoffmann wrote:
> @@ -2027,6 +2028,37 @@ foreach d, list : modules
>        else
>          softmmu_mods += sl
>        endif
> +      if 'CONFIG_TRACE_SYSTEMTAP' in config_host and module_trace_evt != ''
> +        modname = d + '-' + m
> +	modlib = modname + '.so'

Indentation looks odd. Otherwise:

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 11/13] virtio-gpu: split trace points
  2021-06-01 13:24 ` [PATCH v4 11/13] virtio-gpu: split trace points Gerd Hoffmann
@ 2021-06-09 12:49   ` Stefan Hajnoczi
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 12:49 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

On Tue, Jun 01, 2021 at 03:24:12PM +0200, Gerd Hoffmann wrote:
> Create separate trace points for the simple and virgl
> variants of the virtio-gpu device.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/display/virtio-gpu-virgl.c | 48 +++++++++++++++++------------------
>  hw/display/trace-events       | 30 ++++++++++++++--------
>  2 files changed, 43 insertions(+), 35 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 12/13] meson: move virtio trace events to separate file
  2021-06-01 13:24 ` [PATCH v4 12/13] meson: move virtio trace events to separate file Gerd Hoffmann
@ 2021-06-09 15:11   ` Stefan Hajnoczi
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 15:11 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

On Tue, Jun 01, 2021 at 03:24:13PM +0200, Gerd Hoffmann wrote:
> Move virtio-gpu trace events to separate trace-events-virtio file.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/display/trace-virtio.h      |  1 +
>  hw/display/virtio-gpu-base.c   |  2 +-
>  hw/display/virtio-gpu.c        |  2 +-
>  hw/display/meson.build         |  4 ++++
>  hw/display/trace-events        | 17 -----------------
>  hw/display/trace-events-virtio | 16 ++++++++++++++++
>  6 files changed, 23 insertions(+), 19 deletions(-)
>  create mode 100644 hw/display/trace-virtio.h
>  create mode 100644 hw/display/trace-events-virtio

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 13/13] meson: move virtio-gl trace events to separate file
  2021-06-01 13:24 ` [PATCH v4 13/13] meson: move virtio-gl " Gerd Hoffmann
@ 2021-06-09 15:12   ` Stefan Hajnoczi
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 15:12 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

On Tue, Jun 01, 2021 at 03:24:14PM +0200, Gerd Hoffmann wrote:
> Move virtio-gpu-gl trace events to separate trace-events-virtio-gl file.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/display/trace-virtio-gl.h      |  1 +
>  hw/display/virtio-gpu-virgl.c     |  2 +-
>  hw/display/meson.build            |  4 ++++
>  hw/display/trace-events           | 19 -------------------
>  hw/display/trace-events-virtio-gl | 18 ++++++++++++++++++
>  5 files changed, 24 insertions(+), 20 deletions(-)
>  create mode 100644 hw/display/trace-virtio-gl.h
>  create mode 100644 hw/display/trace-events-virtio-gl

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 00/13] [RfC] fix tracing for modules
  2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
                   ` (12 preceding siblings ...)
  2021-06-01 13:24 ` [PATCH v4 13/13] meson: move virtio-gl " Gerd Hoffmann
@ 2021-06-09 15:14 ` Stefan Hajnoczi
  2021-06-10  6:32   ` Gerd Hoffmann
  13 siblings, 1 reply; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-09 15:14 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

On Tue, Jun 01, 2021 at 03:24:01PM +0200, Gerd Hoffmann wrote:
> First version that actually works.  Only qxl covered for this RfC,
> other modules will follow once the basics are hashed out.
> 
> v4:
>  - rebase to latest master.
>  - fix systemtap tracing.
>  - also cover virtio-gpu modules.
>  - pick up some review tags.
>  - misc minor tweaks.
> 
> 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.

Excellent! I think we discussed these TODOs in the past. Can we merge
this series in close to its current form or does it degrade the tracing
experience (e.g. does the -trace command-line no longer work for
trace-events files that were split off into modules)?

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful.
  2021-06-01 13:24 ` [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful Gerd Hoffmann
  2021-06-09 12:39   ` Stefan Hajnoczi
@ 2021-06-09 15:21   ` Daniel P. Berrangé
  1 sibling, 0 replies; 24+ messages in thread
From: Daniel P. Berrangé @ 2021-06-09 15:21 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Michael S. Tsirkin, Stefan Hajnoczi, qemu-devel,
	Dr. David Alan Gilbert, Markus Armbruster

On Tue, Jun 01, 2021 at 03:24:02PM +0200, Gerd Hoffmann wrote:
> Setting SYSTEMTAP_TAPSET to some value other than
> /usr/share/systemtap/tapsets results in systemtap not finding the
> standard tapset library any more, which in turn breaks tracing because
> pid() and other standard systemtap functions are not available any more.
> 
> So using SYSTEMTAP_TAPSET to point systemtap to the qemu probes will
> only work for the prefix=/usr installs because both qemu and system
> tapsets in the same directory then.  All other prefixes are broken.
> 
> Fix that by using the "-I $tapsetdir" command line switch instead.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  scripts/qemu-trace-stap | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


I'm still a little confused how I ever missed this problem
when testing usage !


Regards,
Daniel
-- 
|: 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 :|



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

* Re: [PATCH v4 00/13] [RfC] fix tracing for modules
  2021-06-09 15:14 ` [PATCH v4 00/13] [RfC] fix tracing for modules Stefan Hajnoczi
@ 2021-06-10  6:32   ` Gerd Hoffmann
  2021-06-10  7:58     ` Stefan Hajnoczi
  0 siblings, 1 reply; 24+ messages in thread
From: Gerd Hoffmann @ 2021-06-10  6:32 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

On Wed, Jun 09, 2021 at 04:14:12PM +0100, Stefan Hajnoczi wrote:
> On Tue, Jun 01, 2021 at 03:24:01PM +0200, Gerd Hoffmann wrote:
> > First version that actually works.  Only qxl covered for this RfC,
> > other modules will follow once the basics are hashed out.
> > 
> > v4:
> >  - rebase to latest master.
> >  - fix systemtap tracing.
> >  - also cover virtio-gpu modules.
> >  - pick up some review tags.
> >  - misc minor tweaks.
> > 
> > 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.
> 
> Excellent! I think we discussed these TODOs in the past. Can we merge
> this series in close to its current form or does it degrade the tracing
> experience (e.g. does the -trace command-line no longer work for
> trace-events files that were split off into modules)?

Main focus for v4 was to make stap work.
The cmd line issue is still there.

Patches 1-5 can be cherry-picked without breaking something.

take care,
  Gerd



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

* Re: [PATCH v4 00/13] [RfC] fix tracing for modules
  2021-06-10  6:32   ` Gerd Hoffmann
@ 2021-06-10  7:58     ` Stefan Hajnoczi
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Hajnoczi @ 2021-06-10  7:58 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Markus Armbruster, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

On Thu, Jun 10, 2021 at 08:32:05AM +0200, Gerd Hoffmann wrote:
> On Wed, Jun 09, 2021 at 04:14:12PM +0100, Stefan Hajnoczi wrote:
> > On Tue, Jun 01, 2021 at 03:24:01PM +0200, Gerd Hoffmann wrote:
> > > First version that actually works.  Only qxl covered for this RfC,
> > > other modules will follow once the basics are hashed out.
> > > 
> > > v4:
> > >  - rebase to latest master.
> > >  - fix systemtap tracing.
> > >  - also cover virtio-gpu modules.
> > >  - pick up some review tags.
> > >  - misc minor tweaks.
> > > 
> > > 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.
> > 
> > Excellent! I think we discussed these TODOs in the past. Can we merge
> > this series in close to its current form or does it degrade the tracing
> > experience (e.g. does the -trace command-line no longer work for
> > trace-events files that were split off into modules)?
> 
> Main focus for v4 was to make stap work.
> The cmd line issue is still there.
> 
> Patches 1-5 can be cherry-picked without breaking something.

Thanks, I have applied Patches 1-5 to my tracing tree:
https://gitlab.com/stefanha/qemu/-/tree/tracing

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-06-10  8:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 13:24 [PATCH v4 00/13] [RfC] fix tracing for modules Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 01/13] qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful Gerd Hoffmann
2021-06-09 12:39   ` Stefan Hajnoczi
2021-06-09 15:21   ` Daniel P. Berrangé
2021-06-01 13:24 ` [PATCH v4 02/13] trace: iter init tweaks Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 03/13] trace: add trace_event_iter_init_group Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 04/13] trace/simple: pass iter to st_write_event_mapping Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 05/13] trace/simple: add st_init_group Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 06/13] meson: add trace_events_config[] Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 07/13] meson: move up hw subdir (specifically before trace subdir) Gerd Hoffmann
2021-06-09 12:42   ` Stefan Hajnoczi
2021-06-01 13:24 ` [PATCH v4 08/13] meson: add module_trace & module_trace_src Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 09/13] trace/stap: build stap files for modules Gerd Hoffmann
2021-06-09 12:48   ` Stefan Hajnoczi
2021-06-01 13:24 ` [PATCH v4 10/13] meson: move qxl trace events to separate file Gerd Hoffmann
2021-06-01 13:24 ` [PATCH v4 11/13] virtio-gpu: split trace points Gerd Hoffmann
2021-06-09 12:49   ` Stefan Hajnoczi
2021-06-01 13:24 ` [PATCH v4 12/13] meson: move virtio trace events to separate file Gerd Hoffmann
2021-06-09 15:11   ` Stefan Hajnoczi
2021-06-01 13:24 ` [PATCH v4 13/13] meson: move virtio-gl " Gerd Hoffmann
2021-06-09 15:12   ` Stefan Hajnoczi
2021-06-09 15:14 ` [PATCH v4 00/13] [RfC] fix tracing for modules Stefan Hajnoczi
2021-06-10  6:32   ` Gerd Hoffmann
2021-06-10  7:58     ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.