From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH v2 20/20] trace: remove 'trace_event_get_state' wrapper
Date: Fri, 2 Oct 2026 10:52:32 +0100 [thread overview]
Message-ID: <20261002095232.3605567-21-berrange@redhat.com> (raw)
In-Reply-To: <20261002095232.3605567-1-berrange@redhat.com>
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>
---
monitor/qmp.c | 4 ++--
scripts/tracetool/backend/__init__.py | 3 ++-
scripts/tracetool/format/h.py | 2 +-
tests/tracetool/all.h | 4 ++--
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, 15 insertions(+), 26 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;
diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
index 9109a783c72..12bb91f5347 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/format/h.py b/scripts/tracetool/format/h.py
index af1482f6238..822740a3140 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -60,7 +60,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 6eed86edb4d..513f59d6ffb 100644
--- a/tests/tracetool/all.h
+++ b/tests/tracetool/all.h
@@ -54,7 +54,7 @@ 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)) {
+ 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 60 "all.h"
@@ -84,7 +84,7 @@ 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)) {
+ 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 89 "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 cf37ed3ce26..973b72ff87f 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)) {
if (qemu_loglevel_mask(LOG_TRACE)) {
#line 4 "trace-events"
qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
@@ -36,7 +36,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)) {
if (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
prev parent reply other threads:[~2026-10-02 9:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 9:52 [PATCH v2 00/20] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 01/20] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
2026-10-02 10:39 ` Markus Armbruster
2026-10-02 9:52 ` [PATCH v2 02/20] trace: use 'ignore_value()' instead of a dummy variable Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 03/20] trace: fix handling of char** in UST backend Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 04/20] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 05/20] trace: block use of "long int" " Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 06/20] trace: drop unused trace_event_set_state_dynamic_init() Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 07/20] trace: remove obsolete references to vcpu property Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 08/20] trace: drop 'id' from TraceEvent struct when not required Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 09/20] trace: change "DSTATE" variables from uint16_t to uint8_t Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 10/20] trace: add testing of 'nop' trace backend Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 11/20] trace: don't emit TraceEvent structs when 'nop' backend is used Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 12/20] trace: add test of generation with all backends enabled Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 13/20] trace: remove redundant headers from simple trace backend code Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 14/20] audio: remove mistaken use of trace_event_get_state() Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 15/20] hw/ppc: " Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 17/20] trace: remove "disable" property from trace files Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 18/20] trace: stop tracking static disabled state Daniel P. Berrangé
2026-10-02 9:52 ` [PATCH v2 19/20] trace: remove parsing of "disable" event property Daniel P. Berrangé
2026-10-02 9:52 ` Daniel P. Berrangé [this message]
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=20261002095232.3605567-21-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@oss.qualcomm.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.