From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46350 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJSoY-0005Q7-DR for qemu-devel@nongnu.org; Tue, 01 Jun 2010 10:51:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJSoT-0001KN-K8 for qemu-devel@nongnu.org; Tue, 01 Jun 2010 10:51:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12697) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJSoT-0001Jq-Dc for qemu-devel@nongnu.org; Tue, 01 Jun 2010 10:51:29 -0400 Date: Tue, 1 Jun 2010 17:47:08 +0300 From: "Michael S. Tsirkin" Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCHv3 0/2] virtio: put last seen used index into ring itself List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rusty Russell , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, qemu-devel@nongnu.org Changes from v2: added padding between avail idx and flags, and changed virtio to only publish used index when callbacks are enabled. Here's a rewrite of the original patch with a new layout. I haven't tested it yet so no idea how this performs, but I think this addresses the cache bounce issue raised by Avi. Posting for early flames/comments. Generally, the Host end of the virtio ring doesn't need to see where Guest is up to in consuming the ring. However, to completely understand what's going on from the outside, this information must be exposed. For example, host can reduce the number of interrupts by detecting that the guest is currently handling previous buffers. We add a feature bit so the guest can tell the host that it's writing out the current value there, if it wants to use that. This differs from original approach in that the used index is put after avail index (they are typically written out together). To avoid cache bounces on descriptor access, and make future extensions easier, we put the ring itself at start of page, and move the control after it. Signed-off-by: Michael S. Tsirkin Michael S. Tsirkin (2): virtio: support layout with avail ring before idx virtio: publish used idx drivers/net/virtio_net.c | 2 + drivers/virtio/virtio_ring.c | 25 +++++++++++++++------ include/linux/virtio_ring.h | 50 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 64 insertions(+), 13 deletions(-)