All of lore.kernel.org
 help / color / mirror / Atom feed
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 23/24] trace: remove parsing of "disable" event property
Date: Mon,  5 Oct 2026 13:08:54 +0100	[thread overview]
Message-ID: <20261005120855.421973-24-berrange@redhat.com> (raw)
In-Reply-To: <20261005120855.421973-1-berrange@redhat.com>

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



  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 ` [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 ` Daniel P. Berrangé [this message]
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-24-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.