qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QEMU Rust Crates + Plugins in Rust


From: Rowan Hart
Subject: QEMU Rust Crates + Plugins in Rust
Date: Wed, 9 Nov 2022 14:57:18 -0500

Hi all, this is my first post to the mailing list! I've spent the last
couple weeks building QEMU Rust crates to enable a couple goals:

- Install QEMU binaries using cargo, the Rust package manager
- Use git-latest QEMU binaries in Rust projects as a dependency
- Write QEMU TCG plugins entirely in Rust

The main crate is https://crates.io/crates/qemu, a thin wrapper around
the existing QEMU build system, using crate features to toggle
configure options. There are also crates for each binary build target,
for example https://crates.io/crates/qemu-system-x86_64. These
crates allow users to run `cargo install qemu-system-x86_64`, which
installs a small wrapper binary with a dependency on the built
binaries from the qemu crate. These binary installs run exactly as a
normal QEMU installation via package manager would, and essentially
just provide another alternative distro-agnostic packaging mechanism.

More interesting (I think) is the crate
https://github.com/novafacing/cannonball, which depends on the qemu
crate and enables developers
to write QEMU TCG plugins entirely in Rust. This enables a very nice
workflow for Rust developers interested in building tracers,
profilers, and
other tooling already supported by the TCG Plugin API. The cannonball
repository has one example of such a tracer that outputs various
events
as JSON.

This is a pretty rough implementation I've hacked together over a week
or two, but I've heard from IRC there is some interest in
experimenting
with Rust as part of QEMU and I'm interested in feedback on this
attempt in that direction.

There's a bit more information in my post about this on cohost:
https://cohost.org/novafacing/post/240422-some-qemu-and-plugi

Finally, I am acutely aware in doing this I've taken control of almost
70 crate names the QEMU project might like to use at some point. I'm
not
here to step on toes, so if the decision makers would like the QEMU
project to get control of these crate names, just let me know and I'll
email
the crates.io team about getting them moved. Otherwise, comments,
discussion about Rust-ifying QEMU and its plugins, ideas, and PRs
welcome,
as an author of a decent number of TCG plugins the last few years I'm
pretty excited about what even this rudimentary approach has enabled
with regards to ease of use and development speed.

-Rowan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]