qemu-rust.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	alex.bennee@linaro.org
Subject: Re: [PATCH RFC 0/5] rust: implement tracing
Date: Wed, 6 Aug 2025 11:02:53 +0200	[thread overview]
Message-ID: <ad404bb4-93fb-4a27-995f-734e647c1da0@redhat.com> (raw)
In-Reply-To: <CAAjaMXYhWsWPoDdfoNyTGrJSRfiYJDqBkv8fC87+Zi3YCtU06Q@mail.gmail.com>

On 8/5/25 22:06, Manos Pitsidianakis wrote:
>> If you're thinking this is all rather complicated, you'd be right,
>> which is why for initial feature parity I figured the simplest is
>> likely to just wrap the existing QEMU inline probe function, so
>> Rust doesn't need to know about the different backends... yet...

It's not too hard to add individual backends (other than dtrace---see 
below--and ust which doesn't build for me(*) and I wanted to deprecate). 
  Tanish is pretty close to being able to post initial work.

> Yes, that indeed makes sense.  Generated C trace headers statically
> linked to a standalone trace crate library for each subsystem, that
> rust qemu crates can link to in return is the cleanest solution for
> this approach IMHO, because doing this kind of codegen via macros
> needs interaction with meson to generate the C sources and then run
> bindgen all while compiling this one crate which is a single meson lib
> target.
> 
> It might be possible to generate the equivalent of the C code for each
> backend just like this RFC generates only the log backend code, I'll
> take a look out of curiosity...
>
>> FWIW, the original DTrace authors created a Rust crate with native
>> rust integration of dynamic probes.
>>
>>    https://github.com/oxidecomputer/usdt
>>
>> I think that (somehow) we probably want to integrate that with QEMU
>> and its tracetool.

This unfortunately only works for macOS and Solaris.  It also has quite 
a few dependencies (~25) on other crates.  There is also a "probe" crate 
(https://github.com/cuviper/probe-rs) that is minimal and (currently) 
specific to Linux, which is what I planned to use.

By the way, while I like the idea of using Rust format strings, there 
are parts of tracetool (e.g. format/log_stap.py) that need the printf 
strings, and also backends (e.g. backend/syslog.py) that call into libc 
and therefore need to use printf format strings.  So I think we're stuck.

Paolo

(*) that's because this tracepoint:

visit_type_str(void *v, const char *name, char **obj) "v=%p name=%s obj=%p

incorrectly handles 'char **' as a string.  The breakage has been there 
since 2016, though probably it's only more recent versions of ust that 
actually fail to compile and until then the bug was latent until you 
enabled this tracepoint.  But it seems unlikely that anyone has used the 
ust backend recently.



  reply	other threads:[~2025-08-06  9:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 13:47 [PATCH RFC 0/5] rust: implement tracing Manos Pitsidianakis
2025-08-04 13:47 ` [PATCH RFC 1/5] rust/bindings: add trace headers Manos Pitsidianakis
2025-08-04 13:47 ` [PATCH RFC 2/5] rust/qemu-api/log: add Log::Trace variant Manos Pitsidianakis
2025-08-04 13:47 ` [PATCH RFC 3/5] rust/qemu-api-macros: Add #[trace_events] macro Manos Pitsidianakis
2025-08-04 13:47 ` [PATCH RFC 4/5] rust/pl011: impl Copy, Clone for RegisterOffset Manos Pitsidianakis
2025-08-04 13:47 ` [PATCH RFC 5/5] rust/pl011: add trace events Manos Pitsidianakis
2025-08-05 16:04 ` [PATCH RFC 0/5] rust: implement tracing Daniel P. Berrangé
2025-08-05 16:25   ` Manos Pitsidianakis
2025-08-05 16:43     ` Daniel P. Berrangé
2025-08-05 16:47       ` Manos Pitsidianakis
2025-08-05 17:54         ` Daniel P. Berrangé
2025-08-05 20:06           ` Manos Pitsidianakis
2025-08-06  9:02             ` Paolo Bonzini [this message]
2025-08-06  9:21               ` Daniel P. Berrangé
2025-08-06  9:34                 ` Manos Pitsidianakis
2025-08-06  9:36               ` Manos Pitsidianakis

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=ad404bb4-93fb-4a27-995f-734e647c1da0@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-rust@nongnu.org \
    /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).