From: Asias He <asias@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org,
kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux-foundation.org,
Benjamin LaHaise <bcrl@kvack.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 0/5] Add vhost-blk support
Date: Tue, 17 Jul 2012 16:29:42 +0800 [thread overview]
Message-ID: <50052276.2080906@redhat.com> (raw)
In-Reply-To: <CAJSP0QWgmXns89se+xdGgM6i1_hsfVWPQ8caHua9d-dDA4CTDQ@mail.gmail.com>
On 07/16/2012 07:58 PM, Stefan Hajnoczi wrote:
> On Thu, Jul 12, 2012 at 4:35 PM, Asias He <asias@redhat.com> wrote:
>> This patchset adds vhost-blk support. vhost-blk is a in kernel virito-blk
>> device accelerator. Compared to userspace virtio-blk implementation, vhost-blk
>> gives about 5% to 15% performance improvement.
>
> Why is it 5-15% faster? vhost-blk and the userspace virtio-blk you
> benchmarked should be doing basically the same thing:
>
> 1. An eventfd file descriptor is signalled when the vring has new
> requests available from the guest.
> 2. A thread wakes up and processes the virtqueue.
> 3. Linux AIO is used to issue host I/O.
> 4. An interrupt is injected into the guest.
Yes. This is how both of them work. Though, there are some differences
in details. e.g.
In vhost-blk, we use the vhost's work infrastructure to handle the
requests. In kvm tool, we use a dedicated thread.
In vhost-blk, we use irqfd to inject interrupts. In kvm tool, we use
ioctl to inject interrupts.
> Does the vhost-blk implementation do anything fundamentally different
> from userspace? Where is the overhead that userspace virtio-blk has?
Currently, no. But we could play with bio directly in vhost-blk as
Christoph suggested which could make the IO path from guest to host's
real storage even shorter in vhost-blk.
I've been trying my best to reduce the overhead of virtio-blk at kvm
tool side. I do not see any significant overhead out there. Compared to
vhost-blk, the overhead we have in userspace virito-blk is syscalls. In
each IO request, we have
epoll_wait() & read(): wait for the eventfd which guest notifies us
io_submit(): submit the aio
read(): read the aio complete eventfd
io_getevents(): reap the aio complete result
ioctl(): trigger the interrupt
So, vhost-blk at least saves ~6 syscalls for us in each request.
> I'm asking because it would be beneficial to fix the overhead
> (especially it that could speed up all userspace applications) instead
> of adding a special-purpose kernel module to work around the overhead.
I guess you mean qemu here. Yes, in theory, qemu's block layer can be
improved to achieve similar performance as vhost-blk or kvm tool's
userspace virito-blk has. But I think it makes no sense to prevent one
solution becase there is another in theory solution called: we can do
similar in qemu.
What do you mean by specail-purpose here, we need general-purpose kernel
module? Is vhost-net a special purpose kernel module? Is xen-blkback a
special-purpose kernel module? And I think vhost-blk is beneficial to
qemu too, as well as any other kvm host side implementation.
--
Asias
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
next prev parent reply other threads:[~2012-07-17 8:29 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 15:35 [PATCH 0/5] Add vhost-blk support Asias He
2012-07-12 15:35 ` [PATCH 1/5] aio: Export symbols and struct kiocb_batch for in kernel aio usage Asias He
2012-07-12 17:50 ` James Bottomley
2012-07-13 1:40 ` Asias He
2012-07-12 16:06 ` [PATCH 0/5] Add vhost-blk support Jeff Moyer
2012-07-13 1:19 ` Asias He
2012-07-16 11:58 ` Stefan Hajnoczi
2012-07-17 8:29 ` Asias He [this message]
2012-07-17 8:52 ` Paolo Bonzini
2012-07-17 9:21 ` Asias He
2012-07-17 9:32 ` Paolo Bonzini
2012-07-17 9:51 ` Michael S. Tsirkin
2012-07-17 11:11 ` Stefan Hajnoczi
2012-07-17 11:26 ` Michael S. Tsirkin
2012-07-17 11:42 ` Stefan Hajnoczi
2012-07-17 11:51 ` Stefan Hajnoczi
2012-07-17 11:54 ` Michael S. Tsirkin
2012-07-17 12:03 ` Stefan Hajnoczi
2012-07-17 12:48 ` Michael S. Tsirkin
2012-07-17 13:02 ` Paolo Bonzini
2012-07-17 13:26 ` Michael S. Tsirkin
2012-07-18 8:47 ` Asias He
2012-07-18 8:12 ` Asias He
2012-07-18 8:26 ` Stefan Hajnoczi
2012-07-18 9:46 ` Ronen Hod
2012-07-17 9:45 ` Michael S. Tsirkin
2012-07-17 10:14 ` Paolo Bonzini
2012-07-17 10:49 ` Michael S. Tsirkin
2012-07-17 10:56 ` Paolo Bonzini
2012-07-17 11:09 ` Michael S. Tsirkin
2012-07-17 11:36 ` 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=50052276.2080906@redhat.com \
--to=asias@redhat.com \
--cc=bcrl@kvack.org \
--cc=kvm@vger.kernel.org \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=stefanha@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--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).