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
next prev parent reply other threads:[~2011-06-19 7:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1277328242-10685-1-git-send-email-stefanha@linux.vnet.ibm.com>
2010-06-23 22:12 ` [RFC] virtio: Support releasing lock during kick Anthony Liguori
[not found] ` <4C2286BE.40808@codemonkey.ws>
2010-06-24 5:30 ` Stefan Hajnoczi
[not found] ` <AANLkTim6CH_NruBFqK6fIkMkKpAuCIef50mHfldMtNH9@mail.gmail.com>
2010-06-25 3:09 ` Rusty Russell
[not found] ` <201006251239.23224.rusty@rustcorp.com.au>
2010-06-25 6:17 ` Stefan Hajnoczi
2010-06-25 10:43 ` Michael S. Tsirkin
[not found] ` <20100625104317.GC16321@redhat.com>
2010-06-25 15:31 ` Stefan Hajnoczi
[not found] ` <20100625153143.GA12784@stefan-thinkpad.transitives.com>
2010-06-25 15:32 ` Michael S. Tsirkin
[not found] ` <20100625153220.GB17911@redhat.com>
2010-06-25 16:05 ` Stefan Hajnoczi
2010-06-28 15:55 ` Marcelo Tosatti
[not found] ` <20100628155505.GB4717@amt.cnet>
2010-06-29 7:08 ` Stefan Hajnoczi
[not found] ` <AANLkTikhPJnw81hhh3PQGSwv7Hkd56YMlOZQM0N-fTLp@mail.gmail.com>
2010-06-29 7:12 ` Avi Kivity
2011-06-19 7:14 ` Michael S. Tsirkin [this message]
2011-06-20 15:27 ` Stefan Hajnoczi
[not found] ` <BANLkTi=fsSLNu2ybeMKvN7gtCDO5FDNfDA@mail.gmail.com>
2011-06-24 9:16 ` Stefan Hajnoczi
2011-08-10 13:18 ` Christoph Hellwig
[not found] ` <20110810131801.GA12571@infradead.org>
2011-08-10 14:39 ` Stefan Hajnoczi
2011-06-19 7:48 ` Michael S. Tsirkin
[not found] ` <20110619074841.GA8613@redhat.com>
2011-06-19 13:55 ` Christoph Hellwig
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 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).