[PATCH/RFC] virtio_test: A module for testing virtio via userspace

Rusty Russell
Wed, 24 Jun 2009 03:40:34 -0000

On Fri, 19 Jun 2009 04:57:34 pm Christian Borntr?ger
wrote:
> Hello Rusty,
>
> this is a result of a two month internship about virtio testing.

Interesting!

> I would like to get feedback on
>
> o  the general idea of a virtio_test module
> o  the user interface ioctls
> o  further ideas and comments

Not mugging real drivers would be a requirement, I think.

> +config VIRTIO_TEST
> +	tristate "Virtio test driver (EXPERIMENTAL)"
> +	select VIRTIO
> +	select VIRTIO_RING

Perhaps these should be depends?  Plus, depends on EXPERIMENTAL.

> +	 If unsure, say M.

That's "N" I think.

> +	case VIOTEST_IOCGETBUF:
> +		ret = do_get_buf(vtest, (struct viotest_getbuf __user *) arg);
> +		break;
> +	case VIOTEST_IOCGETCBS:
> +		ret = get_callbacks(vtest, (struct viotest_cbinfo __user *) arg);
> +		break;

Generally the point of callbacks is to tell you you have new buffers; in fact
you're insulated from callbacks which don't show new buffers.  So
I'm not sure
these two need to be separate?

In which case, a read/write interface starts to make sense (write for addbuf
and kick, read for get_buf).  That fits nicely with O_NONBLOCK and poll().

Cheers,
Rusty.