qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC-PATCH] Introducing virtio-example device.


From: Yoni Bettan
Subject: Re: [Qemu-devel] [RFC-PATCH] Introducing virtio-example device.
Date: Wed, 10 Apr 2019 18:45:14 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1


On 4/9/19 4:17 PM, Stefan Hajnoczi wrote:
On Mon, Apr 01, 2019 at 02:18:43PM +0300, Yoni Bettan wrote:
The main goal is to add an example device to Qemu to be used as template or
guideline for contributors when they wish to create a new virtio device.

Another reason for this device is to document "the right way" to write
a new virtio device in Qemu.

This device is a simple device and its functionality is to increase its input
by 1.

The device driver is located at:
https://github.com/ybettan/QemuDeviceDrivers.git

In addition I am writing a blog to give a logical overview of the virtio
protocol and a step-by-step guide to write a new virtio device.
This blog can be found at https://howtovms.wordpress.com.

scripts/checkpatch.pl have some errors do to "//" (old style one line comment),
those lines contains FIXMEs for the next version and will be removed.

Signed-off-by: Yoni Bettan <address@hidden>


Hi Stefan and thank you for your review.

Where is the specification for this device?  The lack of specification
is already not "the right way".



Another step in this process is to write a specification for this device. Since I am learning the virtio protocol while implementing this example device it was easier for me to start with the device and from there write its specification but take into consideration that the specification will be written soon.



There are multiple problems with the code, but the larger issue is that
this example device is just helping people shoot themselves in the foot
more easily.


If you can point me to those problem I will be glad so I can update the code and understand those problems you are talking about.



The difficulty with VIRTIO is not how to implement devices/drivers, it's
that people don't read the specification and therefore do not understand
the device model properly.  The spec is dry and missing information in
some places.  I think more accessible documentation, like your blog, can
help here.


As I said, the blog will be updated with explanations on each step of the communication between the device and the driver and the reason it is not there yet is because I preferred getting some reviews, make the code better and only then documenting "the write way" to not mislead peoples.



If you would like to educate people about VIRTIO, then explaining the
device model, lifecycle, how to change a device in a
backwards-compatible way, virtqueue semantics, etc are the topics that
deserve attention.

For someone who has learnt these topics, implementing the device/driver
is not hard.  For someone who doesn't understand these topics, no
example device will help.  At best they will copy-paste together
something that sort of works but has issues.


For me, reading the specification and even reading some code examples over the internet didn't made me understand it until I saw the related code so I agree with you it is not enough yet but all the other parts are on there way.


The final purpose is to have:

1. device specification

2. device implementation

3. device driver

4. blog

maybe I should have written it at the beginning, this is not the entire project but it is its start.



Stefan


Thanks again for your review.




reply via email to

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