From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: "Longpeng(Mike)" <longpeng2@huawei.com>,
stefanha@redhat.com, jasowang@redhat.com,
Peter Xu <peterx@redhat.com>,
David Hildenbrand <david@redhat.com>,
cohuck@redhat.com, sgarzare@redhat.com, pbonzini@redhat.com,
arei.gonglei@huawei.com, yechuan@huawei.com,
huangzhichao@huawei.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 3/3] vdpa: commit all host notifier MRs in a single MR transaction
Date: Tue, 27 Dec 2022 12:56:34 -0500 [thread overview]
Message-ID: <20221227125521-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <3cdfb4fc-70a9-db51-ac49-4ba984a3045a@linaro.org>
On Tue, Dec 27, 2022 at 05:51:47PM +0100, Philippe Mathieu-Daudé wrote:
> On 27/12/22 08:20, Longpeng(Mike) wrote:
> > From: Longpeng <longpeng2@huawei.com>
> >
> > This allows the vhost-vdpa device to batch the setup of all its MRs of
> > host notifiers.
> >
> > This significantly reduces the device starting time, e.g. the time spend
> > on setup the host notifier MRs reduce from 423ms to 32ms for a VM with
> > 64 vCPUs and 3 vhost-vDPA generic devices (vdpa_sim_blk, 64vq per device).
> >
> > Signed-off-by: Longpeng <longpeng2@huawei.com>
> > ---
> > hw/virtio/vhost-vdpa.c | 25 +++++++++++++++++++------
> > 1 file changed, 19 insertions(+), 6 deletions(-)
> >
> > diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> > index fd0c33b0e1..870265188a 100644
> > --- a/hw/virtio/vhost-vdpa.c
> > +++ b/hw/virtio/vhost-vdpa.c
> > @@ -512,9 +512,18 @@ static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n)
> > {
> > int i;
> > + /*
> > + * Pack all the changes to the memory regions in a single
> > + * transaction to avoid a few updating of the address space
> > + * topology.
> > + */
> > + memory_region_transaction_begin();
> > +
> > for (i = dev->vq_index; i < dev->vq_index + n; i++) {
> > vhost_vdpa_host_notifier_uninit(dev, i);
> > }
> > +
> > + memory_region_transaction_commit();
> > }
>
> Instead of optimizing one frontend, I wonder if we shouldn't expose
> a 'bool memory_region_transaction_in_progress()' helper in memory.c,
> and in virtio_queue_set_host_notifier_mr() backend, assert we are
> within a transaction. That way we'd optimize all virtio frontends.
If we are doing something like this, I'd rather pass around
a "transaction" structure so this can be checked statically.
Looks like something that can be done on top though.
--
MST
next prev parent reply other threads:[~2022-12-27 17:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 7:20 [PATCH v3 0/3] two optimizations to speed up the start time Longpeng(Mike) via
2022-12-27 7:20 ` [PATCH v3 1/3] vhost: simplify vhost_dev_enable_notifiers Longpeng(Mike) via
2022-12-27 7:20 ` [PATCH v3 2/3] vhost: configure all host notifiers in a single MR transaction Longpeng(Mike) via
2022-12-27 16:43 ` Philippe Mathieu-Daudé
2022-12-27 17:54 ` Michael S. Tsirkin
2022-12-28 13:12 ` Philippe Mathieu-Daudé
2022-12-29 5:18 ` longpeng2--- via
2022-12-27 7:20 ` [PATCH v3 3/3] vdpa: commit all host notifier MRs " Longpeng(Mike) via
2022-12-27 16:51 ` Philippe Mathieu-Daudé
2022-12-27 17:56 ` Michael S. Tsirkin [this message]
2022-12-28 13:14 ` Philippe Mathieu-Daudé
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=20221227125521-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=huangzhichao@huawei.com \
--cc=jasowang@redhat.com \
--cc=longpeng2@huawei.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=yechuan@huawei.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).