From: Greg Kurz <groug@kaod.org>
To: Thomas Huth <thuth@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
mdroth@linux.vnet.ibm.com, dgilbert@redhat.com,
lvivier@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCHv2 5/5] spapr: Fix 2.7<->2.8 migration of PCI host bridge
Date: Mon, 21 Nov 2016 17:02:20 +0100 [thread overview]
Message-ID: <20161121170220.44a764ce@bahia> (raw)
In-Reply-To: <5f3ab979-741a-28a1-4feb-4b8696fe598e@redhat.com>
On Mon, 21 Nov 2016 13:02:53 +0100
Thomas Huth <thuth@redhat.com> wrote:
> On 21.11.2016 06:31, David Gibson wrote:
> > daa2369 "spapr_pci: Add a 64-bit MMIO window" subtly broke migration
> > from qemu-2.7 to the current version. It split the device's MMIO
> > window into two pieces for 32-bit and 64-bit MMIO.
> >
> > The patch included backwards compatibility code to convert the old
> > property into the new format. However, the property value was also
> > transferred in the migration stream and compared with a (probably
> > unwise) VMSTATE_EQUAL. So, the "raw" value from 2.7 is compared to
> > the new style converted value from (pre-)2.8 giving a mismatch and
> > migration failure.
> >
> > Along with the actual field that caused the breakage, there are
> > several other ill-advised VMSTATE_EQUAL()s. To fix forwards
> > migration, we read the values in the stream into scratch variables and
> > ignore them, instead of comparing for equality. To fix backwards
> > migration, we populate those scratch variables in pre_save() with
> > adjusted values to match the old behaviour.
> >
> > To permit the eventual possibility of removing this cruft from the
> > stream, we only include these compatibility fields if a new
> > 'pre-2.8-migration' property is set. We clear it on the pseries-2.8
> > machine type, which obviously can't be migrated backwards, but set it
> > on earlier machine type versions.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > hw/ppc/spapr.c | 5 +++++
> > hw/ppc/spapr_pci.c | 33 ++++++++++++++++++++++++++++-----
> > include/hw/pci-host/spapr.h | 6 ++++++
> > 3 files changed, 39 insertions(+), 5 deletions(-)
> >
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 775ad2e..c3269c7 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -2772,6 +2772,11 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", true);
> > .driver = TYPE_POWERPC_CPU, \
> > .property = "pre-2.8-migration", \
> > .value = "on", \
> > + }, \
> > + { \
> > + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, \
> > + .property = "pre-2.8-migration", \
> > + .value = "on", \
> > },
> >
> > static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index,
> > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> > index e429c94..c62c1cb 100644
> > --- a/hw/ppc/spapr_pci.c
> > +++ b/hw/ppc/spapr_pci.c
> > @@ -1590,6 +1590,8 @@ static Property spapr_phb_properties[] = {
> > DEFINE_PROP_UINT64("pgsz", sPAPRPHBState, page_size_mask,
> > (1ULL << 12) | (1ULL << 16)),
> > DEFINE_PROP_UINT32("numa_node", sPAPRPHBState, numa_node, -1),
> > + DEFINE_PROP_BOOL("pre-2.8-migration", sPAPRPHBState,
> > + pre_2_8_migration, false),
> > DEFINE_PROP_END_OF_LIST(),
> > };
> >
> > @@ -1636,6 +1638,20 @@ static void spapr_pci_pre_save(void *opaque)
> > sphb->msi_devs[i].key = *(uint32_t *) key;
> > sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
> > }
> > +
> > + if (sphb->pre_2_8_migration) {
> > + sphb->mig_liobn = sphb->dma_liobn[0];
> > + sphb->mig_mem_win_addr = sphb->mem_win_addr;
> > + sphb->mig_mem_win_size = sphb->mem_win_size;
> > + sphb->mig_io_win_addr = sphb->io_win_addr;
> > + sphb->mig_io_win_size = sphb->io_win_size;
> > +
> > + if ((sphb->mem64_win_size != 0)
> > + && (sphb->mem64_win_addr
> > + == (sphb->mem_win_addr + sphb->mem_win_size))) {
> > + sphb->mig_mem_win_size += sphb->mem64_win_size;
> > + }
>
> Should we maybe print a warning/error message in case
>
> sphb->mem64_win_size != 0 &&
> sphb->mem64_win_addr != sphb->mem_win_addr + sphb->mem_win_size
>
> ... assuming that this means a configuration which can not be migrated
> backwards?
>
Then shouldn't we forbid pre_2_8_migration to be set when we have a
non-contiguous window ?
> > + }
> > }
>
> With or without warning message, patch looks fine to me, so:
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
>
next prev parent reply other threads:[~2016-11-21 16:02 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 5:31 [Qemu-devel] [PATCHv2 0/5] Last minute ppc migration fixes David Gibson
2016-11-21 5:31 ` [Qemu-devel] [PATCHv2 1/5] target-ppc: Fix CPU migration from qemu-2.6 <-> later versions David Gibson
2016-11-21 10:12 ` Dr. David Alan Gilbert
2016-11-21 10:41 ` Thomas Huth
2016-11-21 14:14 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-22 8:19 ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-22 23:28 ` David Gibson
2016-11-21 5:31 ` [Qemu-devel] [PATCHv2 2/5] migration: Add VMSTATE_UINTTL_TEST() David Gibson
2016-11-21 10:02 ` Dr. David Alan Gilbert
2016-11-21 10:43 ` Thomas Huth
2016-11-21 14:16 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-21 5:31 ` [Qemu-devel] [PATCHv2 3/5] target-ppc: Allow eventual removal of old migration mistakes David Gibson
2016-11-21 10:24 ` Dr. David Alan Gilbert
2016-11-21 10:47 ` Thomas Huth
2016-11-21 15:26 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-21 23:11 ` David Gibson
2016-11-22 8:32 ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-21 5:31 ` [Qemu-devel] [PATCHv2 4/5] Revert "spapr: Fix migration of PCI host bridges from qemu-2.7" David Gibson
2016-11-21 10:51 ` Thomas Huth
2016-11-21 15:27 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-22 8:33 ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-21 5:31 ` [Qemu-devel] [PATCHv2 5/5] spapr: Fix 2.7<->2.8 migration of PCI host bridge David Gibson
2016-11-21 10:43 ` Dr. David Alan Gilbert
2016-11-21 12:02 ` Thomas Huth
2016-11-21 16:02 ` Greg Kurz [this message]
2016-11-21 23:15 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-11-22 9:42 ` Greg Kurz
2016-11-22 8:17 ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-23 0:17 ` David Gibson
2016-11-23 2:28 ` Alexey Kardashevskiy
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=20161121170220.44a764ce@bahia \
--to=groug@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@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).