From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Tanish Desai <tanishdesai37@gmail.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com,
Mads Ynddal <mads@ynddal.dk>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH v2 1/2] tracetool: add CHECK_TRACE_EVENT_GET_STATE
Date: Wed, 6 Aug 2025 20:13:03 +0100 [thread overview]
Message-ID: <aJOpG5XuWHYZUQ4c@redhat.com> (raw)
In-Reply-To: <20250806150539.2871-2-tanishdesai37@gmail.com>
On Wed, Aug 06, 2025 at 03:05:38PM +0000, Tanish Desai wrote:
> New attributed added in backends
> CHECK_TRACE_EVENT_GET_STATE which when
> present and is True wraps the code generated
> by generate function in check_trace_event_get_state
> check else it is outside the conditional block.
>
> Signed-off-by: Tanish Desai <tanishdesai37@gmail.com>
> ---
> scripts/tracetool/__init__.py | 1 -
> scripts/tracetool/backend/__init__.py | 26 ++++++++++++++++-------
> scripts/tracetool/format/h.py | 30 ++++++++++-----------------
> 3 files changed, 30 insertions(+), 27 deletions(-)
>
> diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
> index 2ae2e562d6..d0a02c45d7 100644
> --- a/scripts/tracetool/__init__.py
> +++ b/scripts/tracetool/__init__.py
> @@ -332,7 +332,6 @@ def formats(self):
> return self._FMT.findall(self.fmt)
>
> QEMU_TRACE = "trace_%(name)s"
> - QEMU_TRACE_NOCHECK = "_nocheck__" + QEMU_TRACE
This is just removing obsolete code
> QEMU_TRACE_TCG = QEMU_TRACE + "_tcg"
> QEMU_DSTATE = "_TRACE_%(NAME)s_DSTATE"
> QEMU_BACKEND_DSTATE = "TRACE_%(NAME)s_BACKEND_DSTATE"
> diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
> index ea126b07ea..0ceb49eef5 100644
> --- a/scripts/tracetool/format/h.py
> +++ b/scripts/tracetool/format/h.py
> @@ -59,33 +59,25 @@ def generate(events, backend, group):
>
> out(' false)')
>
> - # tracer without checks
> out('',
> 'static inline void %(api)s(%(args)s)',
> '{',
> - api=e.api(e.QEMU_TRACE_NOCHECK),
> + api=e.api(),
> args=e.args)
This bit is removing more obsolete code
>
> if "disable" not in e.properties:
> - backend.generate(e, group)
> -
> + backend.generate(e, group, check_trace_event_get_state=False)
> +
> + if backend.check_trace_event_get_state:
> + if "disable" not in e.properties:
> + 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('}')
This is the actual new functionality
>
> - cond = "true"
> -
> - out('',
> - 'static inline void %(api)s(%(args)s)',
> - '{',
> - ' if (%(cond)s) {',
> - ' %(api_nocheck)s(%(names)s);',
> - ' }',
> - '}',
> - api=e.api(),
> - api_nocheck=e.api(e.QEMU_TRACE_NOCHECK),
> - args=e.args,
> - names=", ".join(e.args.names()),
> - cond=cond)
> -
This is further obsolete code.
It is best to have new functionality added in a separate commit
from the removal of obsolete code.
I've co-incidentally got removal of this obsolete code in the
tracing test suite series I posted, so one will need to be
rebased on top of the other, depending on what order Stefan
wants to take the patches.
> backend.generate_end(events, group)
>
> out('#endif /* TRACE_%s_GENERATED_TRACERS_H */' % group.upper())
> --
> 2.34.1
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-08-06 19:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 15:05 [PATCH v2 0/2] tracetool: remove no_check_foo() and if(true){..} blocks Tanish Desai
2025-08-06 15:05 ` [PATCH v2 1/2] tracetool: add CHECK_TRACE_EVENT_GET_STATE Tanish Desai
2025-08-06 19:13 ` Daniel P. Berrangé [this message]
2025-08-07 10:35 ` Paolo Bonzini
2025-08-20 12:14 ` Daniel P. Berrangé
2025-08-07 19:23 ` Stefan Hajnoczi
2025-08-06 15:05 ` [PATCH v2 2/2] tracetool/format: remove redundent trace-event checks Tanish Desai
2025-08-06 16:53 ` Daniel P. Berrangé
2025-08-07 19:25 ` Stefan Hajnoczi
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=aJOpG5XuWHYZUQ4c@redhat.com \
--to=berrange@redhat.com \
--cc=mads@ynddal.dk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=tanishdesai37@gmail.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.