From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: performance of virtual functions compared to virtio Date: Tue, 26 Apr 2011 11:19:11 +0300 Message-ID: <4DB67FFF.8010909@redhat.com> References: <4DAF8EF0.8010203@gmail.com> <1303353349.3110.181.camel@x201> <4DAFE5BE.1070506@redhat.com> <4DB02C9F.2050901@redhat.com> <4DB5B436.4060000@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Stefan Hajnoczi , Alex Williamson , KVM mailing list To: David Ahern Return-path: Received: from mx1.redhat.com ([209.132.183.28]:63999 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750932Ab1DZITR (ORCPT ); Tue, 26 Apr 2011 04:19:17 -0400 In-Reply-To: <4DB5B436.4060000@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/25/2011 08:49 PM, David Ahern wrote: > > > > There are several copies. > > > > qemu's virtio-net implementation incurs a copy on tx and on rx when > > calling the kernel; in addition there is also an internal copy: > > > > /* copy in packet. ugh */ > > len = iov_from_buf(sg, elem.in_num, > > buf + offset, size - offset); > > > > In principle vhost-net can avoid the tx copy, but I think now we have 1 > > copy on rx and tx each. > > So there is a copy internal to qemu, then from qemu to the host tap > device and then tap device to a physical NIC if the packet is leaving > the host? There is no internal copy on tx, just rx. So: virtio-net: 1 internal rx, 1 kernel/user rx, 1 kernel/user tx vhost-net: 1 internal rx, 1 internal tx > Is that what the zero-copy patch set is attempting - bypassing the > transmit copy to the macvtap device? Yes. > > > > If a host interface is dedicated to backing a vhost-net interface (say > > if you have an SR/IOV card) then you can in principle avoid the rx copy > > as well. > > > > An alternative to avoiding the copies is to use a dma engine, like I > > mentioned. > > > > How does the DMA engine differ from the zero-copy patch set? The DMA engine does not avoid the copy, it merely uses a device other than the cpu to perform it. It offloads the cpu but still loads the interconnect. True zero-copy avoids both the cpu load and the interconnect load. -- error compiling committee.c: too many arguments to function