From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Tanish Desai <tanishdesai37@gmail.com>,
qemu-devel@nongnu.org, Mads Ynddal <mads@ynddal.dk>
Subject: Re: [PATCH 2/3] trace/ftrace: seperate cold paths of tracing functions
Date: Thu, 5 Jun 2025 20:20:17 +0100 [thread overview]
Message-ID: <aEHt8cL9EAtM3jBm@redhat.com> (raw)
In-Reply-To: <03c067fc-2a47-4fc5-9204-1ac6ded4301b@redhat.com>
On Thu, Jun 05, 2025 at 08:49:36PM +0200, Paolo Bonzini wrote:
> On 6/5/25 20:37, Stefan Hajnoczi wrote:
> > On Thu, Jun 5, 2025 at 9:57 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
> > > > It's easier to understand the code generator and the generated code when
> > > > each trace event is implemented as a single function in the header file.
> > > > Splitting the trace event up adds complexity. I don't think this is a
> > > > step in the right direction.
> > >
> > > I am not sure I agree on that; something like
> > >
> > > static inline void trace_smmu_config_cache_inv(uint32_t sid)
> > > {
> > > if (trace_event_get_state(TRACE_SMMU_CONFIG_CACHE_INV)) {
> > > _simple__trace_smmu_config_cache_inv(sid);
> > > _log__trace_smmu_config_cache_inv(sid);
> > > }
> > > QEMU_SMMU_CONFIG_CACHE_INV(sid);
> > > tracepoint(qemu, smmu_config_cache_inv(sid));
> > > }
> > >
> > > and one function per backend seems the most readable way to format the
> > > code in the headers. I understand that most of the time you'll have
> > > only one backend enabled, but still the above seems pretty good and
> > > clarifies the difference between efficient backends like dtrace and UST
> > > and the others.
> > >
> > > This series doesn't go all the way to something like the above, but it
> > > does go in that direction.
> >
> > It's nice to share a single trace_event_get_state() conditional
> > between all backends that use it. There is no need to move the
> > generated code from .h into a .c file to achieve this though.
>
> Ok, I see what you mean. Personally I like that the backend code is
> completely out of sight and you only have a single line of code per backend;
> but it's a matter of taste I guess.
>
> > In the absence of performance data this patch series seems like
> > premature optimization and code churn to me.
> >
> > > Now, in all honesty the main reason to do this was to allow reusing the
> > > C code generator when it's Rust code that is using tracepoints; but I do
> > > believe that these changes make sense on their own, and I didn't want to
> > > make these a blocker for Rust enablement as well (Tanish has already
> > > looked into generating Rust code for the simple backend, for example).
> >
> > How is this patch series related to Rust tracing? If generated code
> > needs to be restructured so Rust can call it, then that's a strong
> > justification.
> Well, moving code to the .c file would make it possible to call it in Rust
> without duplicating code generation for the various backends (other than the
> "if" and function calls, of course, but those are easy). However, this is
> only handy and not absolutely necessary for the Rust tracing project.
This might work for some trace backends, but certainly for dtrace/systemtap
I'd expect us to use a native rust impl to get the optimal low overhead.
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-06-05 19:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-01 18:12 [PATCH 0/3] trace: seperate cold path of trace Tanish Desai
2025-06-01 18:12 ` [PATCH 1/3] trace/syslog: seperate cold paths of tracing functions Tanish Desai
2025-06-02 22:01 ` Stefan Hajnoczi
2025-06-05 3:02 ` Tanish Desai
2025-06-01 18:12 ` [PATCH 2/3] trace/ftrace: " Tanish Desai
2025-06-02 22:24 ` Stefan Hajnoczi
2025-06-05 13:57 ` Paolo Bonzini
2025-06-05 18:37 ` Stefan Hajnoczi
2025-06-05 18:49 ` Paolo Bonzini
2025-06-05 19:20 ` Daniel P. Berrangé [this message]
2025-06-05 21:24 ` Paolo Bonzini
2025-06-09 18:27 ` Stefan Hajnoczi
2025-06-09 18:50 ` Paolo Bonzini
2025-06-01 18:12 ` [PATCH 3/3] trace/log: seperate cold path " Tanish Desai
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=aEHt8cL9EAtM3jBm@redhat.com \
--to=berrange@redhat.com \
--cc=mads@ynddal.dk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--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 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).