All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations
@ 2026-10-05 12:08 Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 01/24] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

This series started off with fixing some compile failures seen
with dtrace and ust backends, and got somewhat out of hand as
I looked more deeply at the trace code. So it ended up doing
various bits of code cleanup and memory usage optimizations.

The optimizations aren't huge against each individual binaries.
There are too many scenarios to show the full set, but here
are some binary size examples

The current git master baseline for different enabled
backends  on the x86_64 emulator:

  nop 88546360
  dtrace 90604496
  ftrace 93265944
  log 93799528
  syslog 93962704
  simple 97064528
  ust 162999944
  dtrace,ftrace,log,syslog,simple,ust 174438088

'ust' has insanely high overhead in terms of binary sizes,
inexplicably insane.

'ftrace/log/syslog' are all similar because their overhead
is dominated by the printf() format strings which are
identical in all.

'simple' is a bit worse because of the helper functions we
must generated for each probe

After this series is applied the results for x86_64 are

  nop 88510248
  dtrace 90576160
  ftrace 93156320
  log 93735064
  syslog 93853480
  simple 97050856
  ust 162957256
  dtrace,ftrace,log,syslog,simple,ust 174431128

IOW, for 'dtrace', we save 28k, for 'log' we save 62k

For the aarch64 binary, we see bigger saving in some
cases:

  baseline dtrace 127610144
  baseline log 131050320
     trace dtrace 127459264
     trace log  130998872

IOW, for 'dtrace' we save 150k, for 'log' we only save
50k. No clue why the saving is not so significant for
the 'log' backend but not a big deal.

Changed in v3:

 * Include QEMU log mask check in Rust generated code too
 * Eliminate duplicate state checks in DSTATE macro

Changed in v2:

 * Improve some commit messages
 * Updated tracing.rst docs

Daniel P. Berrangé (24):
  osdep: add 'ignore_value(x)' macro
  trace: use 'ignore_value()' instead of a dummy variable
  trace: fix handling of char** in UST backend
  hw/xen: replace "long unsigned int" with "unsigned long " for dtrace
  trace: block use of "long int" for dtrace
  trace: drop unused trace_event_set_state_dynamic_init()
  trace: remove obsolete references to vcpu property
  trace: drop 'id' from TraceEvent struct when not required
  trace: change "DSTATE" variables from uint16_t to uint8_t
  trace: add testing of 'nop' trace backend
  trace: don't emit TraceEvent structs when 'nop' backend is used
  trace: add test of generation with all backends enabled
  trace: remove redundant headers from simple trace backend code
  trace: include probe name in Rust format strings
  trace: add missing newline in ftrace Rust format string
  trace: eliminate dupe trace_event_get_state_dynamic_by_id() calls
  audio: remove mistaken use of trace_event_get_state()
  hw/ppc: remove mistaken use of trace_event_get_state()
  monitor: remove mistaken use of trace_event_get_state()
  trace: include qemu_loglevel_mask(LOG_TRACE) in guard
  trace: remove "disable" property from trace files
  trace: stop tracking static disabled state
  trace: remove parsing of "disable" event property
  trace: remove 'trace_event_get_state' wrapper

 audio/audio-mixeng-be.c                      |   2 +-
 docs/devel/tracing.rst                       |  24 +----
 hw/display/trace-events                      |   2 +-
 hw/ppc/vof.c                                 |  13 +--
 hw/xen/trace-events                          |   4 +-
 include/qemu/osdep.h                         |   8 ++
 monitor/qmp.c                                |   4 +-
 qapi/trace.json                              |   5 +-
 scripts/tracetool/__init__.py                |  32 ++----
 scripts/tracetool/backend/__init__.py        |   7 +-
 scripts/tracetool/backend/dtrace.py          |   2 -
 scripts/tracetool/backend/ftrace.py          |   8 +-
 scripts/tracetool/backend/log.py             |  22 ++--
 scripts/tracetool/backend/simple.py          |   9 +-
 scripts/tracetool/backend/syslog.py          |   6 +-
 scripts/tracetool/format/c.py                |  74 +++++++-------
 scripts/tracetool/format/d.py                |   3 -
 scripts/tracetool/format/h.py                |  48 ++++-----
 scripts/tracetool/format/log_stap.py         |   3 -
 scripts/tracetool/format/rs.py               |  30 +++---
 scripts/tracetool/format/simpletrace_stap.py |   3 -
 scripts/tracetool/format/stap.py             |   3 -
 scripts/tracetool/format/ust_events_c.py     |   3 -
 scripts/tracetool/format/ust_events_h.py     |   7 +-
 stubs/trace-control.c                        |   6 --
 target/hppa/trace-events                     |  28 +++---
 tests/tracetool/all.c                        |  61 +++++++++++
 tests/tracetool/all.d                        |  10 ++
 tests/tracetool/all.h                        | 100 +++++++++++++++++++
 tests/tracetool/all.log-stap                 |  15 +++
 tests/tracetool/all.rs                       |  98 ++++++++++++++++++
 tests/tracetool/all.simpletrace-stap         |  16 +++
 tests/tracetool/all.stap                     |  14 +++
 tests/tracetool/all.ust-events-c             |  14 +++
 tests/tracetool/all.ust-events-h             |  56 +++++++++++
 tests/tracetool/dtrace.c                     |  10 +-
 tests/tracetool/dtrace.h                     |   6 +-
 tests/tracetool/dtrace.rs                    |   6 +-
 tests/tracetool/ftrace.c                     |  10 +-
 tests/tracetool/ftrace.h                     |  14 ++-
 tests/tracetool/ftrace.rs                    |  10 +-
 tests/tracetool/log.c                        |  10 +-
 tests/tracetool/log.h                        |  26 +++--
 tests/tracetool/log.rs                       |  12 ++-
 tests/tracetool/meson.build                  |   4 +-
 tests/tracetool/nop.c                        |   7 ++
 tests/tracetool/nop.h                        |  25 +++++
 tests/tracetool/nop.rs                       |  51 ++++++++++
 tests/tracetool/simple.c                     |  12 +--
 tests/tracetool/simple.h                     |  10 +-
 tests/tracetool/simple.rs                    |   6 +-
 tests/tracetool/syslog.c                     |  10 +-
 tests/tracetool/syslog.h                     |  14 ++-
 tests/tracetool/syslog.rs                    |  10 +-
 tests/tracetool/tracetool-test.py            |  12 ++-
 tests/tracetool/ust.c                        |  10 +-
 tests/tracetool/ust.h                        |   6 +-
 trace/control-internal.h                     |   8 +-
 trace/control-target.c                       |  29 ------
 trace/control.c                              |  19 +---
 trace/control.h                              |  43 +-------
 trace/event-internal.h                       |  19 +---
 trace/ftrace.c                               |   3 +-
 trace/qmp.c                                  |  47 +++------
 trace/simple.c                               |   9 +-
 65 files changed, 749 insertions(+), 449 deletions(-)
 create mode 100644 tests/tracetool/all.c
 create mode 100644 tests/tracetool/all.d
 create mode 100644 tests/tracetool/all.h
 create mode 100644 tests/tracetool/all.log-stap
 create mode 100644 tests/tracetool/all.rs
 create mode 100644 tests/tracetool/all.simpletrace-stap
 create mode 100644 tests/tracetool/all.stap
 create mode 100644 tests/tracetool/all.ust-events-c
 create mode 100644 tests/tracetool/all.ust-events-h
 create mode 100644 tests/tracetool/nop.c
 create mode 100644 tests/tracetool/nop.h
 create mode 100644 tests/tracetool/nop.rs

-- 
2.55.0



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

* [PATCH v3 01/24] osdep: add 'ignore_value(x)' macro
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 02/24] trace: use 'ignore_value()' instead of a dummy variable Daniel P. Berrangé
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Functions annotated with 'warn_unused_result' cannot be cast
to (void) to silence the compiler. Add the ignore_value()
macro which tricks the compiler into thinking the result is
genuinely used, avoiding the need for manual workarounds where
the return value is intentionally ignored.

This clever macro is derived from one originating with the
GNULIB project:

  https://gitweb.git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/ignore-value.h;hb=HEAD

but simplified since we don't need compat with old GCC and
optimizing on clang is overkill.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 include/qemu/osdep.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 1ec5b42230b..c1ca2c127b6 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -251,6 +251,14 @@ extern "C" {
 #endif
 
 
+/*
+ * Merely casting to (void) is not sufficient for functions
+ * annotated with the "warn_unused_result" attribute
+ */
+#define ignore_value(x) \
+    (__extension__ ({ __typeof__(x) __x = (x); (void) __x; }))
+
+
 /*
  * For mingw, as of v6.0.0, the function implementing the assert macro is
  * not marked as noreturn, so the compiler cannot delete code following an
-- 
2.55.0



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

* [PATCH v3 02/24] trace: use 'ignore_value()' instead of a dummy variable
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 01/24] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 03/24] trace: fix handling of char** in UST backend Daniel P. Berrangé
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

This pattern is more concise than using a dummy variable which
in turn needs annotating as unused.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 trace/ftrace.c | 3 +--
 trace/simple.c | 9 ++++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/trace/ftrace.c b/trace/ftrace.c
index 6875faedb9c..c1ed6ad4454 100644
--- a/trace/ftrace.c
+++ b/trace/ftrace.c
@@ -41,7 +41,6 @@ static int find_mount(char *mount_point, const char *fstype)
 void ftrace_write(const char *fmt, ...)
 {
     char ftrace_buf[MAX_TRACE_STRLEN];
-    int unused __attribute__ ((unused));
     int trlen;
     va_list ap;
 
@@ -50,7 +49,7 @@ void ftrace_write(const char *fmt, ...)
     va_end(ap);
 
     trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);
-    unused = write(trace_marker_fd, ftrace_buf, trlen);
+    ignore_value(write(trace_marker_fd, ftrace_buf, trlen));
 }
 
 bool ftrace_init(void)
diff --git a/trace/simple.c b/trace/simple.c
index c0aba00cb7f..e148ca44530 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -163,7 +163,6 @@ static gpointer writeout_thread(gpointer opaque)
     } dropped;
     unsigned int idx = 0;
     int dropped_count;
-    size_t unused __attribute__ ((unused));
     uint64_t type = TRACE_RECORD_TYPE_EVENT;
 
     for (;;) {
@@ -179,13 +178,13 @@ static gpointer writeout_thread(gpointer opaque)
             } while (!g_atomic_int_compare_and_exchange(&dropped_events,
                                                         dropped_count, 0));
             dropped.rec.arguments[0] = dropped_count;
-            unused = fwrite(&type, sizeof(type), 1, trace_fp);
-            unused = fwrite(&dropped.rec, dropped.rec.length, 1, trace_fp);
+            ignore_value(fwrite(&type, sizeof(type), 1, trace_fp));
+            ignore_value(fwrite(&dropped.rec, dropped.rec.length, 1, trace_fp));
         }
 
         while (get_trace_record(idx, &recordptr)) {
-            unused = fwrite(&type, sizeof(type), 1, trace_fp);
-            unused = fwrite(recordptr, recordptr->length, 1, trace_fp);
+            ignore_value(fwrite(&type, sizeof(type), 1, trace_fp));
+            ignore_value(fwrite(recordptr, recordptr->length, 1, trace_fp));
             writeout_idx += recordptr->length;
             free(recordptr); /* don't use g_free, can deadlock when traced */
             idx = writeout_idx % TRACE_BUF_LEN;
-- 
2.55.0



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

* [PATCH v3 03/24] trace: fix handling of char** in UST backend
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 01/24] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 02/24] trace: use 'ignore_value()' instead of a dummy variable Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 04/24] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace Daniel P. Berrangé
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The UST trace backend fails to compile on version 2.14.0, as we
pass a "char **" arg as to ctf_string(), which only expects 'char *'.
It should instead be treated the same way as generic pointers, and
emitted as hex.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/format/ust_events_h.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index cee7970a403..76c883bc5c0 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -72,7 +72,9 @@ def generate(events, backend, group):
             names = e.args.names()
             fmts = e.formats()
             for t,n,f in zip(types, names, fmts):
-                if ('char *' in t) or ('char*' in t):
+                if ('char **' in t) or ('char**' in t):
+                    out('       ctf_integer_hex(' + t + ', ' + n + ', ' + n + ')')
+                elif ('char *' in t) or ('char*' in t):
                     out('       ctf_string(' + n + ', ' + n + ')')
                 elif ("%p" in f) or ("x" in f) or ("PRIx" in f):
                     out('       ctf_integer_hex('+ t + ', ' + n + ', ' + n + ')')
-- 
2.55.0



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

* [PATCH v3 04/24] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (2 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 03/24] trace: fix handling of char** in UST backend Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 05/24] trace: block use of "long int" " Daniel P. Berrangé
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

dtrace (or at least systemtap's fake "dtrace" binary) doesn't like to
see "int" and "long" together in the typename, it just wants the
bare "long".

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/xen/trace-events | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xen/trace-events b/hw/xen/trace-events
index b67942d07b4..a31983ce1d3 100644
--- a/hw/xen/trace-events
+++ b/hw/xen/trace-events
@@ -57,8 +57,8 @@ cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uin
 cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x"
 cpu_get_ioreq_from_shared_memory_req_not_ready(int state, int data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O request not ready: 0x%x, ptr: 0x%x, port: 0x%"PRIx64", data: 0x%"PRIx64", count: %u, size: %u"
 xen_main_loop_prepare_init_cpu(int id, void *cpu) "cpu_by_vcpu_id[%d]=%p"
-xen_map_ioreq_server_shared_page(long unsigned int ioreq_pfn) "shared page at pfn 0x%lx"
-xen_map_ioreq_server_buffered_io_page(long unsigned int ioreq_pfn) "buffered io page at pfn 0x%lx"
+xen_map_ioreq_server_shared_page(unsigned long ioreq_pfn) "shared page at pfn 0x%lx"
+xen_map_ioreq_server_buffered_io_page(unsigned long ioreq_pfn) "buffered io page at pfn 0x%lx"
 xen_map_ioreq_server_buffered_io_evtchn(int bufioreq_evtchn) "buffered io evtchn is 0x%x"
 destroy_hvm_domain_cannot_acquire_handle(void) "Cannot acquire xenctrl handle"
 destroy_hvm_domain_failed_action(const char *action, int sts, char *errno_s) "xc_domain_shutdown failed to issue %s, sts %d, %s"
-- 
2.55.0



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

* [PATCH v3 05/24] trace: block use of "long int" for dtrace
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (3 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 04/24] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 06/24] trace: drop unused trace_event_set_state_dynamic_init() Daniel P. Berrangé
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

dtrace (or at least systemtap's fake "dtrace" binary) complains about a
syntax error due to use of "long int", as it wants a bare "long" type
Enforce this when parsing the trace-events files.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/__init__.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 61ba6f1ba8c..6ed7cdd6ce4 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -177,6 +177,11 @@ def out(*lines, **kwargs):
 
 def validate_type(name):
     bits = name.split(" ")
+
+    if "long" in bits and "int" in bits:
+        raise ValueError("Invalid use of 'int' typename in %s, "
+                         "use 'long' alone" % name)
+
     for bit in bits:
         bit = re.sub(r"\*", "", bit)
         if bit == "":
-- 
2.55.0



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

* [PATCH v3 06/24] trace: drop unused trace_event_set_state_dynamic_init()
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (4 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 05/24] trace: block use of "long int" " Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 07/24] trace: remove obsolete references to vcpu property Daniel P. Berrangé
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The use of this method was mistakenly dropped in 0d4e995c73.
When the 'vcpu' property was dropped, however, this became
functionally identical to trace_event_set_state_dynamic().

Fixes: 0d4e995c7368f8bdc8845beb499b650386a38819
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 stubs/trace-control.c  |  5 -----
 trace/control-target.c | 21 ---------------------
 trace/event-internal.h |  2 --
 3 files changed, 28 deletions(-)

diff --git a/stubs/trace-control.c b/stubs/trace-control.c
index b428f34c878..3f196835db0 100644
--- a/stubs/trace-control.c
+++ b/stubs/trace-control.c
@@ -11,11 +11,6 @@
 #include "trace/control.h"
 
 
-void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state)
-{
-    trace_event_set_state_dynamic(ev, state);
-}
-
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
 {
     bool state_pre;
diff --git a/trace/control-target.c b/trace/control-target.c
index 57ceac21084..24d9b7abbde 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -10,27 +10,6 @@
 #include "qemu/osdep.h"
 #include "trace/control.h"
 
-
-void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state)
-{
-    bool state_pre;
-    assert(trace_event_get_state_static(ev));
-    /*
-     * We ignore the "vcpu" property here, since no vCPUs have been created
-     * yet. Then dstate can only be 1 or 0.
-     */
-    state_pre = *ev->dstate;
-    if (state_pre != state) {
-        if (state) {
-            trace_events_enabled_count++;
-            *ev->dstate = 1;
-        } else {
-            trace_events_enabled_count--;
-            *ev->dstate = 0;
-        }
-    }
-}
-
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
 {
     assert(trace_event_get_state_static(ev));
diff --git a/trace/event-internal.h b/trace/event-internal.h
index 0c24e01b521..1d57b0ff1b5 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -37,6 +37,4 @@ typedef struct TraceEvent {
     uint16_t *dstate;
 } TraceEvent;
 
-void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state);
-
 #endif /* TRACE__EVENT_INTERNAL_H */
-- 
2.55.0



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

* [PATCH v3 07/24] trace: remove obsolete references to vcpu property
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (5 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 06/24] trace: drop unused trace_event_set_state_dynamic_init() Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 08/24] trace: drop 'id' from TraceEvent struct when not required Daniel P. Berrangé
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The 'vcpu' property for trace events was removed 2 years ago
but some mentions of it remain in the code.

Fixes: 7ffc4894a6(trace: Remove deprecated 'vcpu' field from QMP trace events)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 trace/control-target.c |  6 ------
 trace/control.c        |  6 ------
 trace/control.h        | 12 ------------
 trace/event-internal.h | 11 -----------
 4 files changed, 35 deletions(-)

diff --git a/trace/control-target.c b/trace/control-target.c
index 24d9b7abbde..87b0f5037df 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -14,12 +14,6 @@ void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
 {
     assert(trace_event_get_state_static(ev));
 
-    /*
-     * There is no longer a "vcpu" property, dstate can only be 1 or
-     * 0. With it, we haven't instantiated any vCPU yet, so we will
-     * set a global state instead, and trace_init_vcpu will reconcile
-     * it afterwards.
-     */
     bool state_pre = *ev->dstate;
     if (state_pre != state) {
         if (state) {
diff --git a/trace/control.c b/trace/control.c
index 49f0a4c5cda..6971157cbe7 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -37,7 +37,6 @@ typedef struct TraceEventGroup {
 static TraceEventGroup *event_groups;
 static size_t nevent_groups;
 static uint32_t next_id;
-static uint32_t next_vcpu_id;
 #ifdef CONFIG_TRACE_SIMPLE
 static bool init_trace_on_startup;
 #endif
@@ -304,8 +303,3 @@ void trace_opt_parse(const char *optstr)
     trace_opts_file = g_strdup(qemu_opt_get(opts, "file"));
     qemu_opts_del(opts);
 }
-
-uint32_t trace_get_vcpu_event_count(void)
-{
-    return next_vcpu_id;
-}
diff --git a/trace/control.h b/trace/control.h
index 6754bfe052b..20033fb6669 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -139,8 +139,6 @@ static bool trace_event_get_state_static(TraceEvent *ev);
  * trace_event_get_state_dynamic:
  *
  * Get the dynamic tracing state of an event.
- *
- * If the event has the 'vcpu' property, gets the OR'ed state of all vCPUs.
  */
 static bool trace_event_get_state_dynamic(TraceEvent *ev);
 
@@ -149,8 +147,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev);
  *
  * Set the dynamic tracing state of an event.
  *
- * If the event has the 'vcpu' property, sets the state on all vCPUs.
- *
  * Pre-condition: trace_event_get_state_static(ev) == true
  */
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
@@ -203,14 +199,6 @@ extern QemuOptsList qemu_trace_opts;
  */
 void trace_opt_parse(const char *optstr);
 
-/**
- * trace_get_vcpu_event_count:
- *
- * Return the number of known vcpu-specific events
- */
-uint32_t trace_get_vcpu_event_count(void);
-
-
 #include "control-internal.h"
 
 #endif /* TRACE__CONTROL_H */
diff --git a/trace/event-internal.h b/trace/event-internal.h
index 1d57b0ff1b5..cc095a6ad54 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -10,12 +10,6 @@
 #ifndef TRACE__EVENT_INTERNAL_H
 #define TRACE__EVENT_INTERNAL_H
 
-/*
- * Special value for TraceEvent.vcpu_id field to indicate
- * that the event is not VCPU specific
- */
-#define TRACE_VCPU_EVENT_NONE ((uint32_t)-1)
-
 /**
  * TraceEvent:
  * @id: Unique event identifier.
@@ -23,11 +17,6 @@
  * @sstate: Static tracing state.
  * @dstate: Dynamic tracing state
  *
- * Interpretation of @dstate depends on whether the event has the 'vcpu'
- *  property:
- * - false: Boolean value indicating whether the event is active.
- * - true : Integral counting the number of vCPUs that have this event enabled.
- *
  * Opaque generic description of a tracing event.
  */
 typedef struct TraceEvent {
-- 
2.55.0



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

* [PATCH v3 08/24] trace: drop 'id' from TraceEvent struct when not required
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (6 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 07/24] trace: remove obsolete references to vcpu property Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 09/24] trace: change "DSTATE" variables from uint16_t to uint8_t Daniel P. Berrangé
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Only "simpletrace" uses the "id" field from the TraceEvent struct.
Omit it when this backend is not enabled to save memory.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/format/c.py | 2 ++
 tests/tracetool/dtrace.c      | 4 ++++
 tests/tracetool/ftrace.c      | 4 ++++
 tests/tracetool/log.c         | 4 ++++
 tests/tracetool/simple.c      | 4 ++++
 tests/tracetool/syslog.c      | 4 ++++
 tests/tracetool/ust.c         | 4 ++++
 trace/control-internal.h      | 2 ++
 trace/control.c               | 4 +++-
 trace/control.h               | 3 ++-
 trace/event-internal.h        | 2 ++
 11 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 50e03313cbf..abe738ac423 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -34,7 +34,9 @@ def generate(events, backend, group):
 
     for e in events:
         out('TraceEvent %(event)s = {',
+            '#ifdef CONFIG_TRACE_SIMPLE',
             '    .id = 0,',
+            '#endif',
             '    .name = \"%(name)s\",',
             '    .sstate = %(sstate)s,',
             '    .dstate = &%(dstate)s',
diff --git a/tests/tracetool/dtrace.c b/tests/tracetool/dtrace.c
index 9f862fa14d2..05a93918240 100644
--- a/tests/tracetool/dtrace.c
+++ b/tests/tracetool/dtrace.c
@@ -8,13 +8,17 @@
 uint16_t _TRACE_TEST_BLAH_DSTATE;
 uint16_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_blah",
     .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_wibble",
     .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
diff --git a/tests/tracetool/ftrace.c b/tests/tracetool/ftrace.c
index 9f862fa14d2..05a93918240 100644
--- a/tests/tracetool/ftrace.c
+++ b/tests/tracetool/ftrace.c
@@ -8,13 +8,17 @@
 uint16_t _TRACE_TEST_BLAH_DSTATE;
 uint16_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_blah",
     .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_wibble",
     .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
diff --git a/tests/tracetool/log.c b/tests/tracetool/log.c
index 9f862fa14d2..05a93918240 100644
--- a/tests/tracetool/log.c
+++ b/tests/tracetool/log.c
@@ -8,13 +8,17 @@
 uint16_t _TRACE_TEST_BLAH_DSTATE;
 uint16_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_blah",
     .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_wibble",
     .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
diff --git a/tests/tracetool/simple.c b/tests/tracetool/simple.c
index 0484177481c..490d6f379a5 100644
--- a/tests/tracetool/simple.c
+++ b/tests/tracetool/simple.c
@@ -8,13 +8,17 @@
 uint16_t _TRACE_TEST_BLAH_DSTATE;
 uint16_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_blah",
     .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_wibble",
     .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
diff --git a/tests/tracetool/syslog.c b/tests/tracetool/syslog.c
index 9f862fa14d2..05a93918240 100644
--- a/tests/tracetool/syslog.c
+++ b/tests/tracetool/syslog.c
@@ -8,13 +8,17 @@
 uint16_t _TRACE_TEST_BLAH_DSTATE;
 uint16_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_blah",
     .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_wibble",
     .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
diff --git a/tests/tracetool/ust.c b/tests/tracetool/ust.c
index 9f862fa14d2..05a93918240 100644
--- a/tests/tracetool/ust.c
+++ b/tests/tracetool/ust.c
@@ -8,13 +8,17 @@
 uint16_t _TRACE_TEST_BLAH_DSTATE;
 uint16_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_blah",
     .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
+#endif
     .name = "test_wibble",
     .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
diff --git a/trace/control-internal.h b/trace/control-internal.h
index 8d818d359be..f626b047264 100644
--- a/trace/control-internal.h
+++ b/trace/control-internal.h
@@ -19,11 +19,13 @@ static inline bool trace_event_is_pattern(const char *str)
     return strchr(str, '*') != NULL;
 }
 
+#ifdef CONFIG_TRACE_SIMPLE
 static inline uint32_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;
 }
+#endif
 
 static inline const char * trace_event_get_name(TraceEvent *ev)
 {
diff --git a/trace/control.c b/trace/control.c
index 6971157cbe7..947b220056a 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -36,8 +36,8 @@ typedef struct TraceEventGroup {
 
 static TraceEventGroup *event_groups;
 static size_t nevent_groups;
-static uint32_t next_id;
 #ifdef CONFIG_TRACE_SIMPLE
+static uint32_t next_id;
 static bool init_trace_on_startup;
 #endif
 static char *trace_opts_file;
@@ -65,10 +65,12 @@ QemuOptsList qemu_trace_opts = {
 
 void trace_event_register_group(TraceEvent **events)
 {
+#ifdef CONFIG_TRACE_SIMPLE
     size_t i;
     for (i = 0; events[i] != NULL; i++) {
         events[i]->id = next_id++;
     }
+#endif
     event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
     event_groups[nevent_groups].events = events;
     nevent_groups++;
diff --git a/trace/control.h b/trace/control.h
index 20033fb6669..e77c07a8e68 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -81,13 +81,14 @@ TraceEvent *trace_event_name(const char *name);
  */
 static bool trace_event_is_pattern(const char *str);
 
-
+#ifdef CONFIG_TRACE_SIMPLE
 /**
  * trace_event_get_id:
  *
  * Get the identifier of an event.
  */
 static uint32_t trace_event_get_id(TraceEvent *ev);
+#endif
 
 /**
  * trace_event_get_name:
diff --git a/trace/event-internal.h b/trace/event-internal.h
index cc095a6ad54..ecf2caabd03 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -20,7 +20,9 @@
  * Opaque generic description of a tracing event.
  */
 typedef struct TraceEvent {
+#ifdef CONFIG_TRACE_SIMPLE
     uint32_t id;
+#endif
     const char * name;
     const bool sstate;
     uint16_t *dstate;
-- 
2.55.0



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

* [PATCH v3 09/24] trace: change "DSTATE" variables from uint16_t to uint8_t
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (7 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 08/24] trace: drop 'id' from TraceEvent struct when not required Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 10/24] trace: add testing of 'nop' trace backend Daniel P. Berrangé
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Previously these variables had two distinct semantics. For
most probes DSTATE was treated as a simple boolean, while
for vcpu probes it was treated as a bitmask of vCPU indexes.

With vcpu probes removed, it is now exclusively a boolean
and thus using uint16_t is a waste of memory.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/format/c.py  | 2 +-
 scripts/tracetool/format/h.py  | 2 +-
 scripts/tracetool/format/rs.py | 4 ++--
 tests/tracetool/dtrace.c       | 4 ++--
 tests/tracetool/dtrace.h       | 4 ++--
 tests/tracetool/dtrace.rs      | 6 +++---
 tests/tracetool/ftrace.c       | 4 ++--
 tests/tracetool/ftrace.h       | 4 ++--
 tests/tracetool/ftrace.rs      | 6 +++---
 tests/tracetool/log.c          | 4 ++--
 tests/tracetool/log.h          | 4 ++--
 tests/tracetool/log.rs         | 6 +++---
 tests/tracetool/simple.c       | 4 ++--
 tests/tracetool/simple.h       | 4 ++--
 tests/tracetool/simple.rs      | 6 +++---
 tests/tracetool/syslog.c       | 4 ++--
 tests/tracetool/syslog.h       | 4 ++--
 tests/tracetool/syslog.rs      | 6 +++---
 tests/tracetool/ust.c          | 4 ++--
 tests/tracetool/ust.h          | 4 ++--
 trace/event-internal.h         | 2 +-
 21 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index abe738ac423..de1c154a881 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -30,7 +30,7 @@ def generate(events, backend, group):
         '')
 
     for e in events:
-        out('uint16_t %s;' % e.api(e.QEMU_DSTATE))
+        out('uint8_t %s;' % e.api(e.QEMU_DSTATE))
 
     for e in events:
         out('TraceEvent %(event)s = {',
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index dd58713a158..4dc1ad7eb15 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -32,7 +32,7 @@ def generate(events, backend, group):
             event = e.api(e.QEMU_EVENT))
 
     for e in events:
-        out('extern uint16_t %s;' % e.api(e.QEMU_DSTATE))
+        out('extern uint8_t %s;' % e.api(e.QEMU_DSTATE))
 
     # static state
     for e in events:
diff --git a/scripts/tracetool/format/rs.py b/scripts/tracetool/format/rs.py
index 7d9af7edfee..1fddcee1ad2 100644
--- a/scripts/tracetool/format/rs.py
+++ b/scripts/tracetool/format/rs.py
@@ -26,7 +26,7 @@ def generate(events, backend, group):
         '',
         '#[allow(dead_code)]',
         '#[inline(always)]',
-        'fn trace_event_state_is_enabled(dstate: u16) -> bool {',
+        'fn trace_event_state_is_enabled(dstate: u8) -> bool {',
         '    (unsafe { trace_events_enabled_count }) != 0 && dstate != 0',
         '}',
         '',
@@ -39,7 +39,7 @@ def generate(events, backend, group):
 
     for e in events:
         out('    #[allow(dead_code)]',
-            '    static mut %s: u16;' % e.api(e.QEMU_DSTATE))
+            '    static mut %s: u8;' % e.api(e.QEMU_DSTATE))
     out('}',
         '')
 
diff --git a/tests/tracetool/dtrace.c b/tests/tracetool/dtrace.c
index 05a93918240..f83d06252ea 100644
--- a/tests/tracetool/dtrace.c
+++ b/tests/tracetool/dtrace.c
@@ -5,8 +5,8 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint16_t _TRACE_TEST_BLAH_DSTATE;
-uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
 #ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
diff --git a/tests/tracetool/dtrace.h b/tests/tracetool/dtrace.h
index c8931a8d7b3..0b5b47089e8 100644
--- a/tests/tracetool/dtrace.h
+++ b/tests/tracetool/dtrace.h
@@ -8,8 +8,8 @@
 
 extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint16_t _TRACE_TEST_BLAH_DSTATE;
-extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 #ifndef SDT_USE_VARIADIC
diff --git a/tests/tracetool/dtrace.rs b/tests/tracetool/dtrace.rs
index 3490fcb271a..07398f4731b 100644
--- a/tests/tracetool/dtrace.rs
+++ b/tests/tracetool/dtrace.rs
@@ -8,7 +8,7 @@
 
 #[allow(dead_code)]
 #[inline(always)]
-fn trace_event_state_is_enabled(dstate: u16) -> bool {
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
     (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
 }
 
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool {
 }
 extern "C" {
     #[allow(dead_code)]
-    static mut _TRACE_TEST_BLAH_DSTATE: u16;
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
     #[allow(dead_code)]
-    static mut _TRACE_TEST_WIBBLE_DSTATE: u16;
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
 }
 
 use std::cell::UnsafeCell;
diff --git a/tests/tracetool/ftrace.c b/tests/tracetool/ftrace.c
index 05a93918240..f83d06252ea 100644
--- a/tests/tracetool/ftrace.c
+++ b/tests/tracetool/ftrace.c
@@ -5,8 +5,8 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint16_t _TRACE_TEST_BLAH_DSTATE;
-uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
 #ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
diff --git a/tests/tracetool/ftrace.h b/tests/tracetool/ftrace.h
index 1dfe4239413..b34eef17d10 100644
--- a/tests/tracetool/ftrace.h
+++ b/tests/tracetool/ftrace.h
@@ -8,8 +8,8 @@
 
 extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint16_t _TRACE_TEST_BLAH_DSTATE;
-extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 #include "trace/ftrace.h"
diff --git a/tests/tracetool/ftrace.rs b/tests/tracetool/ftrace.rs
index 34f66004902..ff0bcde4b8b 100644
--- a/tests/tracetool/ftrace.rs
+++ b/tests/tracetool/ftrace.rs
@@ -8,7 +8,7 @@
 
 #[allow(dead_code)]
 #[inline(always)]
-fn trace_event_state_is_enabled(dstate: u16) -> bool {
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
     (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
 }
 
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool {
 }
 extern "C" {
     #[allow(dead_code)]
-    static mut _TRACE_TEST_BLAH_DSTATE: u16;
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
     #[allow(dead_code)]
-    static mut _TRACE_TEST_WIBBLE_DSTATE: u16;
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
 }
 
 #[inline(always)]
diff --git a/tests/tracetool/log.c b/tests/tracetool/log.c
index 05a93918240..f83d06252ea 100644
--- a/tests/tracetool/log.c
+++ b/tests/tracetool/log.c
@@ -5,8 +5,8 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint16_t _TRACE_TEST_BLAH_DSTATE;
-uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
 #ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
diff --git a/tests/tracetool/log.h b/tests/tracetool/log.h
index c7795871f85..ff510d54908 100644
--- a/tests/tracetool/log.h
+++ b/tests/tracetool/log.h
@@ -8,8 +8,8 @@
 
 extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint16_t _TRACE_TEST_BLAH_DSTATE;
-extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 #include "qemu/log-for-trace.h"
diff --git a/tests/tracetool/log.rs b/tests/tracetool/log.rs
index 770758611d1..0f052bb2c9c 100644
--- a/tests/tracetool/log.rs
+++ b/tests/tracetool/log.rs
@@ -8,7 +8,7 @@
 
 #[allow(dead_code)]
 #[inline(always)]
-fn trace_event_state_is_enabled(dstate: u16) -> bool {
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
     (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
 }
 
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool {
 }
 extern "C" {
     #[allow(dead_code)]
-    static mut _TRACE_TEST_BLAH_DSTATE: u16;
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
     #[allow(dead_code)]
-    static mut _TRACE_TEST_WIBBLE_DSTATE: u16;
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
 }
 
 #[inline(always)]
diff --git a/tests/tracetool/simple.c b/tests/tracetool/simple.c
index 490d6f379a5..820ddb575b0 100644
--- a/tests/tracetool/simple.c
+++ b/tests/tracetool/simple.c
@@ -5,8 +5,8 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint16_t _TRACE_TEST_BLAH_DSTATE;
-uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
 #ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
diff --git a/tests/tracetool/simple.h b/tests/tracetool/simple.h
index ec6fcb22c3c..735cb21d911 100644
--- a/tests/tracetool/simple.h
+++ b/tests/tracetool/simple.h
@@ -8,8 +8,8 @@
 
 extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint16_t _TRACE_TEST_BLAH_DSTATE;
-extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 void _simple_trace_test_blah(void *context, const char *filename);
diff --git a/tests/tracetool/simple.rs b/tests/tracetool/simple.rs
index 92f896ef178..976feddde5b 100644
--- a/tests/tracetool/simple.rs
+++ b/tests/tracetool/simple.rs
@@ -8,7 +8,7 @@
 
 #[allow(dead_code)]
 #[inline(always)]
-fn trace_event_state_is_enabled(dstate: u16) -> bool {
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
     (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
 }
 
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool {
 }
 extern "C" {
     #[allow(dead_code)]
-    static mut _TRACE_TEST_BLAH_DSTATE: u16;
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
     #[allow(dead_code)]
-    static mut _TRACE_TEST_WIBBLE_DSTATE: u16;
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
 }
 
 #[inline(always)]
diff --git a/tests/tracetool/syslog.c b/tests/tracetool/syslog.c
index 05a93918240..f83d06252ea 100644
--- a/tests/tracetool/syslog.c
+++ b/tests/tracetool/syslog.c
@@ -5,8 +5,8 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint16_t _TRACE_TEST_BLAH_DSTATE;
-uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
 #ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
diff --git a/tests/tracetool/syslog.h b/tests/tracetool/syslog.h
index ed4305554c1..4203b8b37dc 100644
--- a/tests/tracetool/syslog.h
+++ b/tests/tracetool/syslog.h
@@ -8,8 +8,8 @@
 
 extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint16_t _TRACE_TEST_BLAH_DSTATE;
-extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 #include <syslog.h>
diff --git a/tests/tracetool/syslog.rs b/tests/tracetool/syslog.rs
index 378d03d34b2..9688dac84a5 100644
--- a/tests/tracetool/syslog.rs
+++ b/tests/tracetool/syslog.rs
@@ -8,7 +8,7 @@
 
 #[allow(dead_code)]
 #[inline(always)]
-fn trace_event_state_is_enabled(dstate: u16) -> bool {
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
     (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
 }
 
@@ -18,9 +18,9 @@ fn trace_event_state_is_enabled(dstate: u16) -> bool {
 }
 extern "C" {
     #[allow(dead_code)]
-    static mut _TRACE_TEST_BLAH_DSTATE: u16;
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
     #[allow(dead_code)]
-    static mut _TRACE_TEST_WIBBLE_DSTATE: u16;
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
 }
 
 #[inline(always)]
diff --git a/tests/tracetool/ust.c b/tests/tracetool/ust.c
index 05a93918240..f83d06252ea 100644
--- a/tests/tracetool/ust.c
+++ b/tests/tracetool/ust.c
@@ -5,8 +5,8 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint16_t _TRACE_TEST_BLAH_DSTATE;
-uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 TraceEvent _TRACE_TEST_BLAH_EVENT = {
 #ifdef CONFIG_TRACE_SIMPLE
     .id = 0,
diff --git a/tests/tracetool/ust.h b/tests/tracetool/ust.h
index b7acd0c39b1..079b2c74491 100644
--- a/tests/tracetool/ust.h
+++ b/tests/tracetool/ust.h
@@ -8,8 +8,8 @@
 
 extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint16_t _TRACE_TEST_BLAH_DSTATE;
-extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 #include <lttng/tracepoint.h>
diff --git a/trace/event-internal.h b/trace/event-internal.h
index ecf2caabd03..ad1578aa2c5 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -25,7 +25,7 @@ typedef struct TraceEvent {
 #endif
     const char * name;
     const bool sstate;
-    uint16_t *dstate;
+    uint8_t *dstate;
 } TraceEvent;
 
 #endif /* TRACE__EVENT_INTERNAL_H */
-- 
2.55.0



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

* [PATCH v3 10/24] trace: add testing of 'nop' trace backend
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (8 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 09/24] trace: change "DSTATE" variables from uint16_t to uint8_t Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 11/24] trace: don't emit TraceEvent structs when 'nop' backend is used Daniel P. Berrangé
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

This will be used to demonstrate that tracetool outputs the bare
minimum of code when tracing is disabled. Currently, as of this
initial commit of reference output, too much code is generated.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/tracetool/meson.build       |  1 +
 tests/tracetool/nop.c             | 36 ++++++++++++++++++++++
 tests/tracetool/nop.h             | 29 ++++++++++++++++++
 tests/tracetool/nop.rs            | 51 +++++++++++++++++++++++++++++++
 tests/tracetool/tracetool-test.py |  2 +-
 5 files changed, 118 insertions(+), 1 deletion(-)
 create mode 100644 tests/tracetool/nop.c
 create mode 100644 tests/tracetool/nop.h
 create mode 100644 tests/tracetool/nop.rs

diff --git a/tests/tracetool/meson.build b/tests/tracetool/meson.build
index 09bbaaa86bf..f4f583e6224 100644
--- a/tests/tracetool/meson.build
+++ b/tests/tracetool/meson.build
@@ -5,6 +5,7 @@ test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
 test_env.set('PYTHONIOENCODING', 'utf-8')
 
 backends = [
+    'nop',
     'dtrace',
     'ftrace',
     'log',
diff --git a/tests/tracetool/nop.c b/tests/tracetool/nop.c
new file mode 100644
index 00000000000..f83d06252ea
--- /dev/null
+++ b/tests/tracetool/nop.c
@@ -0,0 +1,36 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu/module.h"
+#include "trace-testsuite.h"
+
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
+    .id = 0,
+#endif
+    .name = "test_blah",
+    .sstate = TRACE_TEST_BLAH_ENABLED,
+    .dstate = &_TRACE_TEST_BLAH_DSTATE
+};
+TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
+    .id = 0,
+#endif
+    .name = "test_wibble",
+    .sstate = TRACE_TEST_WIBBLE_ENABLED,
+    .dstate = &_TRACE_TEST_WIBBLE_DSTATE
+};
+TraceEvent *testsuite_trace_events[] = {
+    &_TRACE_TEST_BLAH_EVENT,
+    &_TRACE_TEST_WIBBLE_EVENT,
+  NULL,
+};
+
+static void trace_testsuite_register_events(void)
+{
+    trace_event_register_group(testsuite_trace_events);
+}
+trace_init(trace_testsuite_register_events)
diff --git a/tests/tracetool/nop.h b/tests/tracetool/nop.h
new file mode 100644
index 00000000000..443f5e0cf6e
--- /dev/null
+++ b/tests/tracetool/nop.h
@@ -0,0 +1,29 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef TRACE_TESTSUITE_GENERATED_TRACERS_H
+#define TRACE_TESTSUITE_GENERATED_TRACERS_H
+
+#include "trace/control.h"
+
+extern TraceEvent _TRACE_TEST_BLAH_EVENT;
+extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+#define TRACE_TEST_BLAH_ENABLED 1
+#define TRACE_TEST_WIBBLE_ENABLED 1
+
+#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
+    false)
+
+static inline void trace_test_blah(void *context, const char *filename)
+{
+}
+
+#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
+    false)
+
+static inline void trace_test_wibble(void *context, int value)
+{
+}
+#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/nop.rs b/tests/tracetool/nop.rs
new file mode 100644
index 00000000000..5f007cecd04
--- /dev/null
+++ b/tests/tracetool/nop.rs
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// This file is @generated by tracetool, do not edit.
+
+#[allow(unused_imports)]
+use std::ffi::c_char;
+#[allow(unused_imports)]
+use util::bindings;
+
+#[allow(dead_code)]
+#[inline(always)]
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
+    (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
+}
+
+extern "C" {
+    #[allow(dead_code)]
+    static mut trace_events_enabled_count: u32;
+}
+extern "C" {
+    #[allow(dead_code)]
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
+    #[allow(dead_code)]
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_blah_enabled() -> bool
+{
+    false
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
+{
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_wibble_enabled() -> bool
+{
+    false
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
+{
+}
+
diff --git a/tests/tracetool/tracetool-test.py b/tests/tracetool/tracetool-test.py
index 59e9ab3d6ef..74f315a4629 100755
--- a/tests/tracetool/tracetool-test.py
+++ b/tests/tracetool/tracetool-test.py
@@ -14,7 +14,7 @@ def get_formats(backend):
         "c",
         "h",
     ]
-    if backend in {"dtrace", "ftrace", "log", "simple", "syslog"}:
+    if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog"}:
         formats += ["rs"]
     if backend == "dtrace":
         formats += [
-- 
2.55.0



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

* [PATCH v3 11/24] trace: don't emit TraceEvent structs when 'nop' backend is used
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (9 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 10/24] trace: add testing of 'nop' trace backend Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 12/24] trace: add test of generation with all backends enabled Daniel P. Berrangé
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The 'nop' backend is a short-hand for no trace probe usage
at all. The emitted functions become a no-op, and as such
there is no need to emit the TraceEvent structs, nor the
DSTATE variables they reference.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/format/c.py | 75 ++++++++++++++++++-----------------
 scripts/tracetool/format/h.py | 16 +++++---
 tests/tracetool/nop.c         | 29 --------------
 tests/tracetool/nop.h         |  6 +--
 4 files changed, 50 insertions(+), 76 deletions(-)

diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index de1c154a881..5f6669c917c 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -29,41 +29,42 @@ def generate(events, backend, group):
         '#include "%s"' % header,
         '')
 
-    for e in events:
-        out('uint8_t %s;' % e.api(e.QEMU_DSTATE))
-
-    for e in events:
-        out('TraceEvent %(event)s = {',
-            '#ifdef CONFIG_TRACE_SIMPLE',
-            '    .id = 0,',
-            '#endif',
-            '    .name = \"%(name)s\",',
-            '    .sstate = %(sstate)s,',
-            '    .dstate = &%(dstate)s',
+    if len(list(backend.backend_modules())):
+        for e in events:
+            out('uint8_t %s;' % e.api(e.QEMU_DSTATE))
+
+        for e in events:
+            out('TraceEvent %(event)s = {',
+                '#ifdef CONFIG_TRACE_SIMPLE',
+                '    .id = 0,',
+                '#endif',
+                '    .name = \"%(name)s\",',
+                '    .sstate = %(sstate)s,',
+                '    .dstate = &%(dstate)s',
+                '};',
+                event = e.api(e.QEMU_EVENT),
+                name = e.name,
+                sstate = "TRACE_%s_ENABLED" % e.name.upper(),
+                dstate = e.api(e.QEMU_DSTATE))
+
+        out('TraceEvent *%(group)s_trace_events[] = {',
+            group = group.lower())
+
+        for e in events:
+            out('    &%(event)s,', event = e.api(e.QEMU_EVENT))
+
+        out('  NULL,',
             '};',
-            event = e.api(e.QEMU_EVENT),
-            name = e.name,
-            sstate = "TRACE_%s_ENABLED" % e.name.upper(),
-            dstate = e.api(e.QEMU_DSTATE))
-
-    out('TraceEvent *%(group)s_trace_events[] = {',
-        group = group.lower())
-
-    for e in events:
-        out('    &%(event)s,', event = e.api(e.QEMU_EVENT))
-
-    out('  NULL,',
-        '};',
-        '')
-
-    out('static void trace_%(group)s_register_events(void)',
-        '{',
-        '    trace_event_register_group(%(group)s_trace_events);',
-        '}',
-        'trace_init(trace_%(group)s_register_events)',
-        group = group.lower())
-
-    backend.generate_begin(active_events, group)
-    for event in active_events:
-        backend.generate(event, group)
-    backend.generate_end(active_events, group)
+            '')
+
+        out('static void trace_%(group)s_register_events(void)',
+            '{',
+            '    trace_event_register_group(%(group)s_trace_events);',
+            '}',
+            'trace_init(trace_%(group)s_register_events)',
+            group = group.lower())
+
+        backend.generate_begin(active_events, group)
+        for event in active_events:
+            backend.generate(event, group)
+        backend.generate_end(active_events, group)
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 4dc1ad7eb15..6ffb7256e31 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -27,12 +27,16 @@ def generate(events, backend, group):
         '#include "%s"' % header,
         '')
 
-    for e in events:
-        out('extern TraceEvent %(event)s;',
-            event = e.api(e.QEMU_EVENT))
-
-    for e in events:
-        out('extern uint8_t %s;' % e.api(e.QEMU_DSTATE))
+    if len(list(backend.backend_modules())):
+        for e in events:
+            out('extern TraceEvent %(event)s;',
+                event = e.api(e.QEMU_EVENT))
+
+        for e in events:
+            out('extern uint8_t %s;' % e.api(e.QEMU_DSTATE))
+    else:
+        for e in events:
+            out('#define %s 0' % e.api(e.QEMU_DSTATE))
 
     # static state
     for e in events:
diff --git a/tests/tracetool/nop.c b/tests/tracetool/nop.c
index f83d06252ea..d34cc0ca742 100644
--- a/tests/tracetool/nop.c
+++ b/tests/tracetool/nop.c
@@ -5,32 +5,3 @@
 #include "qemu/module.h"
 #include "trace-testsuite.h"
 
-uint8_t _TRACE_TEST_BLAH_DSTATE;
-uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-TraceEvent _TRACE_TEST_BLAH_EVENT = {
-#ifdef CONFIG_TRACE_SIMPLE
-    .id = 0,
-#endif
-    .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
-    .dstate = &_TRACE_TEST_BLAH_DSTATE
-};
-TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
-#ifdef CONFIG_TRACE_SIMPLE
-    .id = 0,
-#endif
-    .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
-    .dstate = &_TRACE_TEST_WIBBLE_DSTATE
-};
-TraceEvent *testsuite_trace_events[] = {
-    &_TRACE_TEST_BLAH_EVENT,
-    &_TRACE_TEST_WIBBLE_EVENT,
-  NULL,
-};
-
-static void trace_testsuite_register_events(void)
-{
-    trace_event_register_group(testsuite_trace_events);
-}
-trace_init(trace_testsuite_register_events)
diff --git a/tests/tracetool/nop.h b/tests/tracetool/nop.h
index 443f5e0cf6e..64b6b005684 100644
--- a/tests/tracetool/nop.h
+++ b/tests/tracetool/nop.h
@@ -6,10 +6,8 @@
 
 #include "trace/control.h"
 
-extern TraceEvent _TRACE_TEST_BLAH_EVENT;
-extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
-extern uint8_t _TRACE_TEST_BLAH_DSTATE;
-extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+#define _TRACE_TEST_BLAH_DSTATE 0
+#define _TRACE_TEST_WIBBLE_DSTATE 0
 #define TRACE_TEST_BLAH_ENABLED 1
 #define TRACE_TEST_WIBBLE_ENABLED 1
 
-- 
2.55.0



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

* [PATCH v3 12/24] trace: add test of generation with all backends enabled
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (10 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 11/24] trace: don't emit TraceEvent structs when 'nop' backend is used Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 13/24] trace: remove redundant headers from simple trace backend code Daniel P. Berrangé
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

This reveals potentially interesting patterns in the generated
code when multiple backends are present.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/tracetool/all.c                |  65 +++++++++++++++++
 tests/tracetool/all.d                |  10 +++
 tests/tracetool/all.h                | 102 +++++++++++++++++++++++++++
 tests/tracetool/all.log-stap         |  15 ++++
 tests/tracetool/all.rs               |  90 +++++++++++++++++++++++
 tests/tracetool/all.simpletrace-stap |  16 +++++
 tests/tracetool/all.stap             |  14 ++++
 tests/tracetool/all.ust-events-c     |  14 ++++
 tests/tracetool/all.ust-events-h     |  56 +++++++++++++++
 tests/tracetool/meson.build          |   3 +-
 tests/tracetool/tracetool-test.py    |  12 ++--
 11 files changed, 392 insertions(+), 5 deletions(-)
 create mode 100644 tests/tracetool/all.c
 create mode 100644 tests/tracetool/all.d
 create mode 100644 tests/tracetool/all.h
 create mode 100644 tests/tracetool/all.log-stap
 create mode 100644 tests/tracetool/all.rs
 create mode 100644 tests/tracetool/all.simpletrace-stap
 create mode 100644 tests/tracetool/all.stap
 create mode 100644 tests/tracetool/all.ust-events-c
 create mode 100644 tests/tracetool/all.ust-events-h

diff --git a/tests/tracetool/all.c b/tests/tracetool/all.c
new file mode 100644
index 00000000000..820ddb575b0
--- /dev/null
+++ b/tests/tracetool/all.c
@@ -0,0 +1,65 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu/module.h"
+#include "trace-testsuite.h"
+
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
+    .id = 0,
+#endif
+    .name = "test_blah",
+    .sstate = TRACE_TEST_BLAH_ENABLED,
+    .dstate = &_TRACE_TEST_BLAH_DSTATE
+};
+TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
+    .id = 0,
+#endif
+    .name = "test_wibble",
+    .sstate = TRACE_TEST_WIBBLE_ENABLED,
+    .dstate = &_TRACE_TEST_WIBBLE_DSTATE
+};
+TraceEvent *testsuite_trace_events[] = {
+    &_TRACE_TEST_BLAH_EVENT,
+    &_TRACE_TEST_WIBBLE_EVENT,
+  NULL,
+};
+
+static void trace_testsuite_register_events(void)
+{
+    trace_event_register_group(testsuite_trace_events);
+}
+trace_init(trace_testsuite_register_events)
+#include "qemu/osdep.h"
+#include "trace/control.h"
+#include "trace/simple.h"
+
+void _simple_trace_test_blah(void *context, const char *filename)
+{
+    TraceBufferRecord rec;
+    size_t argfilename_len = filename ? MIN(strlen(filename), MAX_TRACE_STRLEN) : 0;
+
+    if (trace_record_start(&rec, _TRACE_TEST_BLAH_EVENT.id, 8 + 4 + argfilename_len)) {
+        return; /* Trace Buffer Full, Event Dropped ! */
+    }
+    trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)context);
+    trace_record_write_str(&rec, filename, argfilename_len);
+    trace_record_finish(&rec);
+}
+
+void _simple_trace_test_wibble(void *context, int value)
+{
+    TraceBufferRecord rec;
+
+    if (trace_record_start(&rec, _TRACE_TEST_WIBBLE_EVENT.id, 8 + 8)) {
+        return; /* Trace Buffer Full, Event Dropped ! */
+    }
+    trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)context);
+    trace_record_write_u64(&rec, (uint64_t)value);
+    trace_record_finish(&rec);
+}
+
diff --git a/tests/tracetool/all.d b/tests/tracetool/all.d
new file mode 100644
index 00000000000..5cc06f9f4f5
--- /dev/null
+++ b/tests/tracetool/all.d
@@ -0,0 +1,10 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+provider qemu {
+
+probe test_blah(void * context,const char * filename);
+
+probe test_wibble(void * context,int value);
+
+};
diff --git a/tests/tracetool/all.h b/tests/tracetool/all.h
new file mode 100644
index 00000000000..41fa4d0e8a2
--- /dev/null
+++ b/tests/tracetool/all.h
@@ -0,0 +1,102 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef TRACE_TESTSUITE_GENERATED_TRACERS_H
+#define TRACE_TESTSUITE_GENERATED_TRACERS_H
+
+#include "trace/control.h"
+
+extern TraceEvent _TRACE_TEST_BLAH_EVENT;
+extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+#define TRACE_TEST_BLAH_ENABLED 1
+#define TRACE_TEST_WIBBLE_ENABLED 1
+#ifndef SDT_USE_VARIADIC
+#define SDT_USE_VARIADIC 1
+#endif
+#include "trace-dtrace-testsuite.h"
+
+#undef SDT_USE_VARIADIC
+#ifndef QEMU_TEST_BLAH_ENABLED
+#define QEMU_TEST_BLAH_ENABLED() true
+#endif
+#ifndef QEMU_TEST_WIBBLE_ENABLED
+#define QEMU_TEST_WIBBLE_ENABLED() true
+#endif
+#include "trace/ftrace.h"
+
+#include "qemu/log-for-trace.h"
+
+void _simple_trace_test_blah(void *context, const char *filename);
+void _simple_trace_test_wibble(void *context, int value);
+
+#include <syslog.h>
+
+#include <lttng/tracepoint.h>
+#include "trace-ust-testsuite.h"
+
+/* tracepoint_enabled() was introduced in LTTng UST 2.7 */
+#ifndef tracepoint_enabled
+#define tracepoint_enabled(a, b) true
+#endif
+
+
+#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
+    QEMU_TEST_BLAH_ENABLED() || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
+    tracepoint_enabled(qemu, test_blah) || \
+    false)
+
+static inline void trace_test_blah(void *context, const char *filename)
+{
+    QEMU_TEST_BLAH(context, filename);
+    tracepoint(qemu, test_blah, context, filename);
+    if (trace_event_get_state(TRACE_TEST_BLAH)) {
+#line 4 "trace-events"
+        ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
+#line 62 "all.h"
+        if (qemu_loglevel_mask(LOG_TRACE)) {
+#line 4 "trace-events"
+            qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
+#line 66 "all.h"
+        }
+        _simple_trace_test_blah(context, filename);
+#line 4 "trace-events"
+        syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
+#line 71 "all.h"
+    }
+}
+
+#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
+    QEMU_TEST_WIBBLE_ENABLED() || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
+    tracepoint_enabled(qemu, test_wibble) || \
+    false)
+
+static inline void trace_test_wibble(void *context, int value)
+{
+    QEMU_TEST_WIBBLE(context, value);
+    tracepoint(qemu, test_wibble, context, value);
+    if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
+#line 5 "trace-events"
+        ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
+#line 91 "all.h"
+        if (qemu_loglevel_mask(LOG_TRACE)) {
+#line 5 "trace-events"
+            qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
+#line 95 "all.h"
+        }
+        _simple_trace_test_wibble(context, value);
+#line 5 "trace-events"
+        syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
+#line 100 "all.h"
+    }
+}
+#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/all.log-stap b/tests/tracetool/all.log-stap
new file mode 100644
index 00000000000..092986e0b61
--- /dev/null
+++ b/tests/tracetool/all.log-stap
@@ -0,0 +1,15 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+probe qemu.log.test_blah = qemu.test_blah ?
+{
+    try {
+        argfilename_str = filename ? user_string_n(filename, 512) : "<null>"
+    } catch {}
+    printf("%d@%d test_blah Blah context=%p filename=%s\n", pid(), gettimeofday_ns(), context, argfilename_str)
+}
+probe qemu.log.test_wibble = qemu.test_wibble ?
+{
+    printf("%d@%d test_wibble Wibble context=%p value=%d\n", pid(), gettimeofday_ns(), context, value)
+}
+
diff --git a/tests/tracetool/all.rs b/tests/tracetool/all.rs
new file mode 100644
index 00000000000..c8c9d288366
--- /dev/null
+++ b/tests/tracetool/all.rs
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// This file is @generated by tracetool, do not edit.
+
+#[allow(unused_imports)]
+use std::ffi::c_char;
+#[allow(unused_imports)]
+use util::bindings;
+
+#[allow(dead_code)]
+#[inline(always)]
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
+    (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
+}
+
+extern "C" {
+    #[allow(dead_code)]
+    static mut trace_events_enabled_count: u32;
+}
+extern "C" {
+    #[allow(dead_code)]
+    static mut _TRACE_TEST_BLAH_DSTATE: u8;
+    #[allow(dead_code)]
+    static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
+}
+
+use std::cell::UnsafeCell;
+
+extern "C" {
+    #[allow(dead_code)]
+    static qemu_test_blah_semaphore: UnsafeCell<u16>;
+    #[allow(dead_code)]
+    static qemu_test_wibble_semaphore: UnsafeCell<u16>;
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_blah_enabled() -> bool
+{
+    (unsafe {qemu_test_blah_semaphore.get().read_volatile()}) != 0 ||
+    trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) ||
+    false
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
+{
+    ::trace::probe!(qemu, test_blah, _context, _filename.as_ptr());
+    if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
+        let format_string = c"Blah context=%p filename=%s";
+        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
+        let format_string = c"test_blah Blah context=%p filename=%s\n";
+        if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
+            unsafe { bindings::qemu_log(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
+        }
+        extern "C" { fn _simple_trace_test_blah(_context: *mut (), _filename: *const std::ffi::c_char); }
+        unsafe { _simple_trace_test_blah(_context, _filename.as_ptr()); }
+        let format_string = c"Blah context=%p filename=%s";
+        unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
+    }
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_wibble_enabled() -> bool
+{
+    (unsafe {qemu_test_wibble_semaphore.get().read_volatile()}) != 0 ||
+    trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) ||
+    false
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
+{
+    ::trace::probe!(qemu, test_wibble, _context, _value);
+    if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
+        let format_string = c"Wibble context=%p value=%d";
+        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
+        let format_string = c"test_wibble Wibble context=%p value=%d\n";
+        if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
+            unsafe { bindings::qemu_log(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
+        }
+        extern "C" { fn _simple_trace_test_wibble(_context: *mut (), _value: std::ffi::c_int); }
+        unsafe { _simple_trace_test_wibble(_context, _value); }
+        let format_string = c"Wibble context=%p value=%d";
+        unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
+    }
+}
+
diff --git a/tests/tracetool/all.simpletrace-stap b/tests/tracetool/all.simpletrace-stap
new file mode 100644
index 00000000000..d064e3e286a
--- /dev/null
+++ b/tests/tracetool/all.simpletrace-stap
@@ -0,0 +1,16 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+probe qemu.simpletrace.test_blah = qemu.test_blah ?
+{
+    try {
+        argfilename_str = filename ? user_string_n(filename, 512) : "<null>"
+    } catch {}
+    argfilename_len = strlen(argfilename_str)
+    printf("%8b%8b%8b%4b%4b%8b%4b%.*s", 1, 0, gettimeofday_ns(), 24 + 8 + 4 + argfilename_len, pid(), context, argfilename_len, argfilename_len, argfilename_str)
+}
+probe qemu.simpletrace.test_wibble = qemu.test_wibble ?
+{
+    printf("%8b%8b%8b%4b%4b%8b%8b", 1, 1, gettimeofday_ns(), 24 + 8 + 8, pid(), context, value)
+}
+
diff --git a/tests/tracetool/all.stap b/tests/tracetool/all.stap
new file mode 100644
index 00000000000..9c5d8a527ce
--- /dev/null
+++ b/tests/tracetool/all.stap
@@ -0,0 +1,14 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+probe qemu.test_blah = process("qemu").mark("test_blah")
+{
+  context = $arg1;
+  filename = $arg2;
+}
+probe qemu.test_wibble = process("qemu").mark("test_wibble")
+{
+  context = $arg1;
+  value = $arg2;
+}
+
diff --git a/tests/tracetool/all.ust-events-c b/tests/tracetool/all.ust-events-c
new file mode 100644
index 00000000000..db232240568
--- /dev/null
+++ b/tests/tracetool/all.ust-events-c
@@ -0,0 +1,14 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+
+#define TRACEPOINT_DEFINE
+#define TRACEPOINT_CREATE_PROBES
+
+/* If gcc version 4.7 or older is used, LTTng ust gives a warning when compiling with
+   -Wredundant-decls.
+ */
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+
+#include "trace-ust-all.h"
diff --git a/tests/tracetool/all.ust-events-h b/tests/tracetool/all.ust-events-h
new file mode 100644
index 00000000000..4621a995fc1
--- /dev/null
+++ b/tests/tracetool/all.ust-events-h
@@ -0,0 +1,56 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER qemu
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./trace-ust.h"
+
+#if !defined (TRACE_TESTSUITE_GENERATED_UST_H) || \
+     defined(TRACEPOINT_HEADER_MULTI_READ)
+#define TRACE_TESTSUITE_GENERATED_UST_H
+
+#include <lttng/tracepoint.h>
+
+/*
+ * LTTng ust 2.0 does not allow you to use TP_ARGS(void) for tracepoints
+ * requiring no arguments. We define these macros introduced in more recent * versions of LTTng ust as a workaround
+ */
+#ifndef _TP_EXPROTO1
+#define _TP_EXPROTO1(a)               void
+#endif
+#ifndef _TP_EXDATA_PROTO1
+#define _TP_EXDATA_PROTO1(a)          void *__tp_data
+#endif
+#ifndef _TP_EXDATA_VAR1
+#define _TP_EXDATA_VAR1(a)            __tp_data
+#endif
+#ifndef _TP_EXVAR1
+#define _TP_EXVAR1(a)
+#endif
+
+TRACEPOINT_EVENT(
+   qemu,
+   test_blah,
+   TP_ARGS(void *, context, const char *, filename),
+   TP_FIELDS(
+       ctf_integer_hex(void *, context, context)
+       ctf_string(filename, filename)
+   )
+)
+
+TRACEPOINT_EVENT(
+   qemu,
+   test_wibble,
+   TP_ARGS(void *, context, int, value),
+   TP_FIELDS(
+       ctf_integer_hex(void *, context, context)
+       ctf_integer(int, value, value)
+   )
+)
+
+#endif /* TRACE_TESTSUITE_GENERATED_UST_H */
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
diff --git a/tests/tracetool/meson.build b/tests/tracetool/meson.build
index f4f583e6224..b024dc6e405 100644
--- a/tests/tracetool/meson.build
+++ b/tests/tracetool/meson.build
@@ -11,7 +11,8 @@ backends = [
     'log',
     'simple',
     'syslog',
-    'ust'
+    'ust',
+    'all'
 ]
 
 # The tracetool-test.py program has portability problems on Windows.
diff --git a/tests/tracetool/tracetool-test.py b/tests/tracetool/tracetool-test.py
index 74f315a4629..2f6328e68c3 100755
--- a/tests/tracetool/tracetool-test.py
+++ b/tests/tracetool/tracetool-test.py
@@ -14,16 +14,16 @@ def get_formats(backend):
         "c",
         "h",
     ]
-    if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog"}:
+    if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog", "all"}:
         formats += ["rs"]
-    if backend == "dtrace":
+    if backend in {"dtrace", "all"}:
         formats += [
             "d",
             "log-stap",
             "simpletrace-stap",
             "stap",
         ]
-    if backend == "ust":
+    if backend in {"ust", "all"}:
         formats += [
             "ust-events-c",
             "ust-events-h",
@@ -36,8 +36,12 @@ def test_tracetool_one(tracetool, backend, fmt, src_dir, build_dir):
     actual_file = Path(build_dir, rel_filename)
     expect_file = Path(src_dir, rel_filename)
 
+    backends = backend
+    if backends == "all":
+        backends = "dtrace,ftrace,log,simple,syslog,ust"
+
     args = [sys.executable, tracetool,
-            f"--format={fmt}", f"--backends={backend}", "--group=testsuite"]
+            f"--format={fmt}", f"--backends={backends}", "--group=testsuite"]
 
     if fmt.find("stap") != -1:
         args += ["--binary=qemu", "--probe-prefix=qemu"]
-- 
2.55.0



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

* [PATCH v3 13/24] trace: remove redundant headers from simple trace backend code
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (11 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 12/24] trace: add test of generation with all backends enabled Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 14/24] trace: include probe name in Rust format strings Daniel P. Berrangé
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The main formatter for .h/.c files for generated trace code
already includes osdep.h and control.h, so it is redundant
for the simple trace backend to add them too.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/backend/simple.py | 4 +---
 tests/tracetool/all.c               | 2 --
 tests/tracetool/simple.c            | 2 --
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index b131e4fc194..e22683c7d2a 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -48,9 +48,7 @@ def generate_h_backend_dstate(event, group):
 
 
 def generate_c_begin(events, group):
-    out('#include "qemu/osdep.h"',
-        '#include "trace/control.h"',
-        '#include "trace/simple.h"',
+    out('#include "trace/simple.h"',
         '')
 
 
diff --git a/tests/tracetool/all.c b/tests/tracetool/all.c
index 820ddb575b0..3b8d4d32d17 100644
--- a/tests/tracetool/all.c
+++ b/tests/tracetool/all.c
@@ -34,8 +34,6 @@ static void trace_testsuite_register_events(void)
     trace_event_register_group(testsuite_trace_events);
 }
 trace_init(trace_testsuite_register_events)
-#include "qemu/osdep.h"
-#include "trace/control.h"
 #include "trace/simple.h"
 
 void _simple_trace_test_blah(void *context, const char *filename)
diff --git a/tests/tracetool/simple.c b/tests/tracetool/simple.c
index 820ddb575b0..3b8d4d32d17 100644
--- a/tests/tracetool/simple.c
+++ b/tests/tracetool/simple.c
@@ -34,8 +34,6 @@ static void trace_testsuite_register_events(void)
     trace_event_register_group(testsuite_trace_events);
 }
 trace_init(trace_testsuite_register_events)
-#include "qemu/osdep.h"
-#include "trace/control.h"
 #include "trace/simple.h"
 
 void _simple_trace_test_blah(void *context, const char *filename)
-- 
2.55.0



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

* [PATCH v3 14/24] trace: include probe name in Rust format strings
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (12 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 13/24] trace: remove redundant headers from simple trace backend code Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 15/24] trace: add missing newline in ftrace Rust format string Daniel P. Berrangé
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The C format strings all include the probe name as a prefix,
however, this was missed in the Rust generators for ftrace
and syslog.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/backend/ftrace.py | 2 +-
 scripts/tracetool/backend/syslog.py | 2 +-
 tests/tracetool/all.rs              | 8 ++++----
 tests/tracetool/ftrace.rs           | 4 ++--
 tests/tracetool/syslog.rs           | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index e03698a2edf..ba2a0c83770 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -47,5 +47,5 @@ def generate_h_backend_dstate(event, group):
 def generate_rs(event, group):
     out('        let format_string = c"%(fmt)s";',
         '        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, %(args)s);}',
-        fmt=expand_format_string(event.fmt),
+        fmt=expand_format_string(event.fmt, event.name + " "),
         args=event.args.rust_call_varargs())
diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py
index 12b826593db..746efd35fb9 100644
--- a/scripts/tracetool/backend/syslog.py
+++ b/scripts/tracetool/backend/syslog.py
@@ -41,7 +41,7 @@ def generate_h(event, group):
 def generate_rs(event, group):
     out('        let format_string = c"%(fmt)s";',
         '        unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, %(args)s);}',
-        fmt=expand_format_string(event.fmt),
+        fmt=expand_format_string(event.fmt, event.name + " "),
         args=event.args.rust_call_varargs())
 
 def generate_h_backend_dstate(event, group):
diff --git a/tests/tracetool/all.rs b/tests/tracetool/all.rs
index c8c9d288366..14afd86281e 100644
--- a/tests/tracetool/all.rs
+++ b/tests/tracetool/all.rs
@@ -47,7 +47,7 @@ pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 {
     ::trace::probe!(qemu, test_blah, _context, _filename.as_ptr());
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
-        let format_string = c"Blah context=%p filename=%s";
+        let format_string = c"test_blah Blah context=%p filename=%s";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
         let format_string = c"test_blah Blah context=%p filename=%s\n";
         if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
@@ -55,7 +55,7 @@ pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
         }
         extern "C" { fn _simple_trace_test_blah(_context: *mut (), _filename: *const std::ffi::c_char); }
         unsafe { _simple_trace_test_blah(_context, _filename.as_ptr()); }
-        let format_string = c"Blah context=%p filename=%s";
+        let format_string = c"test_blah Blah context=%p filename=%s";
         unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
     }
 }
@@ -75,7 +75,7 @@ pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
 {
     ::trace::probe!(qemu, test_wibble, _context, _value);
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
-        let format_string = c"Wibble context=%p value=%d";
+        let format_string = c"test_wibble Wibble context=%p value=%d";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
         let format_string = c"test_wibble Wibble context=%p value=%d\n";
         if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
@@ -83,7 +83,7 @@ pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
         }
         extern "C" { fn _simple_trace_test_wibble(_context: *mut (), _value: std::ffi::c_int); }
         unsafe { _simple_trace_test_wibble(_context, _value); }
-        let format_string = c"Wibble context=%p value=%d";
+        let format_string = c"test_wibble Wibble context=%p value=%d";
         unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
     }
 }
diff --git a/tests/tracetool/ftrace.rs b/tests/tracetool/ftrace.rs
index ff0bcde4b8b..39959d3fdd1 100644
--- a/tests/tracetool/ftrace.rs
+++ b/tests/tracetool/ftrace.rs
@@ -36,7 +36,7 @@ pub fn trace_test_blah_enabled() -> bool
 pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 {
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
-        let format_string = c"Blah context=%p filename=%s";
+        let format_string = c"test_blah Blah context=%p filename=%s";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
     }
 }
@@ -54,7 +54,7 @@ pub fn trace_test_wibble_enabled() -> bool
 pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
 {
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
-        let format_string = c"Wibble context=%p value=%d";
+        let format_string = c"test_wibble Wibble context=%p value=%d";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
     }
 }
diff --git a/tests/tracetool/syslog.rs b/tests/tracetool/syslog.rs
index 9688dac84a5..b90ad4be7f4 100644
--- a/tests/tracetool/syslog.rs
+++ b/tests/tracetool/syslog.rs
@@ -36,7 +36,7 @@ pub fn trace_test_blah_enabled() -> bool
 pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 {
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
-        let format_string = c"Blah context=%p filename=%s";
+        let format_string = c"test_blah Blah context=%p filename=%s";
         unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
     }
 }
@@ -54,7 +54,7 @@ pub fn trace_test_wibble_enabled() -> bool
 pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
 {
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
-        let format_string = c"Wibble context=%p value=%d";
+        let format_string = c"test_wibble Wibble context=%p value=%d";
         unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
     }
 }
-- 
2.55.0



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

* [PATCH v3 15/24] trace: add missing newline in ftrace Rust format string
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (13 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 14/24] trace: include probe name in Rust format strings Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 16/24] trace: eliminate dupe trace_event_get_state_dynamic_by_id() calls Daniel P. Berrangé
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The ftrace_write() method expects the caller to provide the
newline.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/backend/ftrace.py | 2 +-
 tests/tracetool/all.rs              | 4 ++--
 tests/tracetool/ftrace.rs           | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index ba2a0c83770..e304ef21999 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -45,7 +45,7 @@ def generate_h_backend_dstate(event, group):
         event_id="TRACE_" + event.name.upper())
 
 def generate_rs(event, group):
-    out('        let format_string = c"%(fmt)s";',
+    out('        let format_string = c"%(fmt)s\\n";',
         '        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, %(args)s);}',
         fmt=expand_format_string(event.fmt, event.name + " "),
         args=event.args.rust_call_varargs())
diff --git a/tests/tracetool/all.rs b/tests/tracetool/all.rs
index 14afd86281e..f48bdf4aab5 100644
--- a/tests/tracetool/all.rs
+++ b/tests/tracetool/all.rs
@@ -47,7 +47,7 @@ pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 {
     ::trace::probe!(qemu, test_blah, _context, _filename.as_ptr());
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
-        let format_string = c"test_blah Blah context=%p filename=%s";
+        let format_string = c"test_blah Blah context=%p filename=%s\n";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
         let format_string = c"test_blah Blah context=%p filename=%s\n";
         if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
@@ -75,7 +75,7 @@ pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
 {
     ::trace::probe!(qemu, test_wibble, _context, _value);
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
-        let format_string = c"test_wibble Wibble context=%p value=%d";
+        let format_string = c"test_wibble Wibble context=%p value=%d\n";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
         let format_string = c"test_wibble Wibble context=%p value=%d\n";
         if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
diff --git a/tests/tracetool/ftrace.rs b/tests/tracetool/ftrace.rs
index 39959d3fdd1..1ad13172b17 100644
--- a/tests/tracetool/ftrace.rs
+++ b/tests/tracetool/ftrace.rs
@@ -36,7 +36,7 @@ pub fn trace_test_blah_enabled() -> bool
 pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 {
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
-        let format_string = c"test_blah Blah context=%p filename=%s";
+        let format_string = c"test_blah Blah context=%p filename=%s\n";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
     }
 }
@@ -54,7 +54,7 @@ pub fn trace_test_wibble_enabled() -> bool
 pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
 {
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
-        let format_string = c"test_wibble Wibble context=%p value=%d";
+        let format_string = c"test_wibble Wibble context=%p value=%d\n";
         unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
     }
 }
-- 
2.55.0



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

* [PATCH v3 16/24] trace: eliminate dupe trace_event_get_state_dynamic_by_id() calls
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (14 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 15/24] trace: add missing newline in ftrace Rust format string Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 17/24] audio: remove mistaken use of trace_event_get_state() Daniel P. Berrangé
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Each backend generates the same trace_event_get_state_dynamic_by_id()
call for the TRACE....DSTATE() macro body, so when multiple backends
are enabled, the same check is repeated:

 #define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
     QEMU_TEST_WIBBLE_ENABLED() || \
     trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     tracepoint_enabled(qemu, test_wibble) || \
     false)

Expanding the use of the 'backend.check_trace_event_get_state'
attr in the C header generator removes the duplication, in the
same way that the Rust generator already does.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/backend/__init__.py |  4 ++--
 scripts/tracetool/backend/ftrace.py   |  4 ----
 scripts/tracetool/backend/log.py      |  4 ----
 scripts/tracetool/backend/simple.py   |  5 -----
 scripts/tracetool/backend/syslog.py   |  4 ----
 scripts/tracetool/format/h.py         |  8 +++++++-
 tests/tracetool/all.h                 | 22 ++++++++--------------
 7 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
index 9109a783c72..72f549c77c4 100644
--- a/scripts/tracetool/backend/__init__.py
+++ b/scripts/tracetool/backend/__init__.py
@@ -133,8 +133,8 @@ def generate_begin(self, events, group):
     def generate(self, event, group, check_trace_event_get_state=None):
         self._run_function("generate_%s", event, group, check_trace_event_get_state=check_trace_event_get_state)
 
-    def generate_backend_dstate(self, event, group):
-        self._run_function("generate_%s_backend_dstate", event, group)
+    def generate_backend_dstate(self, event, group, check_trace_event_get_state=None):
+        self._run_function("generate_%s_backend_dstate", event, group, check_trace_event_get_state=check_trace_event_get_state)
 
     def generate_end(self, events, group):
         self._run_function("generate_%s_end", events, group)
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index e304ef21999..94cffc45a9d 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -40,10 +40,6 @@ def generate_h(event, group):
         argnames=argnames)
 
 
-def generate_h_backend_dstate(event, group):
-    out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
-        event_id="TRACE_" + event.name.upper())
-
 def generate_rs(event, group):
     out('        let format_string = c"%(fmt)s\\n";',
         '        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, %(args)s);}',
diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
index 9e3e5046f5f..577ee158584 100644
--- a/scripts/tracetool/backend/log.py
+++ b/scripts/tracetool/backend/log.py
@@ -41,10 +41,6 @@ def generate_h(event, group):
         argnames=argnames)
 
 
-def generate_h_backend_dstate(event, group):
-    out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
-        event_id="TRACE_" + event.name.upper())
-
 def generate_rs(event, group):
     out('        let format_string = c"%(fmt)s\\n";',
         '        if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {',
diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index e22683c7d2a..15f27e26bd5 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -42,11 +42,6 @@ def generate_h(event, group):
         args=", ".join(event.args.names()))
 
 
-def generate_h_backend_dstate(event, group):
-    out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
-        event_id="TRACE_" + event.name.upper())
-
-
 def generate_c_begin(events, group):
     out('#include "trace/simple.h"',
         '')
diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py
index 746efd35fb9..ba269cb6a33 100644
--- a/scripts/tracetool/backend/syslog.py
+++ b/scripts/tracetool/backend/syslog.py
@@ -43,7 +43,3 @@ def generate_rs(event, group):
         '        unsafe {::trace::syslog(::trace::LOG_INFO, format_string.as_ptr() as *const c_char, %(args)s);}',
         fmt=expand_format_string(event.fmt, event.name + " "),
         args=event.args.rust_call_varargs())
-
-def generate_h_backend_dstate(event, group):
-    out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
-        event_id="TRACE_" + event.name.upper())
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 6ffb7256e31..5ad3a419f82 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -55,7 +55,13 @@ def generate(events, backend, group):
             api=e.api(e.QEMU_BACKEND_DSTATE))
 
         if "disable" not in e.properties:
-            backend.generate_backend_dstate(e, group)
+            backend.generate_backend_dstate(e, group, check_trace_event_get_state=False)
+
+            if backend.check_trace_event_get_state:
+                event_id = 'TRACE_' + e.name.upper()
+                out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
+                    event_id=event_id)
+                backend.generate_backend_dstate(e, group, check_trace_event_get_state=True)
 
         out('    false)')
 
diff --git a/tests/tracetool/all.h b/tests/tracetool/all.h
index 41fa4d0e8a2..5627c1d8930 100644
--- a/tests/tracetool/all.h
+++ b/tests/tracetool/all.h
@@ -44,11 +44,8 @@ void _simple_trace_test_wibble(void *context, int value);
 
 #define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
     QEMU_TEST_BLAH_ENABLED() || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
     tracepoint_enabled(qemu, test_blah) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
     false)
 
 static inline void trace_test_blah(void *context, const char *filename)
@@ -58,26 +55,23 @@ static inline void trace_test_blah(void *context, const char *filename)
     if (trace_event_get_state(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
-#line 62 "all.h"
+#line 59 "all.h"
         if (qemu_loglevel_mask(LOG_TRACE)) {
 #line 4 "trace-events"
             qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 66 "all.h"
+#line 63 "all.h"
         }
         _simple_trace_test_blah(context, filename);
 #line 4 "trace-events"
         syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
-#line 71 "all.h"
+#line 68 "all.h"
     }
 }
 
 #define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
     QEMU_TEST_WIBBLE_ENABLED() || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     tracepoint_enabled(qemu, test_wibble) || \
+    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     false)
 
 static inline void trace_test_wibble(void *context, int value)
@@ -87,16 +81,16 @@ static inline void trace_test_wibble(void *context, int value)
     if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
-#line 91 "all.h"
+#line 85 "all.h"
         if (qemu_loglevel_mask(LOG_TRACE)) {
 #line 5 "trace-events"
             qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 95 "all.h"
+#line 89 "all.h"
         }
         _simple_trace_test_wibble(context, value);
 #line 5 "trace-events"
         syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
-#line 100 "all.h"
+#line 94 "all.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
-- 
2.55.0



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

* [PATCH v3 17/24] audio: remove mistaken use of trace_event_get_state()
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (15 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 16/24] trace: eliminate dupe trace_event_get_state_dynamic_by_id() calls Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 18/24] hw/ppc: " Daniel P. Berrangé
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Conditional checks must call trace_event_get_state_backends()
which checks the state of all backends (dtrace, ftrace, log,
syslog, simple & ust), while trace_event_get_state() only
validates state for backends using QEMU's internal state
tracking (ftrace, log, syslog, simple).

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 audio/audio-mixeng-be.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/audio/audio-mixeng-be.c b/audio/audio-mixeng-be.c
index f7d73d85608..60a4007817c 100644
--- a/audio/audio-mixeng-be.c
+++ b/audio/audio-mixeng-be.c
@@ -1179,7 +1179,7 @@ void audio_run(AudioMixengBackend *s, const char *msg)
     audio_run_in(s);
     audio_run_capture(s);
 
-    if (trace_event_get_state(TRACE_AUDIO_RUN_POLL)) {
+    if (trace_event_get_state_backends(TRACE_AUDIO_RUN_POLL)) {
         /* Convert seconds to microseconds for trace event */
         int64_t elapsed_us = g_timer_elapsed(s->run_timer, NULL) * MICROSECONDS_PER_SECOND;
         trace_audio_run_poll(msg, elapsed_us);
-- 
2.55.0



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

* [PATCH v3 18/24] hw/ppc: remove mistaken use of trace_event_get_state()
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (16 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 17/24] audio: remove mistaken use of trace_event_get_state() Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 19/24] monitor: " Daniel P. Berrangé
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Conditional checks must call trace_event_get_state_backends()
which checks the state of all backends (dtrace, ftrace, log,
syslog, simple & ust), while trace_event_get_state() only
validates state for backends using QEMU's internal state
tracking (ftrace, log, syslog, simple).

Furthermore, checking qemu_loglevel_mask() is inappropriate since
there are many trace backends, of which 'log' is only one.

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/ppc/vof.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index 873e967f1e4..e2ff9bf96a3 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -252,8 +252,7 @@ static uint32_t vof_getprop(const void *fdt, uint32_t nodeph, uint32_t pname,
              */
             ret = proplen;
             /* Do not format a value if tracepoint is silent, for performance */
-            if (trace_event_get_state(TRACE_VOF_GETPROP) &&
-                qemu_loglevel_mask(LOG_TRACE)) {
+            if (trace_event_get_state_backends(TRACE_VOF_GETPROP)) {
                 prop_format(trval, sizeof(trval), prop, ret);
             }
         }
@@ -337,8 +336,7 @@ static uint32_t vof_setprop(MachineState *ms, void *fdt, Vof *vof,
         goto trace_exit;
     }
 
-    if (trace_event_get_state(TRACE_VOF_SETPROP) &&
-        qemu_loglevel_mask(LOG_TRACE)) {
+    if (trace_event_get_state_backends(TRACE_VOF_SETPROP)) {
         prop_format(trval, sizeof(trval), val, vallen);
     }
     ret = vallen;
@@ -584,8 +582,7 @@ static uint32_t vof_write(Vof *vof, uint32_t ihandle, uint32_t buf,
         }
 
         /* FIXME: there is no backend(s) yet so just call a trace */
-        if (trace_event_get_state(TRACE_VOF_WRITE) &&
-            qemu_loglevel_mask(LOG_TRACE)) {
+        if (trace_event_get_state_backends(TRACE_VOF_WRITE)) {
             tmp[cb] = '\0';
             trace_vof_write(ihandle, cb, tmp);
         }
@@ -599,9 +596,7 @@ static void vof_claimed_dump(GArray *claimed)
     int i;
     OfClaimed c;
 
-    if (trace_event_get_state(TRACE_VOF_CLAIMED) &&
-        qemu_loglevel_mask(LOG_TRACE)) {
-
+    if (trace_event_get_state_backends(TRACE_VOF_CLAIMED)) {
         for (i = 0; i < claimed->len; ++i) {
             c = g_array_index(claimed, OfClaimed, i);
             trace_vof_claimed(c.start, c.start + c.size, c.size);
-- 
2.55.0



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

* [PATCH v3 19/24] monitor: remove mistaken use of trace_event_get_state()
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (17 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 18/24] hw/ppc: " Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 20/24] trace: include qemu_loglevel_mask(LOG_TRACE) in guard Daniel P. Berrangé
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Conditional checks must call trace_event_get_state_backends()
which checks the state of all backends (dtrace, ftrace, log,
syslog, simple & ust), while trace_event_get_state() only
validates state for backends using QEMU's internal state
tracking (ftrace, log, syslog, simple).

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 monitor/qmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/monitor/qmp.c b/monitor/qmp.c
index aec03157750..b5cc3ee1973 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -439,7 +439,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
 
         /* Process request */
         if (req_obj->req) {
-            if (trace_event_get_state(TRACE_MONITOR_QMP_CMD_IN_BAND)) {
+            if (trace_event_get_state_backends(TRACE_MONITOR_QMP_CMD_IN_BAND)) {
                 QDict *qdict = qobject_to(QDict, req_obj->req);
                 QObject *id = qdict ? qdict_get(qdict, "id") : NULL;
                 GString *id_json;
@@ -495,7 +495,7 @@ static void handle_qmp_command(void *opaque, QObject *req, Error *err)
 
     if (qdict && qmp_is_oob(qdict)) {
         /* OOB commands are executed immediately */
-        if (trace_event_get_state(TRACE_MONITOR_QMP_CMD_OUT_OF_BAND)) {
+        if (trace_event_get_state_backends(TRACE_MONITOR_QMP_CMD_OUT_OF_BAND)) {
             QObject *id = qdict_get(qdict, "id");
             GString *id_json;
 
-- 
2.55.0



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

* [PATCH v3 20/24] trace: include qemu_loglevel_mask(LOG_TRACE) in guard
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (18 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 19/24] monitor: " Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 21/24] trace: remove "disable" property from trace files Daniel P. Berrangé
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

If emitting a trace event requires computation for the parameters
passed to the probe, the callers should guard that computation
with trace_event_by_state_backends(), which is a macro expanding
to the a check of the "TRACE_...._DSTATE()" expression. For the
log backend this should include a check for LOG_TRACE being
present in the configured log level.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/backend/log.py | 24 +++++++++++++++++-----
 tests/tracetool/all.h            | 34 +++++++++++++++++++-------------
 tests/tracetool/all.rs           | 16 +++++++++++----
 tests/tracetool/log.h            | 20 +++++++++----------
 tests/tracetool/log.rs           |  6 ++++--
 5 files changed, 65 insertions(+), 35 deletions(-)

diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
index 577ee158584..4a622dd4dcb 100644
--- a/scripts/tracetool/backend/log.py
+++ b/scripts/tracetool/backend/log.py
@@ -16,7 +16,6 @@
 
 
 PUBLIC = True
-CHECK_TRACE_EVENT_GET_STATE = True
 
 
 def generate_h_begin(events, group):
@@ -29,11 +28,13 @@ def generate_h(event, group):
     if len(event.args) > 0:
         argnames = ", " + argnames
 
-    out('        if (qemu_loglevel_mask(LOG_TRACE)) {',
+    out('    if (trace_event_get_state(%(event_id)s) &&',
+        '        qemu_loglevel_mask(LOG_TRACE)) {',
         '#line %(event_lineno)d "%(event_filename)s"',
         '            qemu_log("%(name)s " %(fmt)s "\\n"%(argnames)s);',
         '#line %(out_next_lineno)d "%(out_filename)s"',
-        '        }',
+        '    }',
+        event_id="TRACE_" + event.name.upper(),
         event_lineno=event.lineno,
         event_filename=event.filename,
         name=event.name,
@@ -41,10 +42,23 @@ def generate_h(event, group):
         argnames=argnames)
 
 
+def generate_h_backend_dstate(event, group):
+    out('    (trace_event_get_state_dynamic_by_id(%(event_id)s) && \\',
+        '     qemu_loglevel_mask(LOG_TRACE)) || \\',
+        event_id="TRACE_" + event.name.upper())
+
 def generate_rs(event, group):
-    out('        let format_string = c"%(fmt)s\\n";',
+    out('    if trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) {',
+        '        let format_string = c"%(fmt)s\\n";',
         '        if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {',
         '            unsafe { bindings::qemu_log(format_string.as_ptr() as *const c_char, %(args)s);}',
         '        }',
+        '    }',
         fmt=expand_format_string(event.fmt, event.name + " "),
-        args=event.args.rust_call_varargs())
+        args=event.args.rust_call_varargs(),
+        event_id="TRACE_" + event.name.upper())
+
+def generate_rs_backend_dstate(event, group):
+    out('    unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0 &&',
+        '             trace_event_state_is_enabled(_%(event_id)s_DSTATE) } ||',
+        event_id="TRACE_" + event.name.upper())
diff --git a/tests/tracetool/all.h b/tests/tracetool/all.h
index 5627c1d8930..0ae2598eb1d 100644
--- a/tests/tracetool/all.h
+++ b/tests/tracetool/all.h
@@ -44,6 +44,8 @@ void _simple_trace_test_wibble(void *context, int value);
 
 #define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
     QEMU_TEST_BLAH_ENABLED() || \
+    (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) && \
+     qemu_loglevel_mask(LOG_TRACE)) || \
     tracepoint_enabled(qemu, test_blah) || \
     trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
     false)
@@ -51,25 +53,28 @@ void _simple_trace_test_wibble(void *context, int value);
 static inline void trace_test_blah(void *context, const char *filename)
 {
     QEMU_TEST_BLAH(context, filename);
+    if (trace_event_get_state(TRACE_TEST_BLAH) &&
+        qemu_loglevel_mask(LOG_TRACE)) {
+#line 4 "trace-events"
+            qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
+#line 61 "all.h"
+    }
     tracepoint(qemu, test_blah, context, filename);
     if (trace_event_get_state(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
-#line 59 "all.h"
-        if (qemu_loglevel_mask(LOG_TRACE)) {
-#line 4 "trace-events"
-            qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 63 "all.h"
-        }
+#line 67 "all.h"
         _simple_trace_test_blah(context, filename);
 #line 4 "trace-events"
         syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
-#line 68 "all.h"
+#line 71 "all.h"
     }
 }
 
 #define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
     QEMU_TEST_WIBBLE_ENABLED() || \
+    (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) && \
+     qemu_loglevel_mask(LOG_TRACE)) || \
     tracepoint_enabled(qemu, test_wibble) || \
     trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
     false)
@@ -77,20 +82,21 @@ static inline void trace_test_blah(void *context, const char *filename)
 static inline void trace_test_wibble(void *context, int value)
 {
     QEMU_TEST_WIBBLE(context, value);
+    if (trace_event_get_state(TRACE_TEST_WIBBLE) &&
+        qemu_loglevel_mask(LOG_TRACE)) {
+#line 5 "trace-events"
+            qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
+#line 90 "all.h"
+    }
     tracepoint(qemu, test_wibble, context, value);
     if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
-#line 85 "all.h"
-        if (qemu_loglevel_mask(LOG_TRACE)) {
-#line 5 "trace-events"
-            qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 89 "all.h"
-        }
+#line 96 "all.h"
         _simple_trace_test_wibble(context, value);
 #line 5 "trace-events"
         syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
-#line 94 "all.h"
+#line 100 "all.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/all.rs b/tests/tracetool/all.rs
index f48bdf4aab5..448ebce8281 100644
--- a/tests/tracetool/all.rs
+++ b/tests/tracetool/all.rs
@@ -37,6 +37,8 @@ fn trace_event_state_is_enabled(dstate: u8) -> bool {
 pub fn trace_test_blah_enabled() -> bool
 {
     (unsafe {qemu_test_blah_semaphore.get().read_volatile()}) != 0 ||
+    unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0 &&
+             trace_event_state_is_enabled(_TRACE_TEST_BLAH_DSTATE) } ||
     trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) ||
     false
 }
@@ -47,12 +49,14 @@ pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 {
     ::trace::probe!(qemu, test_blah, _context, _filename.as_ptr());
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
-        let format_string = c"test_blah Blah context=%p filename=%s\n";
-        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
         let format_string = c"test_blah Blah context=%p filename=%s\n";
         if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
             unsafe { bindings::qemu_log(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
         }
+    }
+    if trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) {
+        let format_string = c"test_blah Blah context=%p filename=%s\n";
+        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _filename.as_ptr());}
         extern "C" { fn _simple_trace_test_blah(_context: *mut (), _filename: *const std::ffi::c_char); }
         unsafe { _simple_trace_test_blah(_context, _filename.as_ptr()); }
         let format_string = c"test_blah Blah context=%p filename=%s";
@@ -65,6 +69,8 @@ pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 pub fn trace_test_wibble_enabled() -> bool
 {
     (unsafe {qemu_test_wibble_semaphore.get().read_volatile()}) != 0 ||
+    unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0 &&
+             trace_event_state_is_enabled(_TRACE_TEST_WIBBLE_DSTATE) } ||
     trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) ||
     false
 }
@@ -75,12 +81,14 @@ pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
 {
     ::trace::probe!(qemu, test_wibble, _context, _value);
     if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
-        let format_string = c"test_wibble Wibble context=%p value=%d\n";
-        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
         let format_string = c"test_wibble Wibble context=%p value=%d\n";
         if (unsafe { bindings::qemu_loglevel } & bindings::LOG_TRACE) != 0 {
             unsafe { bindings::qemu_log(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
         }
+    }
+    if trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) {
+        let format_string = c"test_wibble Wibble context=%p value=%d\n";
+        unsafe {bindings::ftrace_write(format_string.as_ptr() as *const c_char, _context /* as *mut () */, _value /* as std::ffi::c_int */);}
         extern "C" { fn _simple_trace_test_wibble(_context: *mut (), _value: std::ffi::c_int); }
         unsafe { _simple_trace_test_wibble(_context, _value); }
         let format_string = c"test_wibble Wibble context=%p value=%d";
diff --git a/tests/tracetool/log.h b/tests/tracetool/log.h
index ff510d54908..9957a854c00 100644
--- a/tests/tracetool/log.h
+++ b/tests/tracetool/log.h
@@ -16,32 +16,32 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 
 
 #define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
+    (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) && \
+     qemu_loglevel_mask(LOG_TRACE)) || \
     false)
 
 static inline void trace_test_blah(void *context, const char *filename)
 {
-    if (trace_event_get_state(TRACE_TEST_BLAH)) {
-        if (qemu_loglevel_mask(LOG_TRACE)) {
+    if (trace_event_get_state(TRACE_TEST_BLAH) &&
+        qemu_loglevel_mask(LOG_TRACE)) {
 #line 4 "trace-events"
             qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 29 "log.h"
-        }
+#line 30 "log.h"
     }
 }
 
 #define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
-    trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
+    (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) && \
+     qemu_loglevel_mask(LOG_TRACE)) || \
     false)
 
 static inline void trace_test_wibble(void *context, int value)
 {
-    if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
-        if (qemu_loglevel_mask(LOG_TRACE)) {
+    if (trace_event_get_state(TRACE_TEST_WIBBLE) &&
+        qemu_loglevel_mask(LOG_TRACE)) {
 #line 5 "trace-events"
             qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 44 "log.h"
-        }
+#line 45 "log.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/log.rs b/tests/tracetool/log.rs
index 0f052bb2c9c..1adb38597e3 100644
--- a/tests/tracetool/log.rs
+++ b/tests/tracetool/log.rs
@@ -27,7 +27,8 @@ fn trace_event_state_is_enabled(dstate: u8) -> bool {
 #[allow(dead_code)]
 pub fn trace_test_blah_enabled() -> bool
 {
-    trace_event_state_is_enabled(unsafe { _TRACE_TEST_BLAH_DSTATE}) ||
+    unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0 &&
+             trace_event_state_is_enabled(_TRACE_TEST_BLAH_DSTATE) } ||
     false
 }
 
@@ -47,7 +48,8 @@ pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
 #[allow(dead_code)]
 pub fn trace_test_wibble_enabled() -> bool
 {
-    trace_event_state_is_enabled(unsafe { _TRACE_TEST_WIBBLE_DSTATE}) ||
+    unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0 &&
+             trace_event_state_is_enabled(_TRACE_TEST_WIBBLE_DSTATE) } ||
     false
 }
 
-- 
2.55.0



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

* [PATCH v3 21/24] trace: remove "disable" property from trace files
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (19 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 20/24] trace: include qemu_loglevel_mask(LOG_TRACE) in guard Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 22/24] trace: stop tracking static disabled state Daniel P. Berrangé
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The scenarios are not significant enough to justify its use

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 hw/display/trace-events  |  2 +-
 target/hppa/trace-events | 28 ++++++++++++++--------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/hw/display/trace-events b/hw/display/trace-events
index c5e7e42af23..223a085922b 100644
--- a/hw/display/trace-events
+++ b/hw/display/trace-events
@@ -60,7 +60,7 @@ virtio_gpu_dec_inflight_fences(uint32_t inflight) "in-flight- %u"
 virtio_gpu_cmd_suspended(uint32_t cmd) "cmd 0x%x"
 
 # qxl.c
-disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u"
+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"
diff --git a/target/hppa/trace-events b/target/hppa/trace-events
index 01761a4559b..7c897610a9e 100644
--- a/target/hppa/trace-events
+++ b/target/hppa/trace-events
@@ -1,19 +1,19 @@
 # See docs/devel/tracing.rst for syntax documentation.
 
 # mem_helper.c
-disable hppa_tlb_flush_ent(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64
-disable hppa_tlb_find_entry(void *env, void *ent, int valid, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p valid=%d va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64
-disable hppa_tlb_find_entry_not_found(void *env, uint64_t addr) "env=%p addr=%08lx"
-disable hppa_tlb_get_physical_address(void *env, int ret, int prot, uint64_t addr, uint64_t phys) "env=%p ret=%d prot=%d addr=0x%lx phys=0x%lx"
-disable hppa_tlb_fill_excp(void *env, uint64_t addr, int size, int type, int mmu_idx) "env=%p addr=0x%lx size=%d type=%d mmu_idx=%d"
-disable hppa_tlb_fill_success(void *env, uint64_t addr, uint64_t phys, int size, int type, int mmu_idx) "env=%p addr=0x%lx phys=0x%lx size=%d type=%d mmu_idx=%d"
-disable hppa_tlb_itlba(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64
-disable hppa_tlb_itlbp(void *env, void *ent, int access_id, int u, int pl2, int pl1, int type, int b, int d, int t) "env=%p ent=%p access_id=%x u=%d pl2=%d pl1=%d type=%d b=%d d=%d t=%d"
-disable hppa_tlb_ptlb(void *env) "env=%p"
-disable hppa_tlb_ptlb_local(void *env) "env=%p"
-disable hppa_tlb_ptlbe(void *env) "env=%p"
-disable hppa_tlb_lpa_success(void *env, uint64_t addr, uint64_t phys) "env=%p addr=0x%lx phys=0x%lx"
-disable hppa_tlb_lpa_failed(void *env, uint64_t addr) "env=%p addr=0x%lx"
+hppa_tlb_flush_ent(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64
+hppa_tlb_find_entry(void *env, void *ent, int valid, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p valid=%d va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64
+hppa_tlb_find_entry_not_found(void *env, uint64_t addr) "env=%p addr=%08lx"
+hppa_tlb_get_physical_address(void *env, int ret, int prot, uint64_t addr, uint64_t phys) "env=%p ret=%d prot=%d addr=0x%lx phys=0x%lx"
+hppa_tlb_fill_excp(void *env, uint64_t addr, int size, int type, int mmu_idx) "env=%p addr=0x%lx size=%d type=%d mmu_idx=%d"
+hppa_tlb_fill_success(void *env, uint64_t addr, uint64_t phys, int size, int type, int mmu_idx) "env=%p addr=0x%lx phys=0x%lx size=%d type=%d mmu_idx=%d"
+hppa_tlb_itlba(void *env, void *ent, uint64_t va_b, uint64_t va_e, uint64_t pa) "env=%p ent=%p va_b=0x%lx va_e=0x%lx pa=0x%" PRIx64
+hppa_tlb_itlbp(void *env, void *ent, int access_id, int u, int pl2, int pl1, int type, int b, int d, int t) "env=%p ent=%p access_id=%x u=%d pl2=%d pl1=%d type=%d b=%d d=%d t=%d"
+hppa_tlb_ptlb(void *env) "env=%p"
+hppa_tlb_ptlb_local(void *env) "env=%p"
+hppa_tlb_ptlbe(void *env) "env=%p"
+hppa_tlb_lpa_success(void *env, uint64_t addr, uint64_t phys) "env=%p addr=0x%lx phys=0x%lx"
+hppa_tlb_lpa_failed(void *env, uint64_t addr) "env=%p addr=0x%lx"
 
 # op_helper.c
-disable hppa_tlb_probe(uint64_t addr, int level, int want) "addr=0x%lx level=%d want=%d"
+hppa_tlb_probe(uint64_t addr, int level, int want) "addr=0x%lx level=%d want=%d"
-- 
2.55.0



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

* [PATCH v3 22/24] trace: stop tracking static disabled state
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (20 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 21/24] trace: remove "disable" property from trace files Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 23/24] trace: remove parsing of "disable" event property Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 24/24] trace: remove 'trace_event_get_state' wrapper Daniel P. Berrangé
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The TraceEvent struct contains a "bool sstate" field which track whether
a trace event was disabled statically. i.e. at build time via the
"disable" property annotation in trace-events.

The only runtime use of this field is to let "trace-event-get-state"
report that an event is "unavailable" instead of reporting an error for
an unknown trace event.

Trace events are not ABI so their names can change and the event can
come and go at any time. Thus there is little utility in reporting the
existence of a disabled event that cannot ever be used at runtime.

Removing the "bool sstate" field from TraceEvent saves 8 bytes of
space in the struct, adding up to approx 64 KB across all current
events.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 qapi/trace.json               |  5 ++--
 scripts/tracetool/format/c.py |  2 --
 scripts/tracetool/format/h.py |  8 ------
 stubs/trace-control.c         |  1 -
 tests/tracetool/all.c         |  2 --
 tests/tracetool/all.h         | 14 +++++------
 tests/tracetool/dtrace.c      |  2 --
 tests/tracetool/dtrace.h      |  2 --
 tests/tracetool/ftrace.c      |  2 --
 tests/tracetool/ftrace.h      |  6 ++---
 tests/tracetool/log.c         |  2 --
 tests/tracetool/log.h         |  6 ++---
 tests/tracetool/nop.h         |  2 --
 tests/tracetool/simple.c      |  2 --
 tests/tracetool/simple.h      |  2 --
 tests/tracetool/syslog.c      |  2 --
 tests/tracetool/syslog.h      |  6 ++---
 tests/tracetool/ust.c         |  2 --
 tests/tracetool/ust.h         |  2 --
 trace/control-internal.h      |  6 -----
 trace/control-target.c        |  2 --
 trace/control.c               |  9 -------
 trace/control.h               | 18 +++-----------
 trace/event-internal.h        |  2 --
 trace/qmp.c                   | 47 ++++++++++-------------------------
 25 files changed, 30 insertions(+), 124 deletions(-)

diff --git a/qapi/trace.json b/qapi/trace.json
index 29c76256055..8533e378977 100644
--- a/qapi/trace.json
+++ b/qapi/trace.json
@@ -16,8 +16,6 @@
 # @TraceEventState:
 #     State of a tracing event.
 #
-# @unavailable: The event is statically disabled.
-#
 # @disabled: The event is dynamically disabled.
 #
 # @enabled: The event is dynamically enabled.
@@ -25,7 +23,7 @@
 # Since: 2.2
 ##
 { 'enum': 'TraceEventState',
-  'data': ['unavailable', 'disabled', 'enabled'] }
+  'data': ['disabled', 'enabled'] }
 
 ##
 # @TraceEventInfo:
@@ -69,6 +67,7 @@
 # @enable: Whether to enable tracing.
 #
 # @ignore-unavailable: Do not match unavailable events with @name.
+#      Deprecated: since 11.2
 #
 # Since: 2.2
 #
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 5f6669c917c..9f06894623e 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -39,12 +39,10 @@ def generate(events, backend, group):
                 '    .id = 0,',
                 '#endif',
                 '    .name = \"%(name)s\",',
-                '    .sstate = %(sstate)s,',
                 '    .dstate = &%(dstate)s',
                 '};',
                 event = e.api(e.QEMU_EVENT),
                 name = e.name,
-                sstate = "TRACE_%s_ENABLED" % e.name.upper(),
                 dstate = e.api(e.QEMU_DSTATE))
 
         out('TraceEvent *%(group)s_trace_events[] = {',
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 5ad3a419f82..544bbc0ba93 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -38,14 +38,6 @@ def generate(events, backend, group):
         for e in events:
             out('#define %s 0' % e.api(e.QEMU_DSTATE))
 
-    # static state
-    for e in events:
-        if 'disable' in e.properties:
-            enabled = 0
-        else:
-            enabled = 1
-        out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
-
     backend.generate_begin(events, group)
 
     for e in events:
diff --git a/stubs/trace-control.c b/stubs/trace-control.c
index 3f196835db0..6016307ed8b 100644
--- a/stubs/trace-control.c
+++ b/stubs/trace-control.c
@@ -14,7 +14,6 @@
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
 {
     bool state_pre;
-    assert(trace_event_get_state_static(ev));
 
     /*
      * We ignore the "vcpu" property here, since there's no target code. Then
diff --git a/tests/tracetool/all.c b/tests/tracetool/all.c
index 3b8d4d32d17..670f9f06e85 100644
--- a/tests/tracetool/all.c
+++ b/tests/tracetool/all.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/all.h b/tests/tracetool/all.h
index 0ae2598eb1d..01971827e4b 100644
--- a/tests/tracetool/all.h
+++ b/tests/tracetool/all.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 #ifndef SDT_USE_VARIADIC
 #define SDT_USE_VARIADIC 1
 #endif
@@ -57,17 +55,17 @@ static inline void trace_test_blah(void *context, const char *filename)
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 4 "trace-events"
             qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 61 "all.h"
+#line 59 "all.h"
     }
     tracepoint(qemu, test_blah, context, filename);
     if (trace_event_get_state(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
-#line 67 "all.h"
+#line 65 "all.h"
         _simple_trace_test_blah(context, filename);
 #line 4 "trace-events"
         syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
-#line 71 "all.h"
+#line 69 "all.h"
     }
 }
 
@@ -86,17 +84,17 @@ static inline void trace_test_wibble(void *context, int value)
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 5 "trace-events"
             qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 90 "all.h"
+#line 88 "all.h"
     }
     tracepoint(qemu, test_wibble, context, value);
     if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
-#line 96 "all.h"
+#line 94 "all.h"
         _simple_trace_test_wibble(context, value);
 #line 5 "trace-events"
         syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
-#line 100 "all.h"
+#line 98 "all.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/dtrace.c b/tests/tracetool/dtrace.c
index f83d06252ea..d51ba85503a 100644
--- a/tests/tracetool/dtrace.c
+++ b/tests/tracetool/dtrace.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/dtrace.h b/tests/tracetool/dtrace.h
index 0b5b47089e8..b9283851eb0 100644
--- a/tests/tracetool/dtrace.h
+++ b/tests/tracetool/dtrace.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 #ifndef SDT_USE_VARIADIC
 #define SDT_USE_VARIADIC 1
 #endif
diff --git a/tests/tracetool/ftrace.c b/tests/tracetool/ftrace.c
index f83d06252ea..d51ba85503a 100644
--- a/tests/tracetool/ftrace.c
+++ b/tests/tracetool/ftrace.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/ftrace.h b/tests/tracetool/ftrace.h
index b34eef17d10..4eba6b4d599 100644
--- a/tests/tracetool/ftrace.h
+++ b/tests/tracetool/ftrace.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 #include "trace/ftrace.h"
 
 
@@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)
     if (trace_event_get_state(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
-#line 28 "ftrace.h"
+#line 26 "ftrace.h"
     }
 }
 
@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)
     if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
-#line 41 "ftrace.h"
+#line 39 "ftrace.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/log.c b/tests/tracetool/log.c
index f83d06252ea..d51ba85503a 100644
--- a/tests/tracetool/log.c
+++ b/tests/tracetool/log.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/log.h b/tests/tracetool/log.h
index 9957a854c00..9afbe721a47 100644
--- a/tests/tracetool/log.h
+++ b/tests/tracetool/log.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 #include "qemu/log-for-trace.h"
 
 
@@ -26,7 +24,7 @@ static inline void trace_test_blah(void *context, const char *filename)
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 4 "trace-events"
             qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 30 "log.h"
+#line 28 "log.h"
     }
 }
 
@@ -41,7 +39,7 @@ static inline void trace_test_wibble(void *context, int value)
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 5 "trace-events"
             qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 45 "log.h"
+#line 43 "log.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/nop.h b/tests/tracetool/nop.h
index 64b6b005684..00771577943 100644
--- a/tests/tracetool/nop.h
+++ b/tests/tracetool/nop.h
@@ -8,8 +8,6 @@
 
 #define _TRACE_TEST_BLAH_DSTATE 0
 #define _TRACE_TEST_WIBBLE_DSTATE 0
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 
 #define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
     false)
diff --git a/tests/tracetool/simple.c b/tests/tracetool/simple.c
index 3b8d4d32d17..670f9f06e85 100644
--- a/tests/tracetool/simple.c
+++ b/tests/tracetool/simple.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/simple.h b/tests/tracetool/simple.h
index 735cb21d911..9b066364b0a 100644
--- a/tests/tracetool/simple.h
+++ b/tests/tracetool/simple.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 void _simple_trace_test_blah(void *context, const char *filename);
 void _simple_trace_test_wibble(void *context, int value);
 
diff --git a/tests/tracetool/syslog.c b/tests/tracetool/syslog.c
index f83d06252ea..d51ba85503a 100644
--- a/tests/tracetool/syslog.c
+++ b/tests/tracetool/syslog.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/syslog.h b/tests/tracetool/syslog.h
index 4203b8b37dc..6a9304489f6 100644
--- a/tests/tracetool/syslog.h
+++ b/tests/tracetool/syslog.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 #include <syslog.h>
 
 
@@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)
     if (trace_event_get_state(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
-#line 28 "syslog.h"
+#line 26 "syslog.h"
     }
 }
 
@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)
     if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
-#line 41 "syslog.h"
+#line 39 "syslog.h"
     }
 }
 #endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/ust.c b/tests/tracetool/ust.c
index f83d06252ea..d51ba85503a 100644
--- a/tests/tracetool/ust.c
+++ b/tests/tracetool/ust.c
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
     .id = 0,
 #endif
     .name = "test_blah",
-    .sstate = TRACE_TEST_BLAH_ENABLED,
     .dstate = &_TRACE_TEST_BLAH_DSTATE
 };
 TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
     .id = 0,
 #endif
     .name = "test_wibble",
-    .sstate = TRACE_TEST_WIBBLE_ENABLED,
     .dstate = &_TRACE_TEST_WIBBLE_DSTATE
 };
 TraceEvent *testsuite_trace_events[] = {
diff --git a/tests/tracetool/ust.h b/tests/tracetool/ust.h
index 079b2c74491..c6c5d6d7c1c 100644
--- a/tests/tracetool/ust.h
+++ b/tests/tracetool/ust.h
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
 extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
 extern uint8_t _TRACE_TEST_BLAH_DSTATE;
 extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
 #include <lttng/tracepoint.h>
 #include "trace-ust-testsuite.h"
 
diff --git a/trace/control-internal.h b/trace/control-internal.h
index f626b047264..9a95e6714bb 100644
--- a/trace/control-internal.h
+++ b/trace/control-internal.h
@@ -33,12 +33,6 @@ static inline const char * trace_event_get_name(TraceEvent *ev)
     return ev->name;
 }
 
-static inline bool trace_event_get_state_static(TraceEvent *ev)
-{
-    assert(ev != NULL);
-    return ev->sstate;
-}
-
 /* it's on fast path, avoid consistency checks (asserts) */
 #define trace_event_get_state_dynamic_by_id(id) \
     (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)
diff --git a/trace/control-target.c b/trace/control-target.c
index 87b0f5037df..348125a5822 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -12,8 +12,6 @@
 
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
 {
-    assert(trace_event_get_state_static(ev));
-
     bool state_pre = *ev->dstate;
     if (state_pre != state) {
         if (state) {
diff --git a/trace/control.c b/trace/control.c
index 947b220056a..d414b1a9072 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -167,15 +167,6 @@ static void do_trace_enable_events(const char *line_buf)
 
     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) {
-                warn_report("trace event '%s' is not traceable",
-                            line_ptr);
-                return;
-            }
-            continue;
-        }
-
         /* start tracing */
         trace_event_set_state_dynamic(ev, enable);
         if (!is_pattern) {
diff --git a/trace/control.h b/trace/control.h
index e77c07a8e68..80eb2bd14e6 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -107,13 +107,13 @@ static const char * trace_event_get_name(TraceEvent *ev);
  * impact.
  */
 #define trace_event_get_state(id)                       \
-    ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(id))
+    (trace_event_get_state_dynamic_by_id(id))
 
 /**
  * trace_event_get_state_backends:
  * @id: Event identifier name.
  *
- * Get the tracing state of an event, both static and dynamic state from all
+ * Get the tracing state of an event from all
  * compiled-in backends.
  *
  * If the event has the disabled property, the check will have no performance
@@ -123,18 +123,7 @@ static const char * trace_event_get_name(TraceEvent *ev);
  * does not have the disabled property.
  */
 #define trace_event_get_state_backends(id)              \
-    ((id ##_ENABLED) && id ##_BACKEND_DSTATE())
-
-/**
- * trace_event_get_state_static:
- * @id: Event identifier.
- *
- * Get the static tracing state of an event.
- *
- * Use the define 'TRACE_${EVENT_NAME}_ENABLED' for compile-time checks (it will
- * be set to 1 or 0 according to the presence of the disabled property).
- */
-static bool trace_event_get_state_static(TraceEvent *ev);
+    (id ##_BACKEND_DSTATE())
 
 /**
  * trace_event_get_state_dynamic:
@@ -148,7 +137,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev);
  *
  * Set the dynamic tracing state of an event.
  *
- * Pre-condition: trace_event_get_state_static(ev) == true
  */
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
 
diff --git a/trace/event-internal.h b/trace/event-internal.h
index ad1578aa2c5..40f06691063 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -14,7 +14,6 @@
  * TraceEvent:
  * @id: Unique event identifier.
  * @name: Event name.
- * @sstate: Static tracing state.
  * @dstate: Dynamic tracing state
  *
  * Opaque generic description of a tracing event.
@@ -24,7 +23,6 @@ typedef struct TraceEvent {
     uint32_t id;
 #endif
     const char * name;
-    const bool sstate;
     uint8_t *dstate;
 } TraceEvent;
 
diff --git a/trace/qmp.c b/trace/qmp.c
index 074a27b204f..331496a1471 100644
--- a/trace/qmp.c
+++ b/trace/qmp.c
@@ -11,9 +11,10 @@
 #include "qapi/error.h"
 #include "qapi/qapi-commands-trace.h"
 #include "control.h"
+#include "qemu/error-report.h"
 
 
-static bool check_events(bool ignore_unavailable, bool is_pattern,
+static bool check_events(bool is_pattern,
                          const char *name, Error **errp)
 {
     if (!is_pattern) {
@@ -24,27 +25,8 @@ static bool check_events(bool ignore_unavailable, bool is_pattern,
             error_setg(errp, "unknown event \"%s\"", name);
             return false;
         }
-
-        /* error for unavailable event */
-        if (!ignore_unavailable && !trace_event_get_state_static(ev)) {
-            error_setg(errp, "event \"%s\" is disabled", name);
-            return false;
-        }
-
-        return true;
-    } else {
-        /* error for unavailable events */
-        TraceEventIter iter;
-        TraceEvent *ev;
-        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));
-                return false;
-            }
-        }
-        return true;
     }
+    return true;
 }
 
 TraceEventInfoList *qmp_trace_event_get_state(const char *name,
@@ -56,7 +38,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
     bool is_pattern = trace_event_is_pattern(name);
 
     /* Check events */
-    if (!check_events(true, is_pattern, name, errp)) {
+    if (!check_events(is_pattern, name, errp)) {
         return NULL;
     }
 
@@ -68,14 +50,10 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
         value = g_new(TraceEventInfo, 1);
         value->name = g_strdup(trace_event_get_name(ev));
 
-        if (!trace_event_get_state_static(ev)) {
-            value->state = TRACE_EVENT_STATE_UNAVAILABLE;
+        if (trace_event_get_state_dynamic(ev)) {
+            value->state = TRACE_EVENT_STATE_ENABLED;
         } else {
-            if (trace_event_get_state_dynamic(ev)) {
-                value->state = TRACE_EVENT_STATE_ENABLED;
-            } else {
-                value->state = TRACE_EVENT_STATE_DISABLED;
-            }
+            value->state = TRACE_EVENT_STATE_DISABLED;
         }
         QAPI_LIST_PREPEND(events, value);
     }
@@ -91,18 +69,19 @@ void qmp_trace_event_set_state(const char *name, bool enable,
     TraceEvent *ev;
     bool is_pattern = trace_event_is_pattern(name);
 
+    if (has_ignore_unavailable && ignore_unavailable) {
+        warn_report_once("the 'ignore-unavailable' property is deprecated "
+                         "and has no effect");
+    }
+
     /* Check events */
-    if (!check_events(has_ignore_unavailable && ignore_unavailable,
-                      is_pattern, name, errp)) {
+    if (!check_events(is_pattern, name, errp)) {
         return;
     }
 
     /* Apply changes (all errors checked above) */
     trace_event_iter_init_pattern(&iter, name);
     while ((ev = trace_event_iter_next(&iter)) != NULL) {
-        if (!trace_event_get_state_static(ev)) {
-            continue;
-        }
         trace_event_set_state_dynamic(ev, enable);
     }
 }
-- 
2.55.0



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

* [PATCH v3 23/24] trace: remove parsing of "disable" event property
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (21 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 22/24] trace: stop tracking static disabled state Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  2026-10-05 12:08 ` [PATCH v3 24/24] trace: remove 'trace_event_get_state' wrapper Daniel P. Berrangé
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

Finish the removal of the "disable" event property by removing code
that parses properties and the backend code generators.

This "fixes" a bug in the UST backends which looked for a property
called "disabled" instead of "disable".

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 docs/devel/tracing.rst                       | 24 +++-------------
 scripts/tracetool/__init__.py                | 27 ++++--------------
 scripts/tracetool/backend/dtrace.py          |  2 --
 scripts/tracetool/format/c.py                |  9 ++----
 scripts/tracetool/format/d.py                |  3 --
 scripts/tracetool/format/h.py                | 30 +++++++++-----------
 scripts/tracetool/format/log_stap.py         |  3 --
 scripts/tracetool/format/rs.py               | 26 ++++++++---------
 scripts/tracetool/format/simpletrace_stap.py |  3 --
 scripts/tracetool/format/stap.py             |  3 --
 scripts/tracetool/format/ust_events_c.py     |  3 --
 scripts/tracetool/format/ust_events_h.py     |  3 --
 12 files changed, 39 insertions(+), 97 deletions(-)

diff --git a/docs/devel/tracing.rst b/docs/devel/tracing.rst
index f4557ee20e4..f94063587fa 100644
--- a/docs/devel/tracing.rst
+++ b/docs/devel/tracing.rst
@@ -366,30 +366,14 @@ To facilitate simple usage of systemtap where there merely needs to be printf
 logging of certain probes, a helper script "qemu-trace-stap" is provided.
 Consult its manual page for guidance on its usage.
 
-Trace event properties
+Trace event conditions
 ======================
 
-Each event in the "trace-events-all" file can be prefixed with a space-separated
-list of zero or more of the following event properties.
-
-"disable"
----------
-
-If a specific trace event is going to be invoked a huge number of times, this
-might have a noticeable performance impact even when the event is
-programmatically disabled.
-
-In this case you should declare such event with the "disable" property. This
-will effectively disable the event at compile time (by using the "nop" backend),
-thus having no performance impact at all on regular builds (i.e., unless you
-edit the "trace-events-all" file).
-
-In addition, there might be cases where relatively complex computations must be
+There might be cases where relatively complex computations must be
 performed to generate values that are only used as arguments for a trace
 function. In these cases you can use 'trace_event_get_state_backends()' to
-guard such computations, so they are skipped if the event has been either
-compile-time disabled or run-time disabled. If the event is compile-time
-disabled, this check will have no performance impact.
+guard such computations, so they are skipped if the event is not currently
+enabled:
 
 ::
 
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 6ed7cdd6ce4..bdbb06b5205 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -362,8 +362,6 @@ class Event(object):
         The event name.
     fmt : str
         The event format string.
-    properties : set(str)
-        Properties of the event.
     args : Arguments
         The event arguments.
     lineno : int
@@ -373,23 +371,18 @@ class Event(object):
 
     """
 
-    _CRE = re.compile(r"((?P<props>[\w\s]+)\s+)?"
-                      r"(?P<name>\w+)"
+    _CRE = re.compile(r"(?P<name>\w+)"
                       r"\((?P<args>[^)]*)\)"
                       r"\s*"
                       r"(?P<fmt>\".+)?"
                       r"\s*")
 
-    _VALID_PROPS = set(["disable"])
-
-    def __init__(self, name, props, fmt, args, lineno, filename):
+    def __init__(self, name, fmt, args, lineno, filename):
         """
         Parameters
         ----------
         name : string
             Event name.
-        props : list of str
-            Property names.
         fmt : str
             Event printing format string.
         args : Arguments
@@ -401,7 +394,6 @@ def __init__(self, name, props, fmt, args, lineno, filename):
 
         """
         self.name = name
-        self.properties = props
         self.fmt = fmt
         self.args = args
         self.lineno = int(lineno)
@@ -411,11 +403,6 @@ def __init__(self, name, props, fmt, args, lineno, filename):
             raise ValueError("Event '%s' has more than maximum permitted "
                              "argument count" % name)
 
-        unknown_props = set(self.properties) - self._VALID_PROPS
-        if len(unknown_props) > 0:
-            raise ValueError("Unknown properties: %s"
-                             % ", ".join(unknown_props))
-
 
     @staticmethod
     def build(line_str, lineno, filename):
@@ -435,7 +422,6 @@ def build(line_str, lineno, filename):
         groups = m.groupdict('')
 
         name = groups["name"]
-        props = groups["props"].split()
         fmt = groups["fmt"]
         if fmt.find("%m") != -1:
             raise ValueError("Event format '%m' is forbidden, pass the error "
@@ -448,14 +434,13 @@ def build(line_str, lineno, filename):
 
         args = Arguments.build(groups["args"])
 
-        return Event(name, props, fmt, args, lineno, posix_relpath(filename))
+        return Event(name, fmt, args, lineno, posix_relpath(filename))
 
     def __repr__(self):
         """Evaluable string representation for this object."""
-        return "Event('%s %s(%s) %s')" % (" ".join(self.properties),
-                                          self.name,
-                                          self.args,
-                                          self.fmt)
+        return "Event('%s(%s) %s')" % (self.name,
+                                       self.args,
+                                       self.fmt)
     # Star matching on PRI is dangerous as one might have multiple
     # arguments with that format, hence the non-greedy version of it.
     _FMT = re.compile(r"(%[\d\.]*\w+|%.*?PRI\S+)")
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index f0b58cc1585..6bce25c8d2d 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -79,8 +79,6 @@ def generate_rs_begin(events, group):
     # These are the Rust declarations of the .probes section semaphores
     # generated by dtrace(1) in its .o file output.
     for e in events:
-        if 'disable' in e.properties:
-            continue
         out('    #[allow(dead_code)]',
             f'    static qemu_{e.name}_semaphore: UnsafeCell<u16>;')
     out('}',
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 9f06894623e..3754c7e06fd 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -16,9 +16,6 @@
 
 
 def generate(events, backend, group):
-    active_events = [e for e in events
-                     if "disable" not in e.properties]
-
     header = "trace-" + group + ".h"
 
     out('/* This file is autogenerated by tracetool, do not edit. */',
@@ -62,7 +59,7 @@ def generate(events, backend, group):
             'trace_init(trace_%(group)s_register_events)',
             group = group.lower())
 
-        backend.generate_begin(active_events, group)
-        for event in active_events:
+        backend.generate_begin(events, group)
+        for event in events:
             backend.generate(event, group)
-        backend.generate_end(active_events, group)
+        backend.generate_end(events, group)
diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index e9e33dfe30a..df7780cb0af 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -30,9 +30,6 @@
 
 
 def generate(events, backend, group):
-    events = [e for e in events
-              if "disable" not in e.properties]
-
     # SystemTap's dtrace(1) warns about empty "provider qemu {}" but is happy
     # with an empty file.  Avoid the warning.
     # But dtrace on macOS can't deal with empty files.
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 544bbc0ba93..f719fe09397 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -46,14 +46,13 @@ def generate(events, backend, group):
             '#define %(api)s() ( \\',
             api=e.api(e.QEMU_BACKEND_DSTATE))
 
-        if "disable" not in e.properties:
-            backend.generate_backend_dstate(e, group, check_trace_event_get_state=False)
+        backend.generate_backend_dstate(e, group, check_trace_event_get_state=False)
 
-            if backend.check_trace_event_get_state:
-                event_id = 'TRACE_' + e.name.upper()
-                out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
-                    event_id=event_id)
-                backend.generate_backend_dstate(e, group, check_trace_event_get_state=True)
+        if backend.check_trace_event_get_state:
+            event_id = 'TRACE_' + e.name.upper()
+            out('    trace_event_get_state_dynamic_by_id(%(event_id)s) || \\',
+                event_id=event_id)
+            backend.generate_backend_dstate(e, group, check_trace_event_get_state=True)
 
         out('    false)')
 
@@ -63,16 +62,15 @@ def generate(events, backend, group):
             api=e.api(),
             args=e.args)
 
-        if "disable" not in e.properties:
-            backend.generate(e, group, check_trace_event_get_state=False)
+        backend.generate(e, group, check_trace_event_get_state=False)
 
-            if backend.check_trace_event_get_state:
-                event_id = 'TRACE_' + e.name.upper()
-                cond = "trace_event_get_state(%s)" % event_id
-                out('    if (%(cond)s) {',
-                        cond=cond)
-                backend.generate(e, group, check_trace_event_get_state=True)
-                out('    }')
+        if backend.check_trace_event_get_state:
+            event_id = 'TRACE_' + e.name.upper()
+            cond = "trace_event_get_state(%s)" % event_id
+            out('    if (%(cond)s) {',
+                cond=cond)
+            backend.generate(e, group, check_trace_event_get_state=True)
+            out('    }')
         out('}')
 
     backend.generate_end(events, group)
diff --git a/scripts/tracetool/format/log_stap.py b/scripts/tracetool/format/log_stap.py
index 259303a189d..3fa6c2dd3f2 100644
--- a/scripts/tracetool/format/log_stap.py
+++ b/scripts/tracetool/format/log_stap.py
@@ -90,9 +90,6 @@ def generate(events, backend, group):
         '')
 
     for event_id, e in enumerate(events):
-        if 'disable' in e.properties:
-            continue
-
         out('probe %(probeprefix)s.log.%(name)s = %(probeprefix)s.%(name)s ?',
             '{',
             probeprefix=probeprefix(),
diff --git a/scripts/tracetool/format/rs.py b/scripts/tracetool/format/rs.py
index 1fddcee1ad2..97d89a981da 100644
--- a/scripts/tracetool/format/rs.py
+++ b/scripts/tracetool/format/rs.py
@@ -52,11 +52,10 @@ def generate(events, backend, group):
             '{',
             api=e.api(e.QEMU_RUST_DSTATE))
 
-        if "disable" not in e.properties:
-            backend.generate_backend_dstate(e, group)
-            if backend.check_trace_event_get_state:
-                out('    trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) ||',
-                    event_id = 'TRACE_' + e.name.upper())
+        backend.generate_backend_dstate(e, group)
+        if backend.check_trace_event_get_state:
+            out('    trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) ||',
+                event_id = 'TRACE_' + e.name.upper())
 
         out('    false',
             '}',
@@ -68,15 +67,14 @@ def generate(events, backend, group):
             api=e.api(e.QEMU_TRACE),
             args=e.args.rust_decl())
 
-        if "disable" not in e.properties:
-            backend.generate(e, group, check_trace_event_get_state=False)
-            if backend.check_trace_event_get_state:
-                event_id = 'TRACE_' + e.name.upper()
-                out('    if trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) {',
-                    event_id = event_id,
-                    api=e.api())
-                backend.generate(e, group, check_trace_event_get_state=True)
-                out('    }')
+        backend.generate(e, group, check_trace_event_get_state=False)
+        if backend.check_trace_event_get_state:
+            event_id = 'TRACE_' + e.name.upper()
+            out('    if trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) {',
+                event_id = event_id,
+                api=e.api())
+            backend.generate(e, group, check_trace_event_get_state=True)
+            out('    }')
         out('}',
             '')
 
diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py
index c7bde97a855..393d85319c7 100644
--- a/scripts/tracetool/format/simpletrace_stap.py
+++ b/scripts/tracetool/format/simpletrace_stap.py
@@ -24,9 +24,6 @@ def generate(events, backend, group):
         '')
 
     for event_id, e in enumerate(events):
-        if 'disable' in e.properties:
-            continue
-
         out('probe %(probeprefix)s.simpletrace.%(name)s = %(probeprefix)s.%(name)s ?',
             '{',
             probeprefix=probeprefix(),
diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py
index 285c9203ba7..e3d16b72d34 100644
--- a/scripts/tracetool/format/stap.py
+++ b/scripts/tracetool/format/stap.py
@@ -34,9 +34,6 @@ def stap_escape(identifier):
 
 
 def generate(events, backend, group):
-    events = [e for e in events
-              if "disable" not in e.properties]
-
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '/* SPDX-License-Identifier: GPL-2.0-or-later */',
         '')
diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py
index 074226bfd37..93f88a03e90 100644
--- a/scripts/tracetool/format/ust_events_c.py
+++ b/scripts/tracetool/format/ust_events_c.py
@@ -16,9 +16,6 @@
 
 
 def generate(events, backend, group):
-    events = [e for e in events
-              if "disabled" not in e.properties]
-
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '/* SPDX-License-Identifier: GPL-2.0-or-later */',
         '',
diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index 76c883bc5c0..441e6a41933 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -16,9 +16,6 @@
 
 
 def generate(events, backend, group):
-    events = [e for e in events
-              if "disabled" not in e.properties]
-
     if group == "all":
         include = "trace-ust-all.h"
     else:
-- 
2.55.0



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

* [PATCH v3 24/24] trace: remove 'trace_event_get_state' wrapper
  2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
                   ` (22 preceding siblings ...)
  2026-10-05 12:08 ` [PATCH v3 23/24] trace: remove parsing of "disable" event property Daniel P. Berrangé
@ 2026-10-05 12:08 ` Daniel P. Berrangé
  23 siblings, 0 replies; 25+ messages in thread
From: Daniel P. Berrangé @ 2026-10-05 12:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau,
	Philippe Mathieu-Daudé, Stefan Hajnoczi,
	Daniel P. Berrangé

The 'trace_event_get_state' macro is a wrapper around the
'trace_event_get_state_dynamic_by_id' macro, which is a direct
check of the _TRACE_...._DSTATE global variable.

The only code that should be using this is the generated trace
probes, but the name looks rather appealing causing it to be
mistakenly used in other places, instead of the recommended
'trace_event_get_state_dynamic_backends'.

Removing the 'trace_event_get_state' macro reduces the potential
for confusion.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/tracetool/backend/__init__.py |  3 ++-
 scripts/tracetool/backend/log.py      |  2 +-
 scripts/tracetool/format/h.py         |  2 +-
 tests/tracetool/all.h                 |  8 ++++----
 tests/tracetool/ftrace.h              |  4 ++--
 tests/tracetool/log.h                 |  4 ++--
 tests/tracetool/simple.h              |  4 ++--
 tests/tracetool/syslog.h              |  4 ++--
 trace/control.h                       | 12 ------------
 9 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
index 72f549c77c4..2749c4e6315 100644
--- a/scripts/tracetool/backend/__init__.py
+++ b/scripts/tracetool/backend/__init__.py
@@ -26,7 +26,8 @@
                             considered "public".
 CHECK_TRACE_EVENT_GET_STATE If exists and is set to 'True', the backend-specific
                             code inside the tracepoint is emitted within an
-                            ``if trace_event_get_state()`` conditional.
+                            ``if trace_event_get_state_dynamic_by_id()``
+                            conditional.
 =========================== ====================================================
 
 
diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
index 4a622dd4dcb..00a0dd9c9dc 100644
--- a/scripts/tracetool/backend/log.py
+++ b/scripts/tracetool/backend/log.py
@@ -28,7 +28,7 @@ def generate_h(event, group):
     if len(event.args) > 0:
         argnames = ", " + argnames
 
-    out('    if (trace_event_get_state(%(event_id)s) &&',
+    out('    if (trace_event_get_state_dynamic_by_id(%(event_id)s) &&',
         '        qemu_loglevel_mask(LOG_TRACE)) {',
         '#line %(event_lineno)d "%(event_filename)s"',
         '            qemu_log("%(name)s " %(fmt)s "\\n"%(argnames)s);',
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index f719fe09397..ad4ce4414fe 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -66,7 +66,7 @@ def generate(events, backend, group):
 
         if backend.check_trace_event_get_state:
             event_id = 'TRACE_' + e.name.upper()
-            cond = "trace_event_get_state(%s)" % event_id
+            cond = "trace_event_get_state_dynamic_by_id(%s)" % event_id
             out('    if (%(cond)s) {',
                 cond=cond)
             backend.generate(e, group, check_trace_event_get_state=True)
diff --git a/tests/tracetool/all.h b/tests/tracetool/all.h
index 01971827e4b..d4c91cdd1a4 100644
--- a/tests/tracetool/all.h
+++ b/tests/tracetool/all.h
@@ -51,14 +51,14 @@ void _simple_trace_test_wibble(void *context, int value);
 static inline void trace_test_blah(void *context, const char *filename)
 {
     QEMU_TEST_BLAH(context, filename);
-    if (trace_event_get_state(TRACE_TEST_BLAH) &&
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) &&
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 4 "trace-events"
             qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
 #line 59 "all.h"
     }
     tracepoint(qemu, test_blah, context, filename);
-    if (trace_event_get_state(TRACE_TEST_BLAH)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
 #line 65 "all.h"
@@ -80,14 +80,14 @@ static inline void trace_test_blah(void *context, const char *filename)
 static inline void trace_test_wibble(void *context, int value)
 {
     QEMU_TEST_WIBBLE(context, value);
-    if (trace_event_get_state(TRACE_TEST_WIBBLE) &&
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) &&
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 5 "trace-events"
             qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
 #line 88 "all.h"
     }
     tracepoint(qemu, test_wibble, context, value);
-    if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
 #line 94 "all.h"
diff --git a/tests/tracetool/ftrace.h b/tests/tracetool/ftrace.h
index 4eba6b4d599..b55ee08bbfe 100644
--- a/tests/tracetool/ftrace.h
+++ b/tests/tracetool/ftrace.h
@@ -19,7 +19,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 
 static inline void trace_test_blah(void *context, const char *filename)
 {
-    if (trace_event_get_state(TRACE_TEST_BLAH)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
 #line 26 "ftrace.h"
@@ -32,7 +32,7 @@ static inline void trace_test_blah(void *context, const char *filename)
 
 static inline void trace_test_wibble(void *context, int value)
 {
-    if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
 #line 39 "ftrace.h"
diff --git a/tests/tracetool/log.h b/tests/tracetool/log.h
index 9afbe721a47..02bb1309e20 100644
--- a/tests/tracetool/log.h
+++ b/tests/tracetool/log.h
@@ -20,7 +20,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 
 static inline void trace_test_blah(void *context, const char *filename)
 {
-    if (trace_event_get_state(TRACE_TEST_BLAH) &&
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) &&
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 4 "trace-events"
             qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
@@ -35,7 +35,7 @@ static inline void trace_test_blah(void *context, const char *filename)
 
 static inline void trace_test_wibble(void *context, int value)
 {
-    if (trace_event_get_state(TRACE_TEST_WIBBLE) &&
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) &&
         qemu_loglevel_mask(LOG_TRACE)) {
 #line 5 "trace-events"
             qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
diff --git a/tests/tracetool/simple.h b/tests/tracetool/simple.h
index 9b066364b0a..0b9e7cba35c 100644
--- a/tests/tracetool/simple.h
+++ b/tests/tracetool/simple.h
@@ -20,7 +20,7 @@ void _simple_trace_test_wibble(void *context, int value);
 
 static inline void trace_test_blah(void *context, const char *filename)
 {
-    if (trace_event_get_state(TRACE_TEST_BLAH)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
         _simple_trace_test_blah(context, filename);
     }
 }
@@ -31,7 +31,7 @@ static inline void trace_test_blah(void *context, const char *filename)
 
 static inline void trace_test_wibble(void *context, int value)
 {
-    if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
         _simple_trace_test_wibble(context, value);
     }
 }
diff --git a/tests/tracetool/syslog.h b/tests/tracetool/syslog.h
index 6a9304489f6..173b35dcf69 100644
--- a/tests/tracetool/syslog.h
+++ b/tests/tracetool/syslog.h
@@ -19,7 +19,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
 
 static inline void trace_test_blah(void *context, const char *filename)
 {
-    if (trace_event_get_state(TRACE_TEST_BLAH)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
 #line 4 "trace-events"
         syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
 #line 26 "syslog.h"
@@ -32,7 +32,7 @@ static inline void trace_test_blah(void *context, const char *filename)
 
 static inline void trace_test_wibble(void *context, int value)
 {
-    if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
+    if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
 #line 5 "trace-events"
         syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
 #line 39 "syslog.h"
diff --git a/trace/control.h b/trace/control.h
index 80eb2bd14e6..0bcb34a6393 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -97,18 +97,6 @@ static uint32_t trace_event_get_id(TraceEvent *ev);
  */
 static const char * trace_event_get_name(TraceEvent *ev);
 
-/**
- * trace_event_get_state:
- * @id: Event identifier name.
- *
- * Get the tracing state of an event, both static and the QEMU dynamic state.
- *
- * If the event has the disabled property, the check will have no performance
- * impact.
- */
-#define trace_event_get_state(id)                       \
-    (trace_event_get_state_dynamic_by_id(id))
-
 /**
  * trace_event_get_state_backends:
  * @id: Event identifier name.
-- 
2.55.0



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

end of thread, other threads:[~2026-10-05 12:16 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 12:08 [PATCH v3 00/24] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 01/24] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 02/24] trace: use 'ignore_value()' instead of a dummy variable Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 03/24] trace: fix handling of char** in UST backend Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 04/24] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 05/24] trace: block use of "long int" " Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 06/24] trace: drop unused trace_event_set_state_dynamic_init() Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 07/24] trace: remove obsolete references to vcpu property Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 08/24] trace: drop 'id' from TraceEvent struct when not required Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 09/24] trace: change "DSTATE" variables from uint16_t to uint8_t Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 10/24] trace: add testing of 'nop' trace backend Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 11/24] trace: don't emit TraceEvent structs when 'nop' backend is used Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 12/24] trace: add test of generation with all backends enabled Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 13/24] trace: remove redundant headers from simple trace backend code Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 14/24] trace: include probe name in Rust format strings Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 15/24] trace: add missing newline in ftrace Rust format string Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 16/24] trace: eliminate dupe trace_event_get_state_dynamic_by_id() calls Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 17/24] audio: remove mistaken use of trace_event_get_state() Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 18/24] hw/ppc: " Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 19/24] monitor: " Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 20/24] trace: include qemu_loglevel_mask(LOG_TRACE) in guard Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 21/24] trace: remove "disable" property from trace files Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 22/24] trace: stop tracking static disabled state Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 23/24] trace: remove parsing of "disable" event property Daniel P. Berrangé
2026-10-05 12:08 ` [PATCH v3 24/24] trace: remove 'trace_event_get_state' wrapper Daniel P. Berrangé

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.