From: "Michael S. Tsirkin" <mst@redhat.com>
To: Greg Kurz <groug@kaod.org>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [for-6.1 2/4] virtio-blk: Configure all host notifiers in a single MR transaction
Date: Thu, 6 May 2021 04:15:10 -0400 [thread overview]
Message-ID: <20210506041437-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210505131551.011f5516@bahia.lan>
On Wed, May 05, 2021 at 01:15:51PM +0200, Greg Kurz wrote:
> On Wed, 5 May 2021 11:14:23 +0100
> Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> > On Wed, Apr 07, 2021 at 04:34:59PM +0200, Greg Kurz wrote:
> > > This allows the virtio-blk-pci device to batch the setup of all its
> > > host notifiers. This significantly improves boot time of VMs with a
> > > high number of vCPUs, e.g. from 3m26.186s down to 0m58.023s for a
> > > pseries machine with 384 vCPUs.
> > >
> > > Note that memory_region_transaction_commit() must be called before
> > > virtio_bus_cleanup_host_notifier() because the latter might close
> > > ioeventfds that the transaction still assumes to be around when it
> > > commits.
> > >
> > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > > ---
> > > hw/block/dataplane/virtio-blk.c | 25 +++++++++++++++++++++++++
> > > 1 file changed, 25 insertions(+)
> > >
> > > diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> > > index d7b5c95d26d9..cd81893d1d01 100644
> > > --- a/hw/block/dataplane/virtio-blk.c
> > > +++ b/hw/block/dataplane/virtio-blk.c
> > > @@ -198,19 +198,30 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
> > > goto fail_guest_notifiers;
> > > }
> > >
> > > + memory_region_transaction_begin();
> >
> > This call is optional and an optimization. It would be nice to have a
> > comment here explaining that - otherwise people may wonder why this is
> > necessary.
> >
>
> Indeed. Same goes for patch 4 actually.
>
> Michael,
>
> Should I re-post an updated version of this series or can the
> comments be added in a followup ?
An updated version is better. Stefan did not ack anyway.
> > > +
> > > /* Set up virtqueue notify */
> > > for (i = 0; i < nvqs; i++) {
> > > r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, true);
> > > if (r != 0) {
> > > + int j = i;
> > > +
> > > fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r);
> > > while (i--) {
> > > virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
> > > + }
> > > +
> > > + memory_region_transaction_commit();
> > > +
> > > + while (j--) {
> > > virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
> > > }
> > > goto fail_host_notifiers;
> > > }
> > > }
> > >
> > > + memory_region_transaction_commit();
> > > +
> > > s->starting = false;
> > > vblk->dataplane_started = true;
> > > trace_virtio_blk_data_plane_start(s);
> > > @@ -246,8 +257,15 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
> > > return 0;
> > >
> > > fail_aio_context:
> > > + memory_region_transaction_begin();
> >
> > Probably unnecessary since this is an error code path. We don't need to
> > optimize it.
> >
> > Doesn't hurt though.
>
> True. I can drop this if I repost.
next prev parent reply other threads:[~2021-05-06 8:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 14:34 [for-6.1 0/4] virtio: Improve boot time of virtio-scsi-pci and virtio-blk-pci Greg Kurz
2021-04-07 14:34 ` [for-6.1 1/4] virtio-blk: Fix rollback path in virtio_blk_data_plane_start() Greg Kurz
2021-04-07 14:34 ` [for-6.1 2/4] virtio-blk: Configure all host notifiers in a single MR transaction Greg Kurz
2021-05-05 10:14 ` Stefan Hajnoczi
2021-05-05 11:15 ` Greg Kurz
2021-05-06 8:15 ` Michael S. Tsirkin [this message]
2021-04-07 14:35 ` [for-6.1 3/4] virtio-scsi: Set host notifiers and callbacks separately Greg Kurz
2021-05-05 10:16 ` Stefan Hajnoczi
2021-04-07 14:35 ` [for-6.1 4/4] virtio-scsi: Configure all host notifiers in a single MR transaction Greg Kurz
2021-05-05 10:17 ` Stefan Hajnoczi
2021-04-19 15:31 ` [for-6.1 0/4] virtio: Improve boot time of virtio-scsi-pci and virtio-blk-pci Greg Kurz
2021-04-19 21:51 ` Michael S. Tsirkin
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=20210506041437-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=fam@euphon.net \
--cc=groug@kaod.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--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).