All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [RFC] virtio: Support releasing lock during kick
Date: Sun, 19 Jun 2011 10:14:52 +0300	[thread overview]
Message-ID: <20110619071452.GA7930@redhat.com> (raw)
In-Reply-To: <1277328242-10685-1-git-send-email-stefanha@linux.vnet.ibm.com>

On Wed, Jun 23, 2010 at 10:24:02PM +0100, Stefan Hajnoczi wrote:
> The virtio block device holds a lock during I/O request processing.
> Kicking the virtqueue while the lock is held results in long lock hold
> times and increases contention for the lock.
> 
> This patch modifies virtqueue_kick() to optionally release a lock while
> notifying the host.  Virtio block is modified to pass in its lock.  This
> allows other vcpus to queue I/O requests during the time spent servicing
> the virtqueue notify in the host.
> 
> The virtqueue_kick() function is modified to know about locking because
> it changes the state of the virtqueue and should execute with the lock
> held (it would not be correct for virtio block to release the lock
> before calling virtqueue_kick()).
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

While the optimization makes sense, the API's pretty hairy IMHO.
Why don't we split the kick functionality instead?
E.g.
	/* Report whether host notification is necessary. */
	bool virtqueue_kick_prepare(struct virtqueue *vq)
	/* Can be done in parallel with add_buf/get_buf */
	void virtqueue_kick_notify(struct virtqueue *vq)

And users can
	
	r = virtqueue_kick_prepare(vq);
	spin_unlock_irqrestore(...);
	if (r)
		virtqueue_kick_notify(struct virtqueue *vq)

-- 
MST

  parent reply	other threads:[~2011-06-19  7:14 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-24  5:30   ` Stefan Hajnoczi
2010-06-25  3:09     ` Rusty Russell
2010-06-25  3:09     ` Rusty Russell
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:32           ` Michael S. Tsirkin
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:31         ` Stefan Hajnoczi
2010-06-24  5:30   ` Stefan Hajnoczi
2010-06-23 22:12 ` Anthony Liguori
2010-06-28 15:55 ` Marcelo Tosatti
2010-06-28 15:55 ` Marcelo Tosatti
2010-06-29  7:08   ` Stefan Hajnoczi
2010-06-29  7:08   ` Stefan Hajnoczi
2010-06-29  7:12     ` Avi Kivity
2010-06-29  7:12     ` Avi Kivity
2011-06-19  7:14 ` Michael S. Tsirkin [this message]
2011-06-20 15:27   ` Stefan Hajnoczi
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 13:18     ` Christoph Hellwig
2011-08-10 14:39       ` Stefan Hajnoczi
2011-08-10 14:39       ` Stefan Hajnoczi
2011-06-19  7:48 ` Michael S. Tsirkin
2011-06-19  7:48 ` Michael S. Tsirkin
2011-06-19 13:55   ` Christoph Hellwig
2011-06-19 13:55     ` Christoph Hellwig
  -- 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=20110619071452.GA7930@redhat.com \
    --to=mst@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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.