linux/arch/powerpc/kvm
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
..
44x_emulate.c KVM: ppc: split out common Book E instruction emulation 2009-03-24 11:02:57 +02:00
44x_tlb.c KVM: powerpc: convert marker probes to event trace 2009-09-10 08:33:03 +03:00
44x_tlb.h KVM: ppc: rename 44x MMU functions used in booke.c 2009-03-24 11:02:56 +02:00
44x.c KVM: powerpc: fix some init/exit annotations 2009-09-10 08:32:44 +03:00
book3s_32_mmu.c Add book3s_32 guest MMU 2009-11-05 16:49:55 +11:00
book3s_64_emulate.c powerpc/kvm: Sync guest visible MMU state 2009-12-08 16:02:50 +11:00
book3s_64_exports.c Export KVM symbols for module 2009-11-05 16:50:25 +11:00
book3s_64_interrupts.S Add book3s_64 highmem asm code 2009-11-05 16:49:53 +11:00
book3s_64_mmu_host.c Add book3s_64 Host MMU handling 2009-11-05 16:49:54 +11:00
book3s_64_mmu.c powerpc/kvm: Sync guest visible MMU state 2009-12-08 16:02:50 +11:00
book3s_64_rmhandlers.S Add interrupt handling code 2009-11-05 16:49:54 +11:00
book3s_64_slb.S Add SLB switching code for entry/exit 2009-11-05 16:49:53 +11:00
book3s.c powerpc/kvm: Sync guest visible MMU state 2009-12-08 16:02:50 +11:00
booke_emulate.c KVM: ppc: Add dbsr in kvm_vcpu_arch 2009-03-24 11:02:57 +02:00
booke_interrupts.S powerpc: Use names rather than numbers for SPRGs (v2) 2009-08-20 10:12:27 +10:00
booke.c Move dirty logging code to sub-arch 2009-11-05 16:49:51 +11:00
booke.h KVM: ppc: Add extra E500 exceptions 2009-03-24 11:02:59 +02:00
e500_emulate.c KVM: ppc: e500: Add MMUCFG and PVR emulation 2009-09-10 08:32:47 +03:00
e500_tlb.c KVM: powerpc: convert marker probes to event trace 2009-09-10 08:33:03 +03:00
e500_tlb.h KVM: ppc: e500: Move to Book-3e MMU definitions 2009-09-10 08:32:47 +03:00
e500.c KVM: ppc: e500: Directly pass pvr to guest 2009-09-10 08:32:47 +03:00
emulate.c Use hrtimers for the decrementer 2009-11-05 16:51:05 +11:00
Kconfig vhost_net: a kernel-level virtio server 2010-01-15 01:43:29 -08:00
Makefile Include Book3s_64 target in buildsystem 2009-11-05 16:50:26 +11:00
powerpc.c Merge commit 'origin/master' into next 2009-12-09 17:14:38 +11:00
timing.c powerpc/kvm: Fix non-modular build 2009-11-05 17:17:12 +11:00
timing.h KVM: powerpc: Fix BUILD_BUG_ON condition 2009-12-03 09:32:22 +02:00
trace.h Fix trace.h 2009-11-05 16:50:27 +11:00