From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [PULL 1/5] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO
Date: Mon, 27 Sep 2021 05:49:15 -0400 [thread overview]
Message-ID: <20210927053932-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <YVGP9vdTtu5sRVpl@redhat.com>
On Mon, Sep 27, 2021 at 10:33:42AM +0100, Daniel P. Berrangé wrote:
> On Tue, Aug 03, 2021 at 04:52:03PM -0400, Michael S. Tsirkin wrote:
> > From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> >
> > Q35 has now ACPI hotplug enabled by default for PCI(e) devices.
> > As opposed to native PCIe hotplug, guests like Fedora 34
> > will not assign IO range to pcie-root-ports not supporting
> > native hotplug, resulting into a regression.
> >
> > Reproduce by:
> > qemu-bin -M q35 -device pcie-root-port,id=p1 -monitor stdio
> > device_add e1000,bus=p1
> > In the Guest OS the respective pcie-root-port will have the IO range
> > disabled.
> >
> > Fix it by setting the "reserve-io" hint capability of the
> > pcie-root-ports so the firmware will allocate the IO range instead.
> >
> > Acked-by: Igor Mammedov <imammedo@redhat.com>
> > Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> > Message-Id: <20210802090057.1709775-1-marcel@redhat.com>
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > hw/pci-bridge/gen_pcie_root_port.c | 5 +++++
> > 1 file changed, 5 insertions(+)
>
> This change, when combined with the switch to ACPI based hotplug by
> default, is responsible for a significant regression in QEMU 6.1.0
>
> It is no longer possible to have more than 15 pcie-root-port devices
> added to a q35 VM in 6.1.0. Before this I've had as many as 80+ devices
> present before I stopped trying to add more.
>
> https://gitlab.com/qemu-project/qemu/-/issues/641
>
> This regression is significant, because it has broken the out of the
> box default configuration that OpenStack uses for booting all VMs.
> They add 16 pcie-root-ports by defalt to allow empty slots for device
> hotplug under q35 [1].
Indeed, oops. Thanks for the report!
Going back and looking at seabios code, didn't we get confused?
Shouldn't we have reserved memory and not IO?
I see:
int resource_optional = pcie_cap && (type == PCI_REGION_TYPE_IO);
if (!sum && hotplug_support && !resource_optional)
sum = align; /* reserve min size for hot-plug */
generally maybe we should just add an ACPI-hotplug capability and
teach seabios about it?
Marcel?
> > diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
> > index ec9907917e..20099a8ae3 100644
> > --- a/hw/pci-bridge/gen_pcie_root_port.c
> > +++ b/hw/pci-bridge/gen_pcie_root_port.c
> > @@ -28,6 +28,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GenPCIERootPort, GEN_PCIE_ROOT_PORT)
> > (GEN_PCIE_ROOT_PORT_AER_OFFSET + PCI_ERR_SIZEOF)
> >
> > #define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
> > +#define GEN_PCIE_ROOT_DEFAULT_IO_RANGE 4096
> >
> > struct GenPCIERootPort {
> > /*< private >*/
> > @@ -75,6 +76,7 @@ static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
> > static void gen_rp_realize(DeviceState *dev, Error **errp)
> > {
> > PCIDevice *d = PCI_DEVICE(dev);
> > + PCIESlot *s = PCIE_SLOT(d);
> > GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
> > PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
> > Error *local_err = NULL;
> > @@ -85,6 +87,9 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
> > return;
> > }
> >
> > + if (grp->res_reserve.io == -1 && s->hotplug && !s->native_hotplug) {
> > + grp->res_reserve.io = GEN_PCIE_ROOT_DEFAULT_IO_RANGE;
> > + }
> > int rc = pci_bridge_qemu_reserve_cap_init(d, 0,
> > grp->res_reserve, errp);
> >
> > --
> > MST
> >
> >
>
> Regards,
> Daniel
>
> [1] https://github.com/openstack/tripleo-heat-templates/blob/7a6cd0640ec390a330f5699d8ed60f71b2a9f514/deployment/nova/nova-compute-container-puppet.yaml#L462-L472
> --
> |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o- https://fstop138.berrange.com :|
> |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-09-27 10:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 20:52 [PULL 0/5] pc,pci: bugfixes Michael S. Tsirkin
2021-08-03 20:52 ` [PULL 1/5] hw/pcie-root-port: Fix hotplug for PCI devices requiring IO Michael S. Tsirkin
2021-09-27 9:33 ` Daniel P. Berrangé
2021-09-27 9:49 ` Michael S. Tsirkin [this message]
2021-09-29 9:05 ` Daniel P. Berrangé
2021-09-29 13:55 ` Marcel Apfelbaum
2021-09-29 13:41 ` Marcel Apfelbaum
2021-09-29 14:12 ` Gerd Hoffmann
2021-09-29 21:47 ` Michael S. Tsirkin
2021-09-30 8:34 ` Igor Mammedov
2021-09-30 10:52 ` Michael S. Tsirkin
2021-11-02 9:23 ` Daniel P. Berrangé
2021-11-02 9:33 ` Marcel Apfelbaum
2021-11-02 11:17 ` Julia Suvorova
2021-08-03 20:52 ` [PULL 2/5] acpi: x86: pcihp: add support hotplug on multifunction bridges Michael S. Tsirkin
2021-08-03 20:52 ` [PULL 3/5] arm/acpi: allow DSDT changes Michael S. Tsirkin
2021-08-03 20:52 ` [PULL 4/5] Revert "acpi/gpex: Inform os to keep firmware resource map" Michael S. Tsirkin
2021-08-03 20:52 ` [PULL 5/5] Drop _DSM 5 from expected DSDTs on ARM Michael S. Tsirkin
2021-08-04 15:52 ` [PULL 0/5] pc,pci: bugfixes Peter Maydell
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=20210927053932-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=berrange@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).