All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
@ 2019-05-21 14:39 Peter Maydell
  2019-05-21 14:48 ` Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Maydell @ 2019-05-21 14:39 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Paolo Bonzini

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.)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
  2019-05-21 14:39 [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU? Peter Maydell
@ 2019-05-21 14:48 ` Paolo Bonzini
  2019-05-21 15:15 ` Marc-André Lureau
  2019-05-22 12:53 ` Stefan Hajnoczi
  2 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2019-05-21 14:48 UTC (permalink / raw)
  To: Peter Maydell, QEMU Developers

On 21/05/19 16:39, 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 have a version of QEMU's RCU that can be called from Rust code with a
nice API (https://github.com/bonzini/rust-rcu-qemu).  The idea was to
continue with a port of the memory API, and then to use rust-vmm's
virtio code.

Paolo

> (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.)
> 
> thanks
> -- PMM
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
  2019-05-21 14:39 [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU? Peter Maydell
  2019-05-21 14:48 ` Paolo Bonzini
@ 2019-05-21 15:15 ` Marc-André Lureau
  2019-05-22 12:53 ` Stefan Hajnoczi
  2 siblings, 0 replies; 6+ messages in thread
From: Marc-André Lureau @ 2019-05-21 15:15 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers

Hi Peter

On Tue, May 21, 2019 at 4:40 PM Peter Maydell <peter.maydell@linaro.org> 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 wrote slirp bindings, and a helper process that can be used by qemu
(https://github.com/elmarco/libslirp-rs &
https://www.redhat.com/archives/libvir-list/2019-April/msg01233.html).

I have done some experimentation slowly replacing slirp C code with
rust (https://gitlab.freedesktop.org/slirp/libslirp/issues/3). I
decided to try from scratch as well, using smoltcp. I have
dhcp/udp/tcp working to some extent so far (I keep in mind a future
libslirp compatible ABI, if needed).

-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
  2019-05-21 14:39 [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU? Peter Maydell
  2019-05-21 14:48 ` Paolo Bonzini
  2019-05-21 15:15 ` Marc-André Lureau
@ 2019-05-22 12:53 ` Stefan Hajnoczi
  2019-05-22 13:28   ` Paolo Bonzini
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2019-05-22 12:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, QEMU Developers, Sergio Lopez, Dr. David Alan Gilbert

[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]

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.

I'm more interested in using Rust for separate processes that can be
written from scratch.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
  2019-05-22 12:53 ` Stefan Hajnoczi
@ 2019-05-22 13:28   ` Paolo Bonzini
  2019-05-22 13:52     ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2019-05-22 13:28 UTC (permalink / raw)
  To: Stefan Hajnoczi, Peter Maydell
  Cc: QEMU Developers, Sergio Lopez, Dr. David Alan Gilbert

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.

Thanks,

Paolo

> I'm more interested in using Rust for separate processes that can be
> written from scratch.
> 
> Stefan
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
  2019-05-22 13:28   ` Paolo Bonzini
@ 2019-05-22 13:52     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2019-05-22 13:52 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Stefan Hajnoczi, QEMU Developers, Sergio Lopez, Peter Maydell

* Paolo Bonzini (pbonzini@redhat.com) 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 / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-22 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 14:39 [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU? Peter Maydell
2019-05-21 14:48 ` Paolo Bonzini
2019-05-21 15:15 ` Marc-André Lureau
2019-05-22 12:53 ` Stefan Hajnoczi
2019-05-22 13:28   ` Paolo Bonzini
2019-05-22 13:52     ` Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.