From: "Alex Bennée" <alex.bennee@linaro.org>
To: Tanish Desai <tanishdesai37@gmail.com>
Cc: qemu-devel@nongnu.org, "Lluís Vilanova" <vilanova@ac.upc.edu>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mads Ynddal" <mads@ynddal.dk>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [PATCH 2/3] tracetool: introduce generate_unconditional
Date: Tue, 17 Jun 2025 23:42:11 +0100 [thread overview]
Message-ID: <87zfe6t2gs.fsf@draig.linaro.org> (raw)
In-Reply-To: <20250616201222.6416-3-tanishdesai37@gmail.com> (Tanish Desai's message of "Mon, 16 Jun 2025 20:12:21 +0000")
Tanish Desai <tanishdesai37@gmail.com> writes:
> This patch separates the generation logic of trace_foo() for the UST and DTrace backends from other backends.
> The motivation is to remove the unnecessary if (true) in the _no_check function, as UST and DTrace do not require a trace_event_get_state check without introducing a seperate function it is very difficult to generate code which keeps them out of unified if condition.
> With this separation, we can safely move the trace_event_get_state check into trace_foo for the other backends only, keeping UST/DTrace generation paths clean.
> A new generate_h_unconditional function has been introduced for UST
> and DTrace. It behaves similarly to generate_h, but is defined only in
> UST and DTrace backends. This ensures that generate_h is used by the
> other backends, while UST/DTrace selectively use
> generate_h_unconditional.
Please fix the word wrap on the commit at 78 chars.
>
> Signed-off-by: Tanish Desai <tanishdesai37@gmail.com>
> ---
> scripts/tracetool/backend/__init__.py | 3 +++
> scripts/tracetool/backend/dtrace.py | 3 ++-
> scripts/tracetool/backend/ust.py | 2 +-
> scripts/tracetool/format/h.py | 10 +++++++---
> 4 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
> index 7bfcc86cc5..c4456a5efd 100644
> --- a/scripts/tracetool/backend/__init__.py
> +++ b/scripts/tracetool/backend/__init__.py
> @@ -118,6 +118,9 @@ def generate_begin(self, events, group):
> def generate(self, event, group):
> self._run_function("generate_%s", event, group)
>
> + def generate_unconditional(self, event, group):
> + self._run_function("generate_%s_unconditional", event, group)
> +
> def generate_backend_dstate(self, event, group):
> self._run_function("generate_%s_backend_dstate", event, group)
>
> diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
> index e17edc9b9d..171b7e09ed 100644
> --- a/scripts/tracetool/backend/dtrace.py
> +++ b/scripts/tracetool/backend/dtrace.py
> @@ -61,7 +61,8 @@ def generate_h_begin(events, group):
> '#endif',
> uppername=e.name.upper())
>
> -def generate_h(event, group):
> +
stray newline
> +def generate_h_unconditional(event, group):
> out(' QEMU_%(uppername)s(%(argnames)s);',
> uppername=event.name.upper(),
> argnames=", ".join(event.args.names()))
> diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py
> index c857516f21..1564b490ec 100644
> --- a/scripts/tracetool/backend/ust.py
> +++ b/scripts/tracetool/backend/ust.py
> @@ -30,7 +30,7 @@ def generate_h_begin(events, group):
> '')
>
>
> -def generate_h(event, group):
> +def generate_h_unconditional(event, group):
> argnames = ", ".join(event.args.names())
> if len(event.args) > 0:
> argnames = ", " + argnames
> diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
> index ea126b07ea..89d54b9aff 100644
> --- a/scripts/tracetool/format/h.py
> +++ b/scripts/tracetool/format/h.py
> @@ -76,13 +76,17 @@ def generate(events, backend, group):
> out('',
> 'static inline void %(api)s(%(args)s)',
> '{',
> - ' if (%(cond)s) {',
> + api=e.api(),
> + args=e.args)
> +
> + if "disable" not in e.properties:
> + backend.generate_unconditional(e, group)
> +
> + out(' 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)
Otherwise:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2025-06-17 22:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 20:12 [PATCH 0/3] tracetool:cleanup "if(true)" check from trace_foo() Tanish Desai
2025-06-16 20:12 ` [PATCH 1/3] tracetool: removed the unused vcpu property Tanish Desai
2025-06-17 14:07 ` Stefan Hajnoczi
2025-06-17 18:36 ` [PATCH v2] " Tanish Desai
2025-06-17 19:43 ` [PATCH 1/3] " Alex Bennée
2025-06-16 20:12 ` [PATCH 2/3] tracetool: introduce generate_unconditional Tanish Desai
2025-06-17 22:42 ` Alex Bennée [this message]
2025-06-18 16:23 ` Tanish Desai
2025-06-16 20:12 ` [PATCH 3/3] tracetool: remove redundant event_get_state checks Tanish Desai
2025-06-17 14:09 ` [PATCH 0/3] tracetool:cleanup "if(true)" check from trace_foo() 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=87zfe6t2gs.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=mads@ynddal.dk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=tanishdesai37@gmail.com \
--cc=vilanova@ac.upc.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).