Skip to content

Commit

Permalink
tools/virtio: add vring_test.
Browse files Browse the repository at this point in the history
This is mainly to test the drivers/vhost/vringh.c code, but it also
uses the drivers/virtio/virtio_ring.c code for the guest side.

Usage for testing the basic implementation:

	./vringh_test
	# Test with indirect descriptors
	./vringh_test --indirect
	# Test with indirect descriptors and event indexex
	./vringh_test --indirect --eventidx

You can run a parallel stress test by adding --parallel to any of the
above options.

eg ./vringh_test --parallel:
	Using CPUS 0 and 3
	Guest: notified 10107974, pinged 107970
	Host: notified 108158, pinged 3172148

./vringh_test --indirect --eventidx --parallel:
	Using CPUS 0 and 3
	Guest: notified 156357, pinged 156251
	Host: notified 156251, pinged 78179

Average of 50 times doing ./vringh_test --indirect --eventidx --parallel:
	2.840000-3.040000(2.927292)user

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Mar 20, 2013
1 parent f87d0fb commit 1515c5c
Show file tree
Hide file tree
Showing 3 changed files with 747 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/virtio/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
all: test mod
test: virtio_test
test: virtio_test vringh_test
virtio_test: virtio_ring.o virtio_test.o
CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD
vpath %.c ../../drivers/virtio
vringh_test: vringh_test.o vringh.o virtio_ring.o

CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
vpath %.c ../../drivers/virtio ../../drivers/vhost
mod:
${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test
.PHONY: all test mod clean
clean:
${RM} *.o vhost_test/*.o vhost_test/.*.cmd \
${RM} *.o vringh_test virtio_test vhost_test/*.o vhost_test/.*.cmd \
vhost_test/Module.symvers vhost_test/modules.order *.d
-include *.d
2 changes: 2 additions & 0 deletions tools/virtio/linux/uio.h
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#include <linux/kernel.h>

#include "../../../include/linux/uio.h"
Loading

0 comments on commit 1515c5c

Please sign in to comment.