From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
marcandre.lureau@redhat.com, maxime.coquelin@redhat.com,
Peng Hao <peng.hao2@zte.com.cn>,
Wang Yechao <wang.yechao255@zte.com.cn>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vhost: fix a migration failed because of vhost region merge
Date: Fri, 21 Jul 2017 22:49:29 +0300 [thread overview]
Message-ID: <20170721224259-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170720172215.GH2456@work-vm>
On Thu, Jul 20, 2017 at 06:22:15PM +0100, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (mst@redhat.com) wrote:
> > On Wed, Jul 19, 2017 at 03:24:27PM +0200, Igor Mammedov wrote:
> > > On Wed, 19 Jul 2017 12:46:13 +0100
> > > "Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> > >
> > > > * Igor Mammedov (imammedo@redhat.com) wrote:
> > > > > On Wed, 19 Jul 2017 23:17:32 +0800
> > > > > Peng Hao <peng.hao2@zte.com.cn> wrote:
> > > > >
> > > > > > When a guest that has several hotplugged dimms is migrated, in
> > > > > > destination host it will fail to resume. Because vhost regions of
> > > > > > several dimms in source host are merged and in the restore stage
> > > > > > in destination host it computes whether more than vhost slot limit
> > > > > > before merging vhost regions of several dimms.
> > > > > could you provide a bit more detailed description of the problem
> > > > > including command line+used device_add commands on source and
> > > > > command line on destination?
> > > >
> > > > (ccing in Marc Andre and Maxime)
> > > >
> > > > Hmm, I'd like to understade the situation where you get merging between
> > > > RAMBlocks; that complicates some stuff for postcopy.
> > > and probably inconsistent merging breaks vhost as well
> > >
> > > merging might happen if regions are adjacent or overlap
> > > but for that to happen merged regions must have equal
> > > distance between their GPA:HVA pairs, so that following
> > > translation would work:
> > >
> > > if gva in regionX[gva_start, len, hva_start]
> > > hva = hva_start + gva - gva_start
> > >
> > > while GVA of regions is under QEMU control and deterministic
> > > HVA is not, so in migration case merging might happen on source
> > > side but not on destination, resulting in different memory maps.
> > >
> > > Maybe Michael might know details why migration works in vhost usecase,
> > > but I don't see vhost sending any vmstate data.
> >
> > We aren't merging ramblocks at all.
> > When we are passing blocks A and B to vhost, if we see that
> >
> > hvaB=hvaA + lenA
> > gpaB=gpaA + lenA
> >
> > then we can improve performance a bit by passing a single
> > chunk to vhost: hvaA,gpaA,lena+lenB
>
> OK, but that means that a region can incorporate multiple
> RAMBlocks though? Hmm that's not fun on postcopy.
>
> > so it does not affect migration normally.
>
> Well, why? What's required - if the region sizes/lengths/orders
> are different on the source and destination does it matter - if
> it does then that means we have a problem, since that heuristic
> is non-deterministic.
>
> Dave
It doesn't matter normally. But there's a limit
on number of regions that vhost can support.
pc_dimm_memory_plug tries to guess this number early
because it wants to fail hotplug requests gracefully.
See
commit 3fad87881e55aaff659408dcf25fa204f89a7896
Author: Igor Mammedov <imammedo@redhat.com>
Date: Tue Oct 6 10:37:28 2015 +0200
pc-dimm: add vhost slots limit check before commiting to hotplug
It might make sense to limit this to hotplug, though
runstate check seems like a wrong way to do this -
VM could be stopped e.g. through QMP at the time.
> >
> > >
> > > >
> > > > > >
> > > > > > Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> > > > > > Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
> > > > > > ---
> > > > > > hw/mem/pc-dimm.c | 2 +-
> > > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> > > > > > index ea67b46..bb0fa08 100644
> > > > > > --- a/hw/mem/pc-dimm.c
> > > > > > +++ b/hw/mem/pc-dimm.c
> > > > > > @@ -101,7 +101,7 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
> > > > > > goto out;
> > > > > > }
> > > > > >
> > > > > > - if (!vhost_has_free_slot()) {
> > > > > > + if (!vhost_has_free_slot() && runstate_is_running()) {
> > > > > > error_setg(&local_err, "a used vhost backend has no free"
> > > > > > " memory slots left");
> > > > > > goto out;
> > > >
> > > > Even this produces the wrong error message in this case,
> > > > it also makes me think if the existing code should undo a lot of
> > > > the object_property_set's that happen.
> > > >
> > > > Dave
> > > > >
> > > > >
> > > > --
> > > > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-07-21 19:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 15:17 [Qemu-devel] [PATCH] vhost: fix a migration failed because of vhost region merge Peng Hao
2017-07-19 7:50 ` Igor Mammedov
2017-07-19 11:46 ` Dr. David Alan Gilbert
2017-07-19 13:24 ` Igor Mammedov
2017-07-19 15:52 ` Michael S. Tsirkin
2017-07-20 17:22 ` Dr. David Alan Gilbert
2017-07-21 19:49 ` Michael S. Tsirkin [this message]
2017-07-24 8:06 ` Dr. David Alan Gilbert
2017-07-24 10:46 ` Igor Mammedov
2017-07-21 14:41 ` Igor Mammedov
2017-07-21 21:30 ` Michael S. Tsirkin
2017-07-24 10:05 ` Igor Mammedov
2017-07-24 13:01 ` Igor Mammedov
2017-07-19 8:36 ` no-reply
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=20170721224259-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=dgilbert@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=maxime.coquelin@redhat.com \
--cc=peng.hao2@zte.com.cn \
--cc=qemu-devel@nongnu.org \
--cc=wang.yechao255@zte.com.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.