<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linux-kvm.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sridhar</id>
	<title>KVM - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://linux-kvm.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sridhar"/>
	<link rel="alternate" type="text/html" href="https://linux-kvm.org/page/Special:Contributions/Sridhar"/>
	<updated>2026-04-30T18:32:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://linux-kvm.org/index.php?title=VhostNet&amp;diff=2766</id>
		<title>VhostNet</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=VhostNet&amp;diff=2766"/>
		<updated>2010-01-07T17:43:59Z</updated>

		<summary type="html">&lt;p&gt;Sridhar: Added IBM&amp;#039;s short term plans&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;vhost-net: a kernel-level virtio-net server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What is vhost-net ==&lt;br /&gt;
&lt;br /&gt;
vhost is a kernel-level backend for virtio.&lt;br /&gt;
The main motivation for vhost is to reduce virtualization&lt;br /&gt;
overhead for virtio by removing system calls on data path,&lt;br /&gt;
without guest changes. For virtio-net, this removes up to&lt;br /&gt;
4 system calls per packet: vm exit for kick, reentry for kick,&lt;br /&gt;
iothread wakeup for packet, interrupt injection for packet.&lt;br /&gt;
&lt;br /&gt;
vhost is as minimal as possible. It relies on userspace for&lt;br /&gt;
all setup work.&lt;br /&gt;
&lt;br /&gt;
=== Status ===&lt;br /&gt;
vhost is fully functional, and it already shows&lt;br /&gt;
improvement over userspace virtio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to use ==&lt;br /&gt;
&lt;br /&gt;
Download, build an install kernel from:&lt;br /&gt;
&lt;br /&gt;
kernel:&lt;br /&gt;
 git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost&lt;br /&gt;
userspace:&lt;br /&gt;
 git://git.kernel.org/pub/scm/linux/kernel/git/mst/qemu-kvm.git vhost&lt;br /&gt;
&lt;br /&gt;
=== Usage instructions: ===&lt;br /&gt;
&lt;br /&gt;
vhost currently requires MSI-X support in guest virtio.&lt;br /&gt;
This means guests kernel version should be &amp;gt;= 2.6.31.&lt;br /&gt;
&lt;br /&gt;
To enable vhost, simply add &amp;quot;,vhost&amp;quot; flag to nic options.&lt;br /&gt;
Example with tap backend:&lt;br /&gt;
&lt;br /&gt;
 qemu-system-x86_64 -m 1G disk-c.qcow2 \&lt;br /&gt;
 -net tap,ifname=msttap0,script=/home/mst/ifup,downscript=no \&lt;br /&gt;
 -net nic,model=virtio,&#039;&#039;&#039;vhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Example with raw socket backend:&lt;br /&gt;
&lt;br /&gt;
 ifconfig eth3 promisc&lt;br /&gt;
 qemu-system-x86_64 -m 1G disk-c.qcow2 \&lt;br /&gt;
 -net raw,ifname=eth3 \&lt;br /&gt;
 -net nic,model=virtio,&#039;&#039;&#039;vhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note: in raw socket mode, when binding to a physical&lt;br /&gt;
ethernet device, host to guest communication&lt;br /&gt;
will only work if your device is connected to a bridge&lt;br /&gt;
configured to mirror outgoing packets back at the originating link.&lt;br /&gt;
If you do not know whether this is the case, this most likely&lt;br /&gt;
means it isn&#039;t. Use another box to access the guest, or use tap.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
* vhost currently requires MSI-X support in guest virtio. This means guests kernel version should be &amp;gt;= 2.6.31.&lt;br /&gt;
* with raw sockets, host to guest, and guest to guest communication on the same host does not always work. Use  bridge+tap if you need that.&lt;br /&gt;
* driver unloading in guest and device hot-unplug are broken, because the relevant code in qemu is stubbed out. Need to implement them.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Still tuning performance, especially guest to host.&lt;br /&gt;
&lt;br /&gt;
External to system numbers with bridge+tap and 10GE vxge card:&lt;br /&gt;
qemu with bridge+tap, run with: -cpu host,-rdtscp,+x2apic,&lt;br /&gt;
host+guest 2.6.33-rc2. mtu 1500.&lt;br /&gt;
&lt;br /&gt;
* netperf TCP_STREAM, default setup, 100 secs run&lt;br /&gt;
  native: 81XX Mb/s&lt;br /&gt;
  without vhost-net: 72XX Mb/s&lt;br /&gt;
  with vhost-net: 78XX Mb/s&lt;br /&gt;
&lt;br /&gt;
* TCP_RR, 100 secs run&lt;br /&gt;
  native: 48 usec/Trans&lt;br /&gt;
  without vhost-net: 395 usec/Trans&lt;br /&gt;
  with vhost-net: 86 usec/Trans&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are some local numbers coutesy of Shirley Ma:&lt;br /&gt;
&lt;br /&gt;
* netperf TCP_STREAM, default setup, 60 secs run&lt;br /&gt;
  guest-&amp;gt;host increases from 3XXXMb/s to 5XXXMb/s&lt;br /&gt;
  host-&amp;gt;guest increases from 3XXXMb/s to 4XXXMb/s&lt;br /&gt;
&lt;br /&gt;
* TCP_RR, 60 secs run&lt;br /&gt;
  guest-&amp;gt;host trans/s increases from 2XXX/s to 13XXX/s&lt;br /&gt;
  host-&amp;gt;guest trans/s increases from 2XXX/s to 13XXX/s&lt;br /&gt;
&lt;br /&gt;
== TODOs ==&lt;br /&gt;
&lt;br /&gt;
=== vhost-net driver projects ===&lt;br /&gt;
* profiling would be very helpful, I have not done any yet.&lt;br /&gt;
* merged buffers. &lt;br /&gt;
* scalability tuning: figure out the best threading model to use.&lt;br /&gt;
&lt;br /&gt;
=== qemu projects ===&lt;br /&gt;
* migration support&lt;br /&gt;
* level triggered interrupts&lt;br /&gt;
* driver unloading/hotplug&lt;br /&gt;
* general cleanup and upstreaming&lt;br /&gt;
* upstream support for injecting interrupts from kernel, from qemu-kvm.git to qemu.git (this is a vhost dependency, without it vhost can&#039;t be upstreamed, or it can, but without real benefit)&lt;br /&gt;
&lt;br /&gt;
=== virtio projects ===&lt;br /&gt;
* improve small packet/large buffer performance: support &amp;quot;reposting&amp;quot; buffers, pool for indirect buffers&lt;br /&gt;
* guest kernel 2.6.31 seems to work well. Under certain workloads,&lt;br /&gt;
virtio performance has regressed with guest kernels 2.6.32 and up&lt;br /&gt;
(but still better than userspace). A patch has been posted:&lt;br /&gt;
http://www.spinics.net/lists/netdev/msg115292.html&lt;br /&gt;
&lt;br /&gt;
=== projects involing other kernel components and/or networking stack ===&lt;br /&gt;
* rx mac filtering in tun&lt;br /&gt;
* extend raw sockets to support GSO/checksum offloading, and teach vhost to use that capability [one way to do this: virtio net header support]; will allow working with e.g. macvlan&lt;br /&gt;
* improve locking: e.g. RX/TX poll should not need a lock&lt;br /&gt;
* multicast ICMPs snooping in bridge&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== long term projects ===&lt;br /&gt;
* kvm eventfd support for injecting level interrupts&lt;br /&gt;
* multiqueue (involves all of vhost, qemu, virtio, networking stack)&lt;br /&gt;
* zero copy tx for tun/raw sockets&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
* More testing is always good&lt;br /&gt;
&lt;br /&gt;
== Short term plans for MST ==&lt;br /&gt;
&lt;br /&gt;
* get vhost net merged in linux kernel 2.6.33&lt;br /&gt;
* address most vhost qemu TODOs&lt;br /&gt;
* get vhost support merged in upstream qemu&lt;br /&gt;
&lt;br /&gt;
== Short term plans for IBM(Sridhar Samudrala, David Stevens, Shirley MA) ==&lt;br /&gt;
* Add GSO/checksum offload support to AF_PACKET(raw) sockets.&lt;br /&gt;
* Mergeable RX buffers support in vhost-net.&lt;br /&gt;
* Defer SKB allocation in virtio_net receive path.&lt;/div&gt;</summary>
		<author><name>Sridhar</name></author>
	</entry>
</feed>