From: Kevin Wolf <kwolf@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: famz@redhat.com, benoit@irqsave.net, ming.lei@canonical.com,
armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
pbonzini@redhat.com, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 4/4] virtio-blk: introduce multiread
Date: Fri, 30 Jan 2015 22:15:01 +0100 [thread overview]
Message-ID: <20150130211501.GG24537@noname.redhat.com> (raw)
In-Reply-To: <54CBF21C.6040102@kamp.de>
Am 30.01.2015 um 22:05 hat Peter Lieven geschrieben:
> Am 30.01.2015 um 18:16 schrieb Max Reitz:
> > On 2015-01-30 at 09:33, Peter Lieven wrote:
> >> this patch finally introduces multiread support to virtio-blk. While
> >> multiwrite support was there for a long time, read support was missing.
> >>
> >> The complete merge logic is moved into virtio-blk.c which has
> >> been the only user of request merging ever since. This is required
> >> to be able to merge chunks of requests and immediately invoke callbacks
> >> for those requests. Secondly, this is required to switch to
> >> direct invocation of coroutines which is planned at a later stage.
> >>
> >> The following benchmarks show the performance of running fio with
> >> 4 worker threads on a local ram disk. The numbers show the average
> >> of 10 test runs after 1 run as warmup phase.
> >>
> >> | 4k | 64k | 4k
> >> MB/s | rd seq | rd rand | rd seq | rd rand | wr seq | wr rand
> >> --------------+--------+---------+--------+---------+--------+--------
> >> master | 1221 | 1187 | 4178 | 4114 | 1745 | 1213
> >> multiread | 1829 | 1189 | 4639 | 4110 | 1894 | 1216
> >>
> >> Signed-off-by: Peter Lieven <pl@kamp.de>
> >> ---
> >> hw/block/dataplane/virtio-blk.c | 8 +-
> >> hw/block/virtio-blk.c | 288 +++++++++++++++++++++++++++-------------
> >> include/hw/virtio/virtio-blk.h | 19 +--
> >> trace-events | 1 +
> >> 4 files changed, 210 insertions(+), 106 deletions(-)
> >> + int64_t sector_num = 0;
> >> +
> >> + if (mrb->num_reqs == 1) {
> >> + virtio_submit_multireq2(blk, mrb, 0, 1, -1);
> >> + mrb->num_reqs = 0;
> >> return;
> >> }
> >> - ret = blk_aio_multiwrite(blk, mrb->blkreq, mrb->num_writes);
> >> - if (ret != 0) {
> >> - for (i = 0; i < mrb->num_writes; i++) {
> >> - if (mrb->blkreq[i].error) {
> >> - virtio_blk_rw_complete(mrb->blkreq[i].opaque, -EIO);
> >> + max_xfer_len = blk_get_max_transfer_length(mrb->reqs[0]->dev->blk);
> >> + max_xfer_len = MIN_NON_ZERO(max_xfer_len, INT_MAX);
> >> +
> >> + qsort(mrb->reqs, mrb->num_reqs, sizeof(*mrb->reqs),
> >> + &virtio_multireq_compare);
> >> +
> >> + for (i = 0; i < mrb->num_reqs; i++) {
> >> + VirtIOBlockReq *req = mrb->reqs[i];
> >> + if (num_reqs > 0) {
> >> + bool merge = true;
> >> +
> >> + /* merge would exceed maximum number of IOVs */
> >> + if (niov + req->qiov.niov + 1 > IOV_MAX) {
> >
> > Hm, why the +1?
>
> A really good question. I copied this piece from the old merge routine. It seems
> definetely wrong.
The old code merged requests even if they were overlapping. This could
result in one area being split in two.
I think you don't support this here, so removing the + 1 is probably
okay.
Kevin
next prev parent reply other threads:[~2015-01-30 21:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 14:32 [Qemu-devel] [PATCH v3 0/4] virtio-blk: add multiread support Peter Lieven
2015-01-30 14:32 ` [Qemu-devel] [PATCH v3 1/4] block: add accounting for merged requests Peter Lieven
2015-01-30 15:53 ` Max Reitz
2015-01-30 14:33 ` [Qemu-devel] [PATCH v3 2/4] hw/virtio-blk: add a constant for max number of " Peter Lieven
2015-01-30 16:01 ` Max Reitz
2015-01-30 14:33 ` [Qemu-devel] [PATCH v3 3/4] block-backend: expose bs->bl.max_transfer_length Peter Lieven
2015-01-30 16:04 ` Max Reitz
2015-01-30 14:33 ` [Qemu-devel] [PATCH v3 4/4] virtio-blk: introduce multiread Peter Lieven
2015-01-30 17:16 ` Max Reitz
2015-01-30 21:05 ` Peter Lieven
2015-01-30 21:15 ` Kevin Wolf [this message]
2015-01-31 19:46 ` Peter Lieven
2015-01-30 21:30 ` Max Reitz
2015-01-31 19:45 ` Peter Lieven
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=20150130211501.GG24537@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=benoit@irqsave.net \
--cc=famz@redhat.com \
--cc=ming.lei@canonical.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).