qemu-devel
[Top][All Lists]
Advanced

[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: Paolo Bonzini
Subject: Re: [Qemu-devel] is anybody experimenting with the idea of rust code in QEMU?
Date: Wed, 22 May 2019 15:28:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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
> 




reply via email to

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