[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] is anybody experimenting with the idea of rust code in
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU? |
Date: |
Wed, 22 May 2019 14:52:03 +0100 |
User-agent: |
Mutt/1.11.4 (2019-03-13) |
* Paolo Bonzini (address@hidden) wrote:
> On 22/05/19 14:53, Stefan Hajnoczi wrote:
> > On Tue, May 21, 2019 at 03:39:40PM +0100, Peter Maydell wrote:
> >> Hi; I have on my todo list the idea of some experimentation/prototyping
> >> of whether being able to write some components of QEMU in Rust would
> >> be (a) feasible (b) beneficial (c) fun to play around with even if
> >> it is likely that it doesn't go anywhere :-)
> >>
> >> I know Paolo has had a look at how you might write some makefiles
> >> to integrate rust into a C program
> >> (https://github.com/bonzini/rust-and-c/).
> >> Has anybody else been doing anything in this general area ?
> >>
> >> (I went to two good talks locally recently about rust-vmm and Amazon's
> >> 'firecracker' VMM by Andreea Florescu and Diana Popa -- I
> >> definitely plan to look at rust-vmm as part of this.)
> >
> > There are some in-development vhost-user device backends in Rust.
> > Sergio Lopez is working on a vhost-user-blk implementation. David
> > Gilbert is working on a vhost-user-fs implementation.
> >
> > I think mixing Rust and C code in the main QEMU binary itself is
> > probably more trouble than it's worth. Think boilerplate, duplication,
> > coming up with safe Rust APIs for QEMU's unsafe APIs.
>
> This is true. The case I was playing with is where the QEMU APIs have a
> more or less direct mapping to rust-vmm APIs and only have a limited
> number of dependencies on other C APIs. This way, you can either write
> a Rust binding to the C code, or rewrite the C code in Rust with tiny C
> wrapper APIs on top.
>
> For example, the memory API (more or less) depends only on RCU and maps
> to rust-vmm/vm-memory, and virtqueue processing in rust-vmm/vm-virtio
> depends only on the memory API.
The other place might be places where we're autogenerating the C
interfaces anyway - e.g. we could autogenerate rust bindings for qapi.
Dave
> Thanks,
>
> Paolo
>
> > I'm more interested in using Rust for separate processes that can be
> > written from scratch.
> >
> > Stefan
> >
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK