All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ani Sinha <ani@anisinha.ca>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, "Ani Sinha" <ani@anisinha.ca>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Igor Mammedov" <imammedo@redhat.com>
Subject: Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Date: Wed, 20 Jul 2022 11:37:19 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2207201132430.9370@anisinha-lenovo> (raw)
In-Reply-To: <CAFEAcA9WBo2Kn9BPz1y2JCxpBGnBWDOtgLFiu31V4PL2m6b7bQ@mail.gmail.com>



On Tue, 19 Jul 2022, Peter Maydell wrote:

> On Sat, 4 Sept 2021 at 22:36, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > From: Ani Sinha <ani@anisinha.ca>
> >
> > Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci
> > hotplug, nvdimm hotplug are all pulled in when CONFIG_ACPI_X86 is turned on.
> > This brings in support for whole lot of subsystems that some targets like
> > mips does not need. They are added just to satisfy symbol dependencies. This
> > is ugly and should be avoided. Targets should be able to pull in just what they
> > need and no more. For example, mips only needs support for PIIX4 and does not
> > need acpi pci hotplug support or cpu hotplug support or memory hotplug support
> > etc. This change is an effort to clean this up.
> > In this change, new config variables are added for various acpi hotplug
> > subsystems. Targets like mips can only enable PIIX4 support and not the rest
> > of all the other modules which were being previously pulled in as a part of
> > CONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but
> > are not required by mips (for example, symbols specific to pci hotplug etc)
> > are available to satisfy the dependencies.
> >
> > Currently, this change only addresses issues with mips malta targets. In future
> > we might be able to clean up other targets which are similarly pulling in lot
> > of unnecessary hotplug modules by enabling ACPI_X86.
> >
> > This change should also address issues such as the following:
> > https://gitlab.com/qemu-project/qemu/-/issues/221
> > https://gitlab.com/qemu-project/qemu/-/issues/193
> >
> > Signed-off-by: Ani Sinha <ani@anisinha.ca>
> > Message-Id: <20210812071409.492299-1-ani@anisinha.ca>
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> Hi; I'm trying to track down the fix for a bug that I think
> was introduced by this change. Specifically, if you
> configure with a target list of
>  '--target-list=mips-linux-user,mips64-linux-user,mipsel-linux-user,mipsn32-linux-user,mipsn32el-linux-user,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu'
>
> (ie "just mips"), then run 'make check', the iotest 267 fails
> because QEMU segfaults trying to do a VM save/restore on
> qemu-system-mips. (You can run just that iotest by cd'ing
> into the build dir's tests/qemu-iotests/ subdir and running
>   ./check -qcow2 -gdb 267
> if you like).
>
> This is because hw/acpi/piix4.c (used by the MIPS malta board)
> has a vmstate that includes use of the VMSTATE_PCI_HOTPLUG()
> macro. This macro uses the vmstate_acpi_pcihp_pci_status
> vmstate struct. If the MIPS target is built along with some
> other targets which require CONFIG_ACPI_PCIHP then we correctly
> get the real definition of that vmstate struct from pcihp.c.
> However, if we are only building the MIPS targets then
> CONFIG_ACPI_PCIHP is false, and we get the dummy definition
> of the struct from acpi-pci-hotplug-stub.c. The dummy definition
> obviously doesn't actually work for migrating anything, and
> in fact the migration code ends up segfaulting because
> the 'name' field in the struct is NULL. (MIPS builds and
> uses hw/acpi/piix4.c because
> configs/devices/mips-softmmu/common.mak sets CONFIG_ACPI_PIIX4=y,
> and it needs this because piix4_init() unconditionally
> creates a TYPE_PIIX4_PM device. It's possible this is a bug
> revealed/introduced by the recent piix4 refactoring, but I
> had a look at the code at the time this change was committed
> and afaict back then it also created the PIIX4_PM device,
> just in a different place. Indeed it is this commit which adds
> the CONFIG_ACPI_PIIX4=y to the config!)
>
> How is this intended to work? The obvious fix from my point
> of view would just be to say "piix4.c requires pcihp.c"
> and cause CONFIG_ACPI_PIIX4 to pull in CONFIG_ACPI_PCIHP,
> but that seems like it would be rather undoing the point
> of this change.

Yes. From the commit log and the vague recollection I have about this
change :

> For example, mips only needs support for PIIX4 and does not
> need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
> etc

So does malta really need acpi hotplug? If not, then the stubbing out of
the vmstate struct is correct.

But if Malta requires ACPI_PIIX4 and it
> creates the PIIX4_PM device, it needs the real pcihp.c and
> not the stubs, doesn't it ?
>
> thanks
> -- PMM
>


  parent reply	other threads:[~2022-07-20 18:40 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 21:35 [PULL 00/35] pc,pci,virtio: fixes, cleanups Michael S. Tsirkin
2021-09-04 21:35 ` [PULL 01/35] vhost-vdpa: Do not send empty IOTLB update batches Michael S. Tsirkin
2021-09-04 21:35 ` [PULL 02/35] hw/virtio: Fix leak of host-notifier memory-region Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 03/35] vhost: make SET_VRING_ADDR, SET_FEATURES send replies Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 04/35] hw/acpi: define PIIX4 acpi pci hotplug property strings at a single place Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 05/35] q35: catch invalid cpu hotplug configuration Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need Michael S. Tsirkin
2021-09-06  9:58   ` Philippe Mathieu-Daudé
2021-09-06 10:03     ` Ani Sinha
2021-09-06 10:24       ` Philippe Mathieu-Daudé
2021-09-06 10:49         ` Ani Sinha
2021-09-07  5:55           ` Ani Sinha
2021-09-07  6:13             ` Philippe Mathieu-Daudé
2021-09-07  6:34               ` Ani Sinha
2021-09-07  9:49                 ` Ani Sinha
2022-07-19 16:12   ` Peter Maydell
2022-07-19 16:21     ` Peter Maydell
2022-07-20 18:37     ` Ani Sinha [this message]
2022-07-20 21:34       ` Peter Maydell
2022-07-20 22:13         ` Ani Sinha
2022-07-21 10:51           ` BB
2022-07-21 12:35           ` Dr. David Alan Gilbert
2022-07-25 17:57             ` Ani Sinha
2021-09-04 21:36 ` [PULL 07/35] hw/virtio: move vhost_set_backend_type() to vhost.c Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 08/35] vhost-user: add missing space in error message Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 09/35] acpi: Delete broken ACPI_GED_X86 macro Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 10/35] Use PCI_HOST_BRIDGE macro Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 11/35] virtio-balloon: don't start free page hinting if postcopy is possible Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 12/35] virtio-balloon: free page hinting cleanups Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 13/35] virtio-bus: introduce iommu_enabled() Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 14/35] virtio-pci: implement iommu_enabled() Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 15/35] vhost: correctly detect the enabling IOMMU Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 16/35] hw/i386/acpi-build: Get NUMA information from struct NumaState Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 17/35] hw/pci: remove all references to find_i440fx function Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 18/35] hw/acpi: use existing references to pci device struct within functions Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 19/35] MAINTAINERS: Added myself as a reviewer for acpi/smbios subsystem Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 20/35] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 21/35] hw/virtio: Remove NULL check in virtio_free_region_cache() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 22/35] hw/virtio: Add flatview update in vhost_user_cleanup() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 23/35] tests/vhost-user-bridge.c: Sanity check socket path length Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 24/35] tests/vhost-user-bridge.c: Fix typo in help message Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 25/35] vhost-vdpa: remove unused variable "acked_features" Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 26/35] vhost-vdpa: correctly return err in vhost_vdpa_set_backend_cap() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 27/35] vhost_net: remove the meaningless assignment in vhost_net_start_one() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 28/35] vhost: use unsigned int for nvqs Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 29/35] vhost_net: do not assume nvqs is always 2 Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 30/35] vhost-vdpa: remove the unnecessary check in vhost_vdpa_add() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 31/35] vhost-vdpa: don't cleanup twice " Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 32/35] vhost-vdpa: fix leaking of vhost_net " Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 33/35] vhost-vdpa: tweak the error label " Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 34/35] vhost-vdpa: fix the wrong assertion in vhost_vdpa_init() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 35/35] vhost-vdpa: remove the unncessary queue_index assignment Michael S. Tsirkin
2021-09-06  9:41 ` [PULL 00/35] pc,pci,virtio: fixes, cleanups 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=alpine.DEB.2.22.394.2207201132430.9370@anisinha-lenovo \
    --to=ani@anisinha.ca \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=f4bug@amsat.org \
    --cc=imammedo@redhat.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=mst@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 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.