kernel_optimize_test/arch/s390
Michael S. Tsirkin 3a4d5c94e9 vhost_net: a kernel-level virtio server
What it is: vhost net is a character device that can be used to reduce
the number of system calls involved in virtio networking.
Existing virtio net code is used in the guest without modification.

There's similarity with vringfd, with some differences and reduced scope
- uses eventfd for signalling
- structures can be moved around in memory at any time (good for
  migration, bug work-arounds in userspace)
- write logging is supported (good for migration)
- support memory table and not just an offset (needed for kvm)

common virtio related code has been put in a separate file vhost.c and
can be made into a separate module if/when more backends appear.  I used
Rusty's lguest.c as the source for developing this part : this supplied
me with witty comments I wouldn't be able to write myself.

What it is not: vhost net is not a bus, and not a generic new system
call. No assumptions are made on how guest performs hypercalls.
Userspace hypervisors are supported as well as kvm.

How it works: Basically, we connect virtio frontend (configured by
userspace) to a backend. The backend could be a network device, or a tap
device.  Backend is also configured by userspace, including vlan/mac
etc.

Status: This works for me, and I haven't see any crashes.
Compared to userspace, people reported improved latency (as I save up to
4 system calls per packet), as well as better bandwidth and CPU
utilization.

Features that I plan to look at in the future:
- mergeable buffers
- zero copy
- scalability tuning: figure out the best threading model to use

Note on RCU usage (this is also documented in vhost.h, near
private_pointer which is the value protected by this variant of RCU):
what is happening is that the rcu_dereference() is being used in a
workqueue item.  The role of rcu_read_lock() is taken on by the start of
execution of the workqueue item, of rcu_read_unlock() by the end of
execution of the workqueue item, and of synchronize_rcu() by
flush_workqueue()/flush_work(). In the future we might need to apply
some gcc attribute or sparse annotation to the function passed to
INIT_WORK(). Paul's ack below is for this RCU usage.

(Includes fixes by Alan Cox <alan@linux.intel.com>,
David L Stevens <dlstevens@us.ibm.com>,
Chris Wright <chrisw@redhat.com>)

Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-01-15 01:43:29 -08:00
..
appldata const: constify remaining dev_pm_ops 2009-12-15 08:53:25 -08:00
boot kbuild: use INSTALLKERNEL to select customized installkernel script 2009-09-20 12:18:14 +02:00
crypto [S390] s390: PTR_ERR return of wrong pointer in fallback_init_cip() 2009-12-18 17:43:31 +01:00
hypfs [S390] Use strim instead of strstrip to avoid false warnings. 2009-12-18 17:43:33 +01:00
include/asm [S390] wire up sys_recvmmsg 2009-12-18 17:43:31 +01:00
kernel [S390] Use strim instead of strstrip to avoid false warnings. 2009-12-18 17:43:33 +01:00
kvm vhost_net: a kernel-level virtio server 2010-01-15 01:43:29 -08:00
lib locking: Convert raw_rwlock functions to arch_rwlock 2009-12-14 23:55:32 +01:00
math-emu tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
mm Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6 2009-12-09 19:01:47 -08:00
oprofile Combine instrumentation menus in kernel/Kconfig.instrumentation 2007-10-19 11:53:54 -07:00
defconfig [S390] Improve address space mode selection. 2009-12-07 12:51:33 +01:00
Kconfig [S390] Improve address space mode selection. 2009-12-07 12:51:33 +01:00
Kconfig.debug generic debug pagealloc: build fix 2009-04-02 19:04:48 -07:00
Makefile [S390] hibernation: merge files and move to kernel/ 2009-09-11 10:29:45 +02:00