All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: virtualization@lists.linux-foundation.org
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [RFC] virtio: Support releasing lock during kick
Date: Fri, 25 Jun 2010 12:39:21 +0930	[thread overview]
Message-ID: <201006251239.23224.rusty@rustcorp.com.au> (raw)
In-Reply-To: <AANLkTim6CH_NruBFqK6fIkMkKpAuCIef50mHfldMtNH9@mail.gmail.com>

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?

Thanks,
Rusty.

  reply	other threads:[~2010-06-25  3:09 UTC|newest]

Thread overview: 37+ 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-23 22:12 ` Anthony Liguori
2010-06-24  5:30   ` Stefan Hajnoczi
2010-06-24  5:30   ` Stefan Hajnoczi
2010-06-25  3:09     ` Rusty Russell [this message]
2010-06-25  6:17       ` Stefan Hajnoczi
2010-06-25  6:17       ` Stefan Hajnoczi
2010-06-25 10:43       ` Michael S. Tsirkin
2010-06-25 10:43       ` Michael S. Tsirkin
2010-06-25 15:31         ` Stefan Hajnoczi
2010-06-25 15:31         ` Stefan Hajnoczi
2010-06-25 15:32           ` Michael S. Tsirkin
2010-06-25 16:05             ` Stefan Hajnoczi
2010-06-25 16:05             ` Stefan Hajnoczi
2010-06-25 15:32           ` Michael S. Tsirkin
2010-06-25  3:09     ` Rusty Russell
2010-06-28 15:55 ` Marcelo Tosatti
2010-06-29  7:08   ` Stefan Hajnoczi
2010-06-29  7:12     ` Avi Kivity
2010-06-29  7:12     ` Avi Kivity
2010-06-29  7:08   ` Stefan Hajnoczi
2010-06-28 15:55 ` Marcelo Tosatti
2011-06-19  7:14 ` Michael S. Tsirkin
2011-06-20 15:27   ` Stefan Hajnoczi
2011-06-24  9:16     ` Stefan Hajnoczi
2011-06-24  9:16     ` Stefan Hajnoczi
2011-08-10 13:18     ` Christoph Hellwig
2011-08-10 14:39       ` Stefan Hajnoczi
2011-08-10 14:39       ` Stefan Hajnoczi
2011-08-10 13:18     ` Christoph Hellwig
2011-06-20 15:27   ` Stefan Hajnoczi
2011-06-19  7:48 ` Michael S. Tsirkin
2011-06-19 13:55   ` Christoph Hellwig
2011-06-19 13:55     ` Christoph Hellwig
2011-06-19  7:48 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2010-06-23 21:24 Stefan Hajnoczi

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=201006251239.23224.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=anthony@codemonkey.ws \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.