qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	si-wei.liu@oracle.com,  Lei Yang <leiyang@redhat.com>,
	Dragos Tatulea <dtatulea@nvidia.com>,
	 Zhu Lingshan <lingshan.zhu@intel.com>,
	Parav Pandit <parav@mellanox.com>,
	 Stefano Garzarella <sgarzare@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>, Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH for 9.0 08/12] vdpa: add vhost_vdpa_load_setup
Date: Thu, 21 Dec 2023 10:17:41 +0800	[thread overview]
Message-ID: <CACGkMEukZNUnXRSwpVAROe7U7GzkubP9i37ev+qOSQvWxLEK_Q@mail.gmail.com> (raw)
In-Reply-To: <CAJaqyWczW+uwYBsWas97JY6OgiSurnvNQnnTYPFWv5La55GOOg@mail.gmail.com>

On Wed, Dec 20, 2023 at 3:07 PM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Wed, Dec 20, 2023 at 6:22 AM Jason Wang <jasowang@redhat.com> wrote:
> >
> > On Sat, Dec 16, 2023 at 1:28 AM Eugenio Pérez <eperezma@redhat.com> wrote:
> > >
> > > Callers can use this function to setup the incoming migration thread.
> > >
> > > This thread is able to map the guest memory while the migration is
> > > ongoing, without blocking QMP or other important tasks. While this
> > > allows the destination QEMU not to block, it expands the mapping time
> > > during migration instead of making it pre-migration.
> >
> > If it's just QMP, can we simply use bh with a quota here?
> >
>
> Because QEMU cannot guarantee the quota at write(fd,
> VHOST_IOTLB_UPDATE, ...).

So you mean the delay may be caused by a single syscall?

> Also, synchronization with
> vhost_vdpa_dev_start would complicate as it would need to be
> re-scheduled too.

Just a flush of the bh, or not?

But another question. How to synchronize with the memory API in this
case. Currently the updating (without vIOMMU) is done under the
listener callback.

Usually after the commit, Qemu may think the memory topology has been
updated. If it is done asynchronously, would we have any problem?

>
> As a half-baked idea, we can split the mapping chunks in manageable
> sizes, but I don't like that idea a lot.
>
> > Btw, have you measured the hotspot that causes such slowness? Is it
> > pinning or vendor specific mapping that slows down the progress? Or if
> > VFIO has a similar issue?
> >
>
> Si-Wei did the actual profiling as he is the one with the 128G guests,
> but most of the time was spent in the memory pinning. Si-Wei, please
> correct me if I'm wrong.
>
> I didn't check VFIO, but I think it just maps at realize phase with
> vfio_realize -> vfio_attach_device -> vfio_connect_container(). In
> previous testings, this delayed the VM initialization by a lot, as
> we're moving that 20s of blocking to every VM start.
>
> Investigating a way to do it only in the case of being the destination
> of a live migration, I think the right place is .load_setup migration
> handler. But I'm ok to move it for sure.

Adding Peter for more ideas.

>
> > >
> > > This thread joins at vdpa backend device start, so it could happen that
> > > the guest memory is so large that we still have guest memory to map
> > > before this time.
> >
> > So we would still hit the QMP stall in this case?
> >
>
> This paragraph is kind of outdated, sorry. I can only cause this if I
> don't enable switchover_ack migration capability and if I artificially
> make memory pinning in the kernel artificially slow. But I didn't
> check QMP to be honest, so I can try to test it, yes.
>
> If QMP is not responsive, that means QMP is not responsive in QEMU
> master in that period actually. So we're only improving anyway.
>
> Thanks!
>

Thanks



  reply	other threads:[~2023-12-21  2:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 17:28 [PATCH for 9.0 00/12] Map memory at destination .load_setup in vDPA-net migration Eugenio Pérez
2023-12-15 17:28 ` [PATCH for 9.0 01/12] vdpa: do not set virtio status bits if unneeded Eugenio Pérez
2023-12-20  4:25   ` Jason Wang
2023-12-15 17:28 ` [PATCH for 9.0 02/12] vdpa: make batch_begin_once early return Eugenio Pérez
2023-12-20  4:27   ` Jason Wang
2023-12-15 17:28 ` [PATCH for 9.0 03/12] vdpa: merge _begin_batch into _batch_begin_once Eugenio Pérez
2023-12-20  4:30   ` Jason Wang
2023-12-15 17:28 ` [PATCH for 9.0 04/12] vdpa: extract out _dma_end_batch from _listener_commit Eugenio Pérez
2023-12-20  4:31   ` Jason Wang
2023-12-15 17:28 ` [PATCH for 9.0 05/12] vdpa: factor out stop path of vhost_vdpa_dev_start Eugenio Pérez
2023-12-20  4:31   ` Jason Wang
2023-12-15 17:28 ` [PATCH for 9.0 06/12] vdpa: check for iova tree initialized at net_client_start Eugenio Pérez
2023-12-15 17:28 ` [PATCH for 9.0 07/12] vdpa: set backend capabilities at vhost_vdpa_init Eugenio Pérez
2023-12-20  4:34   ` Jason Wang
2023-12-20  7:07     ` Eugenio Perez Martin
2023-12-21  3:39       ` Jason Wang
2023-12-15 17:28 ` [PATCH for 9.0 08/12] vdpa: add vhost_vdpa_load_setup Eugenio Pérez
2023-12-20  5:21   ` Jason Wang
2023-12-20  7:06     ` Eugenio Perez Martin
2023-12-21  2:17       ` Jason Wang [this message]
2023-12-21  8:20         ` Eugenio Perez Martin
2024-01-02  5:33           ` Peter Xu
2024-01-02 11:28             ` Eugenio Perez Martin
2024-01-03  6:16               ` Peter Xu
2024-01-03 11:11                 ` Eugenio Perez Martin
2024-01-04  6:46                   ` Peter Xu
2023-12-15 17:28 ` [PATCH for 9.0 09/12] vdpa: approve switchover after memory map in the migration destination Eugenio Pérez
2023-12-15 17:28 ` [PATCH for 9.0 10/12] vdpa: add vhost_vdpa_net_load_setup NetClient callback Eugenio Pérez
2023-12-15 17:28 ` [PATCH for 9.0 11/12] vdpa: add vhost_vdpa_net_switchover_ack_needed Eugenio Pérez
2023-12-15 17:28 ` [PATCH for 9.0 12/12] virtio_net: register incremental migration handlers Eugenio Pérez
2023-12-25  1:41 ` [PATCH for 9.0 00/12] Map memory at destination .load_setup in vDPA-net migration Lei Yang
2023-12-25 16:30 ` Michael S. Tsirkin
2024-01-02 14:38   ` Eugenio Perez Martin

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=CACGkMEukZNUnXRSwpVAROe7U7GzkubP9i37ev+qOSQvWxLEK_Q@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=dtatulea@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=leiyang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.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).