From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: virtualization@lists.linux-foundation.org,
Stefan Hajnoczi <stefanha@gmail.com>,
Anthony Liguori <anthony@codemonkey.ws>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
kvm@vger.kernel.org
Subject: Re: [RFC] virtio: Support releasing lock during kick
Date: Fri, 25 Jun 2010 13:43:17 +0300 [thread overview]
Message-ID: <20100625104317.GC16321@redhat.com> (raw)
In-Reply-To: <201006251239.23224.rusty@rustcorp.com.au>
On Fri, Jun 25, 2010 at 12:39:21PM +0930, Rusty Russell wrote:
> On Thu, 24 Jun 2010 03:00:30 pm Stefan Hajnoczi wrote:
> > On Wed, Jun 23, 2010 at 11:12 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> > > Shouldn't it be possible to just drop the lock before invoking
> > > virtqueue_kick() and reacquire it afterwards? There's nothing in that
> > > virtqueue_kick() path that the lock is protecting AFAICT.
> >
> > No, that would lead to a race condition because vq->num_added is
> > modified by both virtqueue_add_buf_gfp() and virtqueue_kick().
> > Without a lock held during virtqueue_kick() another vcpu could add
> > bufs while vq->num_added is used and cleared by virtqueue_kick():
>
> Right, this dovetails with another proposed change (was it Michael?)
> where we would update the avail idx inside add_buf, rather than waiting
> until kick. This means a barrier inside add_buf, but that's probably
> fine.
>
> If we do that, then we don't need a lock on virtqueue_kick.
>
> Michael, thoughts?
Maybe not even that: I think we could just do virtio_wmb()
in add, and keep the mb() in kick.
What I'm a bit worried about is contention on the cacheline
including index and flags: the more we write to that line,
the worse it gets.
So need to test performance impact of this change:
I didn't find time to do this yet, as I am trying
to finalize the used index publishing patches.
Any takers?
Do we see performance improvement after making kick lockless?
> Thanks,
> Rusty.
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-06-25 10:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-23 21:24 [RFC] virtio: Support releasing lock during kick Stefan Hajnoczi
2010-06-23 22:12 ` Anthony Liguori
2010-06-24 5:30 ` Stefan Hajnoczi
2010-06-25 3:09 ` Rusty Russell
2010-06-25 6:17 ` Stefan Hajnoczi
2010-06-25 10:43 ` Michael S. Tsirkin [this message]
2010-06-25 15:31 ` Stefan Hajnoczi
2010-06-25 15:32 ` Michael S. Tsirkin
2010-06-25 16:05 ` Stefan Hajnoczi
2010-06-28 15:55 ` Marcelo Tosatti
2010-06-29 7:08 ` Stefan Hajnoczi
2010-06-29 7:12 ` Avi Kivity
2011-06-19 7:14 ` Michael S. Tsirkin
2011-06-20 15:27 ` Stefan Hajnoczi
2011-06-24 9:16 ` Stefan Hajnoczi
2011-08-10 13:18 ` Christoph Hellwig
2011-08-10 14:39 ` Stefan Hajnoczi
2011-06-19 7:48 ` Michael S. Tsirkin
2011-06-19 13:55 ` Christoph Hellwig
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=20100625104317.GC16321@redhat.com \
--to=mst@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=kvm@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=stefanha@gmail.com \
--cc=stefanha@linux.vnet.ibm.com \
--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