tools/virtio: virtio_ring testing tool
Subsystems (2)
Michael S. Tsirkin
maintainerRFC PATCH 1/1 tools/virtio: virtio_ring testing tool
This implements a virtio simulator:
- adds stubs for enough support functions to compile virtio ring in userspace.
- Adds a stub vhost based module this can talk to.
This should help us decide things like which ring layout works best.
Communication is currently done using an eventfd descriptor. This means there's a shared spinlock there: what I would like to do in the future, is run this under kvm and use interrupt injection and io for communication, to make it more real-life and avoid lock contention.
This patchset applies on top of vhost-net-next branch in my tree. In particular you must have commits:
commit 64e1c80748afca3b4818ebb232a9668bf529886d
vhost-net: batch use/unuse mm
commit 533a19b4b88fcf81da3106b94f0ac4ac8b33a248
vhost: put mm after thread stop
I still haven't decided whether tools/virtio is a good place for this code. In particular I think it might make sense to move
at least the stub vhost_null module to drivers/vhost.
For development, it was nice to have everything under a single directory, though. Maybe move userspace somewhere there too?
I think it's probably best to keep this part of kernel tree, to avoid version skew and so we don't need to commit to any kind of API.
Comments?
--- tools/virtio/Makefile | 11 ++ tools/virtio/linux/device.h | 2 + tools/virtio/linux/slab.h | 2 + tools/virtio/linux/virtio.h | 223 ++++++++++++++++++++++++++ tools/virtio/vhost_null/Makefile | 3 + tools/virtio/vhost_null/null.c | 320 ++++++++++++++++++++++++++++++++++++++ tools/virtio/vhost_null/null.h | 7 + tools/virtio/virtio_test.c | 198 +++++++++++++++++++++++ 8 files changed, 766 insertions(+), 0 deletions(-) create mode 100644 tools/virtio/Makefile create mode 100644 tools/virtio/linux/device.h create mode 100644 tools/virtio/linux/slab.h create mode 100644 tools/virtio/linux/virtio.h create mode 100644 tools/virtio/vhost_null/Makefile create mode 100644 tools/virtio/vhost_null/null.c create mode 100644 tools/virtio/vhost_null/null.h create mode 100644 tools/virtio/virtio_test.c
tools/virtio/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +all: test mod +test: virtio_test +virtio_test: virtio_ring.o virtio_test.o +CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -MMD +vpath %.c ../../drivers/virtio +mod: + ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_null +.PHONY: all test mod clean +clean: + ${RM} *.o vhost_null/*.o vhost_null/.*.cmd *.d +-include *.d
tools/virtio/linux/device.h new file +2 -0
@@ -0,0 +1,2 @@ +#ifndef LINUX_DEVICE_H +#endif
tools/virtio/linux/slab.h new file +2 -0
@@ -0,0 +1,2 @@ +#ifndef LINUX_SLAB_H +#endif
tools/virtio/linux/virtio.h new file +223 -0
223 lines not on this page · raw message
tools/virtio/vhost_null/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-m += vhost_null.o +vhost_null-y := null.o +EXTRA_CFLAGS += -Idrivers/vhost
tools/virtio/vhost_null/null.c new file +320 -0
320 lines not on this page · raw message
tools/virtio/vhost_null/null.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef LINUX_VHOST_NULL_H +#define LINUX_VHOST_NULL_H + +/* Start a given test on the virtio null device. 0 stops all tests. */ +#define VHOST_NULL_RUN _IOW(VHOST_VIRTIO, 0x31, int) + +#endif
tools/virtio/virtio_test.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
1.7.3.2.91.g446ac
Hi Michael
2010/11/24 Michael S. Tsirkin <[email protected]>:
Quoted 26 lines · अनुज
Quoted 25 lines
Hi Michael,
Quoted 4 lines
This implements a virtio simulator:
- adds stubs for enough support functions to compile virtio ring in userspace.
- Adds a stub vhost based module this can talk to.I just want to know can I use this virtio simulator in this case :
1. using qemu-kvm as a VMM on Linux Host.
2. using a proprietary OS as a guest.I am developing virtio framework and virtio drivers (network & SCSI/Block) for this guest OS.
Please explain how can I use this virtio simulator for testing and optimizing my virtio framework and virtio drivers.
And also please let me know whether I can compile and test my virtio things without using Guest OS.Thanks a lot.
Regards,
--
Anuj Aggarwal
Quoted 7 lines
Quoted 4 lines
.''`.
: :Ⓐ : # apt-get install hakuna-matata.'`
`-Please copy all mail related to virtio to
[email protected]
I will take care of this in future.
Quoted 6 lines
Thanks!
--
MST
Regards,
Signature · 10 lines
Anuj Aggarwal .''`. : :Ⓐ : # apt-get install hakuna-matata `. `'` `- _______________________________________________ Virtualization mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 20 lines · अनुज
Hi Michael
2010/11/24 Michael S. Tsirkin <[email protected]>:
Quoted 17 lines · अनुज
Quoted 16 lines
Hi Michael,
Quoted 4 lines
This implements a virtio simulator:
- adds stubs for enough support functions to compile virtio ring in userspace.
- Adds a stub vhost based module this can talk to.I just want to know can I use this virtio simulator in this case :
1. using qemu-kvm as a VMM on Linux Host.
2. using a proprietary OS as a guest.I am developing virtio framework and virtio drivers (network & SCSI/Block) for this guest OS.
Please explain how can I use this virtio simulator for testing and optimizing my virtio framework and virtio drivers.
What this tool includes is
1. virtio ring bits from linux guest compiled in userspace tools/virtio/linux/
2. virtio host bits compiled as a linux kernel module tools/virtio/vhost_null
3. some bits to connect the two and test tools/virtio/virtio_test.c
I'm using it to tune linux guest and host code.
If you have some other guest code, you could still use the module (2), and if you make the API compatible, possibly reuse the test (3) parts of it. It would be nice if you publish changes to the common files, if any, on the list.
If you want to distribute the result, the rules for this are in the file COPYING under the linux source tree.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
And also please let me know whether I can compile and test my virtio things without using Guest OS.
No idea.
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Thanks a lot.
Regards,
--
Anuj AggarwalQuoted 7 lines
Quoted 4 lines
.''`.
: :Ⓐ : # apt-get install hakuna-matata.'`
`-Please copy all mail related to virtio to
[email protected]I will take care of this in future.
Quoted 1 line
Quoted 19 lines
Quoted 5 lines
Thanks!
--
MSTRegards,
Signature · 10 lines
Anuj Aggarwal .''`. : :Ⓐ : # apt-get install hakuna-matata `. `'` `- _______________________________________________ Virtualization mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization