From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Marcel Apfelbaum <marcel@redhat.com>
Cc: Peter Xu <peterx@redhat.com>,
qemu-devel@nongnu.org,
Alex Williamson <alex.williamson@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Laurent Vivier <lvivier@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] pcie-root-port: let it has higher migrate priority
Date: Thu, 1 Feb 2018 19:38:38 +0000 [thread overview]
Message-ID: <20180201193838.GM2457@work-vm> (raw)
In-Reply-To: <90b4bc63-94cd-ec0f-32c8-c16df8ee84cf@redhat.com>
* Marcel Apfelbaum (marcel@redhat.com) wrote:
> Hi Peter,
>
> On 01/02/2018 13:20, Peter Xu wrote:
> > In the past, we prioritized IOMMU migration so that we have such a
> > priority order:
> >
> > IOMMU > PCI Devices
> >
> > When migrating a guest with both vIOMMU and pcie-root-port, we'll always
> > migrate vIOMMU first, since pcie-root-port will be seen to have the same
> > priority of general PCI devices.
> >
> > That's problematic.
> >
> > The thing is that PCI bus number information is stored in the root port,
> > and that is needed by vIOMMU during post_load(), e.g., to figure out
> > context entry for a device. If we don't have correct bus numbers for
> > devices, we won't be able to recover device state of the DMAR memory
> > regions, and things will be messed up.
> >
> > So let's boost the PCIe root ports to be even with higher priority:
> >
> > PCIe Root Port > IOMMU > PCI Devices
> >
> > A smoke test shows that this patch fixes bug 1538953.
> >
> > CC: Alex Williamson <alex.williamson@redhat.com>
> > CC: Marcel Apfelbaum <marcel@redhat.com>
> > CC: Michael S. Tsirkin <mst@redhat.com>
> > CC: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > CC: Juan Quintela <quintela@redhat.com>
> > CC: Laurent Vivier <lvivier@redhat.com>
> > Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1538953
> > Reported-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > Marcel & all,
> >
> > I think it's possible that we need similar thing for other bridge-like
> > devices, but I'm not that familiar. Would you help confirm? Thanks,
>
> Is a pity we don't have a way to mark the migration priority
> in a base class. Dave, maybe we do have a way?
Not that I'm aware of; the 'priority' field is associated with the VMSD
and it's not really connected to the class hierarchy at all.
Dave
> In the meantime you would need to add it also to:
> - ioh3420 (Intel root port)
> - xio3130_downstream (Intel switch downstream port)
> - xio3130_upstream (The counterpart of the above, you want the whole
> switch to be migrated before loading the IOMMU device state)
> - pcie_pci_bridge (for pci devices)
> - pci-pci bridge (if for some reason you have one attached to the pcie_pci_brdge)
> - i82801b11 (dmi-pci bridge, we want to deprecate it bu is there for now)
>
> Thanks,
> Marcel
>
> > hw/pci-bridge/gen_pcie_root_port.c | 1 +
> > include/migration/vmstate.h | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
> > index 0e2f2e8bf1..e6ff1effd8 100644
> > --- a/hw/pci-bridge/gen_pcie_root_port.c
> > +++ b/hw/pci-bridge/gen_pcie_root_port.c
> > @@ -101,6 +101,7 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
> >
> > static const VMStateDescription vmstate_rp_dev = {
> > .name = "pcie-root-port",
> > + .priority = MIG_PRI_PCIE_ROOT_PORT,
> > .version_id = 1,
> > .minimum_version_id = 1,
> > .post_load = pcie_cap_slot_post_load,
> > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> > index 8c3889433c..491449db9f 100644
> > --- a/include/migration/vmstate.h
> > +++ b/include/migration/vmstate.h
> > @@ -148,6 +148,7 @@ enum VMStateFlags {
> > typedef enum {
> > MIG_PRI_DEFAULT = 0,
> > MIG_PRI_IOMMU, /* Must happen before PCI devices */
> > + MIG_PRI_PCIE_ROOT_PORT, /* Must happen before IOMMU */
> > MIG_PRI_GICV3_ITS, /* Must happen before PCI devices */
> > MIG_PRI_GICV3, /* Must happen before the ITS */
> > MIG_PRI_MAX,
> >
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2018-02-01 19:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 11:20 [Qemu-devel] [PATCH] pcie-root-port: let it has higher migrate priority Peter Xu
2018-02-01 12:24 ` Marcel Apfelbaum
2018-02-01 19:18 ` Michael S. Tsirkin
2018-02-01 19:48 ` Dr. David Alan Gilbert
2018-02-01 20:01 ` Marcel Apfelbaum
2018-02-01 20:10 ` Dr. David Alan Gilbert
2018-02-02 10:04 ` Peter Xu
2018-02-02 13:25 ` Marcel Apfelbaum
2018-02-01 19:38 ` Dr. David Alan Gilbert [this message]
2018-02-02 10:19 ` Peter Xu
2018-02-01 19:51 ` Dr. David Alan Gilbert
2018-02-02 9:56 ` Peter Xu
2018-02-02 12:39 ` Marcel Apfelbaum
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=20180201193838.GM2457@work-vm \
--to=dgilbert@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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 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.