All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 18/20] trace: stop tracking static disabled state
Date: Thu,  1 Oct 2026 16:12:26 +0100	[thread overview]
Message-ID: <20261001151228.3373747-19-berrange@redhat.com> (raw)
In-Reply-To: <20261001151228.3373747-1-berrange@redhat.com>

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.

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 de369dae6b5..a5aaf2cab0e 100644
--- a/qapi/trace.json
+++ b/qapi/trace.json
@@ -17,8 +17,6 @@
 #
 # State of a tracing event.
 #
-# @unavailable: The event is statically disabled.
-#
 # @disabled: The event is dynamically disabled.
 #
 # @enabled: The event is dynamically enabled.
@@ -26,7 +24,7 @@
 # Since: 2.2
 ##
 { 'enum': 'TraceEventState',
-  'data': ['unavailable', 'disabled', 'enabled'] }
+  'data': ['disabled', 'enabled'] }
 
 ##
 # @TraceEventInfo:
@@ -73,6 +71,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 6ffb7256e31..3ca92ba5fbe 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 a2c2d40388e..6eed86edb4d 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
@@ -59,16 +57,16 @@ 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 60 "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 64 "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"
     }
 }
 
@@ -89,16 +87,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 89 "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 93 "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 fe08277887f..cf37ed3ce26 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)
         if (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 27 "log.h"
         }
     }
 }
@@ -42,7 +40,7 @@ static inline void trace_test_wibble(void *context, int value)
         if (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 42 "log.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



  parent reply	other threads:[~2026-10-01 15:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 15:12 [PATCH 00/20] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 01/20] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 02/20] trace: use 'ignore_value()' instead of a dummy variable Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 03/20] trace: fix handling of char** in UST backend Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 04/20] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace Daniel P. Berrangé
2026-10-01 17:56   ` Philippe Mathieu-Daudé
2026-10-01 15:12 ` [PATCH 05/20] trace: block use of "long int" " Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 06/20] trace: drop unused trace_event_set_state_dynamic_init() Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 07/20] trace: remove obsolete references to vcpu property Daniel P. Berrangé
2026-10-01 17:58   ` Philippe Mathieu-Daudé
2026-10-01 15:12 ` [PATCH 08/20] trace: drop 'id' from TraceEvent struct when not required Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 09/20] trace: change "DSTATE" variables from uint16_t to uint8_t Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 10/20] trace: add testing of 'nop' trace backend Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 11/20] trace: don't emit TraceEvent structs when 'nop' backend is used Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 12/20] trace: add test of generation with all backends enabled Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 13/20] trace: remove redundant headers from simple trace backend code Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 14/20] audio: remove mistaken use of trace_event_get_state() Daniel P. Berrangé
2026-10-01 18:00   ` Philippe Mathieu-Daudé
2026-10-01 19:14   ` marcandre.lureau
2026-10-02  7:12     ` Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 15/20] hw/ppc: " Daniel P. Berrangé
2026-10-01 18:01   ` Philippe Mathieu-Daudé
2026-10-01 15:12 ` [PATCH 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard Daniel P. Berrangé
2026-10-02 10:45   ` Paolo Bonzini
2026-10-02 11:03     ` Daniel P. Berrangé
2026-10-02 14:49       ` Paolo Bonzini
2026-10-05 12:08         ` Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 17/20] trace: remove "disable" property from trace files Daniel P. Berrangé
2026-10-01 15:12 ` Daniel P. Berrangé [this message]
2026-10-01 19:14   ` [PATCH 18/20] trace: stop tracking static disabled state marcandre.lureau
2026-10-02  9:22     ` Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 19/20] trace: remove parsing of "disable" event property Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 20/20] trace: remove 'trace_event_get_state' wrapper Daniel P. Berrangé
2026-10-01 19:14 ` [PATCH 00/20] trace: bugfixes, cleanups and optimizations marcandre.lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261001151228.3373747-19-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.