From: Badari Pulavarty <pbadari@us.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [RFC] vhost-blk implementation
Date: Tue, 23 Mar 2010 07:55:24 -0700 [thread overview]
Message-ID: <4BA8D65C.2060605@us.ibm.com> (raw)
In-Reply-To: <4BA891E2.9040500@redhat.com>
Avi Kivity wrote:
> On 03/23/2010 03:00 AM, Badari Pulavarty wrote:
>> Forgot to CC: KVM list earlier
>>
>> [RFC] vhost-blk implementation.eml
>>
>> Subject:
>> [RFC] vhost-blk implementation
>> From:
>> Badari Pulavarty <pbadari@us.ibm.com>
>> Date:
>> Mon, 22 Mar 2010 17:34:06 -0700
>>
>> To:
>> virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org
>>
>>
>> Hi,
>>
>> Inspired by vhost-net implementation, I did initial prototype
>> of vhost-blk to see if it provides any benefits over QEMU virtio-blk.
>> I haven't handled all the error cases, fixed naming conventions etc.,
>> but the implementation is stable to play with. I tried not to deviate
>> from vhost-net implementation where possible.
>>
>> NOTE: Only change I had to make to vhost core code is to
>> increase VHOST_NET_MAX_SG to 130 (128+2) in vhost.h
>>
>> Performance:
>> =============
>>
>> I have done simple tests to see how it performs. I got very
>> encouraging results on sequential read tests. But on sequential
>> write tests, I see degrade over virtio-blk. I can't figure out and
>> explain why. Can some one shed light on whats happening here ?
>>
>> Read Results:
>> =============
>> Test does read of 84GB file from the host (through virtio). I unmount
>> and mount the filesystem on the host to make sure there is nothing
>> in the page cache..
>>
>> +#define VHOST_BLK_VQ_MAX 1
>> +
>> +struct vhost_blk {
>> + struct vhost_dev dev;
>> + struct vhost_virtqueue vqs[VHOST_BLK_VQ_MAX];
>> + struct vhost_poll poll[VHOST_BLK_VQ_MAX];
>> +};
>> +
>> +static int do_handle_io(struct file *file, uint32_t type, uint64_t
>> sector,
>> + struct iovec *iov, int in)
>> +{
>> + loff_t pos = sector<< 8;
>> + int ret = 0;
>> +
>> + if (type& VIRTIO_BLK_T_FLUSH) {
>> + ret = vfs_fsync(file, file->f_path.dentry, 1);
>> + } else if (type& VIRTIO_BLK_T_OUT) {
>> + ret = vfs_writev(file, iov, in,&pos);
>> + } else {
>> + ret = vfs_readv(file, iov, in,&pos);
>> + }
>> + return ret;
>> +}
>>
>
> This should be done asynchronously. That is likely the cause of write
> performance degradation. For reads, readahead means that that you're
> async anyway, but writes/syncs are still synchronous.
I am not sure what you mean by async here. Even if I use
f_op->aio_write() its still synchronous (except for DIO). Since we are
writing to pagecache and not waiting for write()
to complete, this is the best we can do here.
Do you mean offload write() handling to another thread ?
>
> I also think it should be done at the bio layer.
I am not sure what you meant here. Do you want to do submit_bio()
directly ? Its not going to be that simple. Since the sector# is offset
within the file, one have to do getblocks() on it
to find the real-disk-block#s + we have to do get_user_pages() on these
iovecs before submitting them to bio.. All of this work is done by
vfs_write()/vfs_read() anyway.. I am not
sure what you are suggesting here..
> File I/O is going to be slower, if we do vhost-blk we should
> concentrate on maximum performance. The block layer also exposes more
> functionality we can use (asynchronous barriers for example).
>
> btw, for fairness, cpu measurements should be done from the host side
> and include the vhost thread.
>
Will do.
Thanks,
Badari
next prev parent reply other threads:[~2010-03-23 14:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 1:00 [RFC] vhost-blk implementation Badari Pulavarty
2010-03-23 1:16 ` Anthony Liguori
2010-03-23 1:45 ` Badari Pulavarty
2010-03-23 2:00 ` Anthony Liguori
2010-03-23 2:50 ` Badari Pulavarty
2010-03-23 10:05 ` Avi Kivity
2010-03-23 14:48 ` Badari Pulavarty
2010-03-23 10:03 ` Avi Kivity
2010-03-23 14:55 ` Badari Pulavarty [this message]
2010-03-23 16:53 ` Avi Kivity
2010-03-24 20:05 ` Christoph Hellwig
2010-03-25 6:29 ` Avi Kivity
2010-03-25 15:48 ` Christoph Hellwig
2010-03-25 15:51 ` Avi Kivity
2010-03-25 15:00 ` Asdo
2010-04-05 19:59 ` Christoph Hellwig
2010-04-07 0:36 ` [RFC] vhost-blk implementation (v2) Badari Pulavarty
2010-03-23 10:09 ` [RFC] vhost-blk implementation Eran Rom
2010-03-24 20:04 ` Christoph Hellwig
2010-03-24 20:22 ` Badari Pulavarty
2010-03-25 7:57 ` Avi Kivity
2010-03-25 14:36 ` Badari Pulavarty
2010-03-25 15:57 ` Christoph Hellwig
2010-03-26 18:53 ` Eran Rom
2010-04-08 16:17 ` Stefan Hajnoczi
2010-04-05 19:23 ` Christoph Hellwig
2010-04-05 23:17 ` Badari Pulavarty
2010-03-24 20:27 ` Badari Pulavarty
2010-03-29 15:41 ` Badari Pulavarty
2010-03-29 18:20 ` Chris Wright
2010-03-29 20:37 ` Avi Kivity
2010-03-29 22:51 ` Badari Pulavarty
2010-03-29 23:56 ` Chris Wright
2010-03-30 12:43 ` Avi Kivity
2010-04-05 14:22 ` Stefan Hajnoczi
2010-04-06 2:27 ` Badari Pulavarty
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=4BA8D65C.2060605@us.ibm.com \
--to=pbadari@us.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.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