qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: qemu-devel@nongnu.org, Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: [Qemu-devel] Re: [PATCHv2-RFC 0/2] virtio: put last seen used index into ring itself
Date: Sun, 30 May 2010 14:22:20 +0300	[thread overview]
Message-ID: <20100530112220.GA27611@redhat.com> (raw)
In-Reply-To: <4BFF9366.5090103@redhat.com>

On Fri, May 28, 2010 at 11:56:54AM +0200, Jes Sorensen wrote:
> On 05/26/10 21:50, Michael S. Tsirkin wrote:
> > 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.
> 
> Hi Michael,
> 
> It looks pretty good to me, however one thing I have been thinking of
> while reading through it:
> 
> Rather than storing a pointer within the ring struct, pointing into a
> position within the same struct. How about storing a byte offset instead
> and using a cast to get to the pointer position? That would avoid the
> pointer dereference, which is less effective cache wise and harder for
> the CPU to predict.
> 
> Not sure whether it really matters performance wise, just a thought.
> 
> Cheers,
> Jes

I think this won't work: when PUBLUSH_USED_IDX is negotiated,
the pointer is to within the ring.

-- 
MST

  reply	other threads:[~2010-05-30 11:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 19:50 [Qemu-devel] [PATCHv2-RFC 0/2] virtio: put last seen used index into ring itself Michael S. Tsirkin
2010-05-26 19:50 ` [Qemu-devel] [PATCHv2-RFC 1/2] virtio: support layout with avail ring before idx Michael S. Tsirkin
2010-05-26 19:50 ` [Qemu-devel] [PATCHv2-RFC 2/2] virtio: publish used idx Michael S. Tsirkin
2010-05-27 12:07 ` [Qemu-devel] Re: [PATCHv2-RFC 0/2] virtio: put last seen used index into ring itself Avi Kivity
2010-05-27 13:59   ` Michael S. Tsirkin
2010-05-28  9:56 ` Jes Sorensen
2010-05-30 11:22   ` Michael S. Tsirkin [this message]
2010-05-31  7:36     ` Jes Sorensen
2010-05-31 13:29       ` Michael S. Tsirkin
2010-05-31  7:46 ` Rusty Russell
2010-05-31 12:20   ` Michael S. Tsirkin
2010-06-02 20:39   ` Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100530112220.GA27611@redhat.com \
    --to=mst@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).