From: John Snow <jsnow@redhat.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: xen-devel@lists.xenproject.org,
"Stefano Stabellini" <sstabellini@kernel.org>,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH v2] piix: fix regression during unplug in Xen HVM domUs
Date: Mon, 22 Mar 2021 18:09:17 -0400 [thread overview]
Message-ID: <4441d32f-bd52-9408-cabc-146b59f0e4dc@redhat.com> (raw)
In-Reply-To: <20210317070046.17860-1-olaf@aepfle.de>
On 3/17/21 3:00 AM, Olaf Hering wrote:
> Commit ee358e919e385fdc79d59d0d47b4a81e349cd5c9 causes a regression in
> Xen HVM domUs which run xenlinux based kernels.
>
> If the domU has an USB device assigned, for example with
> "usbdevice=['tablet']" in domU.cfg, the late unplug of devices will
> kill the emulated USB host. As a result the khubd thread hangs, and as
> a result the entire boot process.
>
> For some reason this does not affect pvops based kernels. This is
> most likely caused by the fact that unplugging happens very early
> during boot.
>
I'm not entirely sure of how the commit message relates to the patch,
actually. (Sorry, I am not well familiar with XEN.)
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
> hw/ide/piix.c | 5 +++++
> include/hw/ide/pci.h | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> index b9860e35a5..7f1998bf04 100644
> --- a/hw/ide/piix.c
> +++ b/hw/ide/piix.c
> @@ -109,6 +109,9 @@ static void piix_ide_reset(DeviceState *dev)
> uint8_t *pci_conf = pd->config;
> int i;
>
> + if (d->xen_unplug_done == true) {
> + return;
> + }
My understanding is that XEN has some extra disks that it unplugs when
it later figures out it doesn't need them. How exactly this works is
something I've not looked into too closely.
So if these IDE devices have been "unplugged" already, we avoid
resetting them here. What about this reset causes the bug you describe
in the commit message?
Does this reset now happen earlier/later as compared to what it did
prior to ee358e91 ?
> for (i = 0; i < 2; i++) {
> ide_bus_reset(&d->bus[i]);
> }
> @@ -151,6 +154,7 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
> PCIIDEState *d = PCI_IDE(dev);
> uint8_t *pci_conf = dev->config;
>
> + d->xen_unplug_done = false;
> pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
>
> bmdma_setup_bar(d);
> @@ -170,6 +174,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev, bool aux)
> BlockBackend *blk;
>
> pci_ide = PCI_IDE(dev);
> + pci_ide->xen_unplug_done = true;
>
> for (i = aux ? 1 : 0; i < 4; i++) {
> idebus = &pci_ide->bus[i / 2];
> diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h
> index d8384e1c42..9e71cfec3b 100644
> --- a/include/hw/ide/pci.h
> +++ b/include/hw/ide/pci.h
> @@ -50,6 +50,7 @@ struct PCIIDEState {
> IDEBus bus[2];
> BMDMAState bmdma[2];
> uint32_t secondary; /* used only for cmd646 */
> + bool xen_unplug_done;
I am hesitant to put a new XEN-specific boolean here, but don't know
enough about the problem to outright say "no".
This looks like a band-aid that's out of place, but I don't understand
the problem well enough yet to suggest a better place.
> MemoryRegion bmdma_bar;
> MemoryRegion cmd_bar[2];
> MemoryRegion data_bar[2];
>
(If anyone else with more experience with XEN wants to take over the
review of this patch, let me know. I only really care about the IDE bits.)
next prev parent reply other threads:[~2021-03-22 22:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 7:00 [PATCH v2] piix: fix regression during unplug in Xen HVM domUs Olaf Hering
2021-03-22 22:09 ` John Snow [this message]
2021-03-25 11:12 ` Olaf Hering
2021-03-25 16:49 ` Paolo Bonzini
2023-05-09 22:58 ` Olaf Hering
2023-05-10 7:47 ` Olaf Hering
2023-05-12 21:12 ` Stefano Stabellini
2023-05-16 17:38 ` John Snow
2023-05-16 20:00 ` Olaf Hering
2023-06-26 21:19 ` Olaf Hering
2023-06-27 7:11 ` Paolo Bonzini
2023-06-27 10:12 ` Bernhard Beschow
2023-06-27 11:40 ` Olaf Hering
2023-06-27 12:07 ` Olaf Hering
2023-06-28 9:27 ` Bernhard Beschow
2023-06-30 7:29 ` Olaf Hering
2023-06-30 8:05 ` Bernhard Beschow
2023-06-30 11:32 ` Olaf Hering
2023-06-30 22:15 ` Bernhard Beschow
2023-06-30 8:48 ` Paolo Bonzini
2023-07-01 9:53 ` Bernhard Beschow
2023-07-01 11:58 ` Mark Cave-Ayland
2023-07-02 22:25 ` Bernhard Beschow
2023-06-27 11:32 ` Olaf Hering
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=4441d32f-bd52-9408-cabc-146b59f0e4dc@redhat.com \
--to=jsnow@redhat.com \
--cc=f4bug@amsat.org \
--cc=olaf@aepfle.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).