[RFC] virtio testing framework

2024-05-30 Thread Emil Tsalapatis
Hi everyone,

while developing a virtiofs kernel driver I have written a debug virtio
transport to test virtio drivers inside a VM without requiring nested
virtualization or support from the host. The transport allows paravirt
devices to be emulated in local userspace instead of a host, so we can
create paravirt devices and test them as necessary. For virtiofs in
particular, it allows us to reuse the existing FUSE tests since we can now
run both the virtiofs driver and the FUSE server (which is normally in the
host) in a single machine.

I have uploaded the WIP code [here ],
and an overview of the design [here
]. The
patch has a ways to go, and currently only supports virtio-blk device
emulation as a PoC, but feedback is welcome and appreciated. Please also
let me know if there is interest in using this for testing other virtio
devices apart from virtiofs.

--Emil


Re: [RFC] virtio testing framework

2024-05-30 Thread Emil Tsalapatis
Not sure about the followup, but the patch I describe in the original post
allows us to write and run tests for virtio drivers inside a VM. I
originally wrote this because we have tests for the virtiofs paravirt
device where we need to run both the paravirt driver and the device
emulation in the same machine. The virtio stack is not designed for this -
it expects the virtio driver to be running in the guest, and device
emulation to be running in the host. This patchset introduces a way to
emulate a virtio device in the guest for the purpose of running these
virtiofs tests. The links in the original email describe the design in more
detail, but just to reiterate, the code in this patch makes no functional
changes to existing code.

--Emil

On Thu, May 30, 2024 at 6:19 PM Mario Marietto 
wrote:

> Can someone explain to me what the purpose of what you are talking about ?
>
>
> On Thu, May 30, 2024 at 10:38 PM Tomek CEDRO  wrote:
>
>> Awesome!! Congrats :-)
>>
>> Here is some example of running NuttX RTOS on RV in a web browser using
>> TinyEMU + VirtIO :-)
>>
>> https://github.com/lupyuen/nuttx-tinyemu
>>
>> --
>> CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
>>
>> On Thu, May 30, 2024, 22:16 Emil Tsalapatis  wrote:
>>
>>> Hi everyone,
>>>
>>> while developing a virtiofs kernel driver I have written a debug
>>> virtio transport to test virtio drivers inside a VM without requiring
>>> nested virtualization or support from the host. The transport allows
>>> paravirt devices to be emulated in local userspace instead of a host, so we
>>> can create paravirt devices and test them as necessary. For virtiofs in
>>> particular, it allows us to reuse the existing FUSE tests since we can now
>>> run both the virtiofs driver and the FUSE server (which is normally in the
>>> host) in a single machine.
>>>
>>> I have uploaded the WIP code [here <https://reviews.freebsd.org/D45370>],
>>> and an overview of the design [here
>>> <https://gist.github.com/etsal/4280b6f16c1815d64ffda7ecce0b66f5>]. The
>>> patch has a ways to go, and currently only supports virtio-blk device
>>> emulation as a PoC, but feedback is welcome and appreciated. Please also
>>> let me know if there is interest in using this for testing other virtio
>>> devices apart from virtiofs.
>>>
>>> --Emil
>>>
>>
>
> --
> Mario.
>