From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH v3 09/24] trace: change "DSTATE" variables from uint16_t to uint8_t
Date: Mon, 5 Oct 2026 13:08:40 +0100 [thread overview]
Message-ID: <20261005120855.421973-10-berrange@redhat.com> (raw)
In-Reply-To: <20261005120855.421973-1-berrange@redhat.com>
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
next prev parent reply other threads:[~2026-10-05 12:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Daniel P. Berrangé [this message]
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é
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=20261005120855.421973-10-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@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.