All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: "Andrey Ryabinin" <arbn@yandex-team.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	quintela@redhat.com, qemu-devel@nongnu.org,
	yc-core@yandex-team.com
Subject: Re: [PATCH] pci/pci_expander_bridge: migrate state of pxb/pxb-pcie devices.
Date: Thu, 18 Aug 2022 14:04:23 +0100	[thread overview]
Message-ID: <Yv441+TMUlQOZOvK@work-vm> (raw)
In-Reply-To: <3cdc0316-b615-107f-65bf-dda340841f73@yandex-team.ru>

* Vladimir Sementsov-Ogievskiy (vsementsov@yandex-team.ru) wrote:
> [add migration maintainers]

Thanks,

> On 8/11/22 19:49, Andrey Ryabinin wrote:
> > pxb/pxb-pcie/pxb-cxl devices currently doesn't have vmstate description
> > So the state of device is not preserved during migration and
> > guest can notice that as change of PCI_COMMAND_* registers state.
> > 
> > The diff of lspci output before and after migration:
> > 
> >   00:03.0 Host bridge [0600]: Red Hat, Inc. QEMU PCIe Expander bridge [1b36:000b]
> >           Subsystem: Red Hat, Inc QEMU PCIe Expander bridge [1af4:1100]
> >   -       Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
> >   +       Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> >           Status: Cap- 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

Do you notice any other symptoms other than that minor diff?

> > Add VMStateDescription to pxb devices so their state is transferred
> > during migrations. For saving migration compatibility add
> > 'x-config-reg-migration-enabled' property to pxb devices and disable
> > it for all released machine types.
> > 
> > Signed-off-by: Andrey Ryabinin <arbn@yandex-team.com>
> > ---
> >   hw/core/machine.c                   |  3 +++
> >   hw/pci-bridge/pci_expander_bridge.c | 24 ++++++++++++++++++++++++
> >   include/hw/pci/pci_bridge.h         |  1 +
> >   3 files changed, 28 insertions(+)
> > 
> > diff --git a/hw/core/machine.c b/hw/core/machine.c
> > index a673302ccec..071853469e2 100644
> > --- a/hw/core/machine.c
> > +++ b/hw/core/machine.c
> > @@ -43,6 +43,9 @@
> >   GlobalProperty hw_compat_7_0[] = {
> >       { "arm-gicv3-common", "force-8-bit-prio", "on" },
> >       { "nvme-ns", "eui64-default", "on"},
> > +    { "pxb", "x-config-reg-migration-enabled", "off" },
> > +    { "pxb-cxl", "x-config-reg-migration-enabled", "off" },
> > +    { "pxb-pcie", "x-config-reg-migration-enabled", "off" },
> 
> 
> Seems that it's too late for 7.1, rc2 is out and rc3 is coming soon. And that's not a degradation.

Yeh

> Up to maintainers, but I think we'd better start new hw_compat_7_1 for this thing.

Yep.


Dave
> 
> >   };
> >   const size_t hw_compat_7_0_len = G_N_ELEMENTS(hw_compat_7_0);
> > diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
> > index c9e817aa586..a3680d4d045 100644
> > --- a/hw/pci-bridge/pci_expander_bridge.c
> > +++ b/hw/pci-bridge/pci_expander_bridge.c
> > @@ -23,6 +23,7 @@
> >   #include "qemu/error-report.h"
> >   #include "qemu/module.h"
> >   #include "sysemu/numa.h"
> > +#include "migration/vmstate.h"
> >   #include "hw/boards.h"
> >   #include "qom/object.h"
> > @@ -404,9 +405,29 @@ static Property pxb_dev_properties[] = {
> >       DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0),
> >       DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED),
> >       DEFINE_PROP_BOOL("bypass_iommu", PXBDev, bypass_iommu, false),
> > +    DEFINE_PROP_BOOL("x-config-reg-migration-enabled", PXBDev,
> > +                     migratable, true),
> 
> With it, do we create a user-visible property? If so, is it possible to avoid it?
> 
> >       DEFINE_PROP_END_OF_LIST(),
> >   };
> > +static bool pxb_vmstate_needed(void *opaque)
> > +{
> > +    PXBDev *pxb = opaque;
> > +
> > +    return pxb->migratable;
> > +}
> > +
> > +static const VMStateDescription vmstate_pxb_device = {
> > +    .name = "pxb-pci",
> > +    .needed = pxb_vmstate_needed,
> > +    .version_id = 1,
> > +    .minimum_version_id = 1,
> > +    .fields = (VMStateField[]) {
> > +        VMSTATE_PCI_DEVICE(parent_obj, PXBDev),
> > +        VMSTATE_END_OF_LIST()
> > +    }
> > +};
> > +
> >   static void pxb_dev_class_init(ObjectClass *klass, void *data)
> >   {
> >       DeviceClass *dc = DEVICE_CLASS(klass);
> > @@ -422,6 +443,7 @@ static void pxb_dev_class_init(ObjectClass *klass, void *data)
> >       device_class_set_props(dc, pxb_dev_properties);
> >       dc->hotpluggable = false;
> >       set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> > +    dc->vmsd = &vmstate_pxb_device;
> >   }
> >   static const TypeInfo pxb_dev_info = {
> > @@ -460,6 +482,7 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data)
> >       device_class_set_props(dc, pxb_dev_properties);
> >       dc->hotpluggable = false;
> >       set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> > +    dc->vmsd = &vmstate_pxb_device;
> >   }
> >   static const TypeInfo pxb_pcie_dev_info = {
> > @@ -504,6 +527,7 @@ static void pxb_cxl_dev_class_init(ObjectClass *klass, void *data)
> >       /* Host bridges aren't hotpluggable. FIXME: spec reference */
> >       dc->hotpluggable = false;
> >       dc->reset = pxb_dev_reset;
> > +    dc->vmsd = &vmstate_pxb_device;
> >   }
> >   static const TypeInfo pxb_cxl_dev_info = {
> > diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
> > index ba4bafac7c2..404dc02e36e 100644
> > --- a/include/hw/pci/pci_bridge.h
> > +++ b/include/hw/pci/pci_bridge.h
> > @@ -91,6 +91,7 @@ struct PXBDev {
> >       uint8_t bus_nr;
> >       uint16_t numa_node;
> >       bool bypass_iommu;
> > +    bool migratable;
> >       struct cxl_dev {
> >           CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */
> >       } cxl;
> 
> 
> -- 
> Best regards,
> Vladimir
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



      reply	other threads:[~2022-08-18 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 16:49 [PATCH] pci/pci_expander_bridge: migrate state of pxb/pxb-pcie devices Andrey Ryabinin
2022-08-13 16:23 ` Vladimir Sementsov-Ogievskiy
2022-08-18 13:04   ` Dr. David Alan Gilbert [this message]

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=Yv441+TMUlQOZOvK@work-vm \
    --to=dgilbert@redhat.com \
    --cc=arbn@yandex-team.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    --cc=wangyanan55@huawei.com \
    --cc=yc-core@yandex-team.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.