From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: performance of virtual functions compared to virtio Date: Mon, 25 Apr 2011 11:49:42 -0600 Message-ID: <4DB5B436.4060000@gmail.com> References: <4DAF8EF0.8010203@gmail.com> <1303353349.3110.181.camel@x201> <4DAFE5BE.1070506@redhat.com> <4DB02C9F.2050901@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Stefan Hajnoczi , Alex Williamson , KVM mailing list To: Avi Kivity Return-path: Received: from mail-px0-f179.google.com ([209.85.212.179]:41621 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758203Ab1DYRtq (ORCPT ); Mon, 25 Apr 2011 13:49:46 -0400 Received: by pxi2 with SMTP id 2so1985138pxi.10 for ; Mon, 25 Apr 2011 10:49:45 -0700 (PDT) In-Reply-To: <4DB02C9F.2050901@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/21/11 07:09, Avi Kivity wrote: > On 04/21/2011 03:31 PM, Stefan Hajnoczi wrote: >> On Thu, Apr 21, 2011 at 9:07 AM, Avi Kivity wrote: >> > Note I think in both cases we can make significant improvements: >> > - for VFs, steer device interrupts to the cpus which run the vcpus >> that will >> > receive the interrupts eventually (ISTR some work about this, but >> not sure) >> > - for virtio, use a DMA engine to copy data (I think there exists >> code in >> > upstream which does this, but has this been enabled/tuned?) >> >> Which data copy in virtio? Is this a vhost-net specific thing you're >> thinking about? > > 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? Is that what the zero-copy patch set is attempting - bypassing the transmit copy to the macvtap device? > > 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? David