From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
xen-devel@lists.xensource.com,
QEMU Developers <qemu-devel@nongnu.org>,
armbru@redhat.com, Anthony Liguori <aliguori@amazon.com>,
Anthony.Perard@citrix.com, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PULL 00/20] acpi,pc,pci fixes and enhancements
Date: Wed, 19 Feb 2014 11:29:04 +0200 [thread overview]
Message-ID: <20140219092904.GA11116@redhat.com> (raw)
In-Reply-To: <20140219090825.GA10646@redhat.com>
On Wed, Feb 19, 2014 at 11:08:25AM +0200, Michael S. Tsirkin wrote:
> On Tue, Feb 18, 2014 at 05:10:00PM +0000, Stefano Stabellini wrote:
> > On Tue, 18 Feb 2014, Paolo Bonzini wrote:
> > > Il 18/02/2014 15:25, Stefano Stabellini ha scritto:
> > > > On Tue, 18 Feb 2014, Paolo Bonzini wrote:
> > > > > Il 18/02/2014 13:45, Stefano Stabellini ha scritto:
> > > > > > Disk unplug: hw/ide/piix.c:pci_piix3_xen_ide_unplug (see the beginning
> > > > > > of the email :-P).
> > > > > > It is called by hw/xen/xen_platform.c:platform_fixed_ioport_writew, in
> > > > > > response to the guest writing to a magic ioport specifically to unplug
> > > > > > the emulated disk.
> > > > > > With this patch after the guest boots I can still access both xvda and
> > > > > > sda for the same disk, leading to fs corruptions.
> > > > >
> > > > > Ok, the last paragraph is what I was missing.
> > > > >
> > > > > So this is dc->unplug for the PIIX3 IDE device. Because PCI declares a
> > > > > hotplug handler, dc->unplug is not called anymore.
> > > > >
> > > > > But unlike other dc->unplug callbacks, pci_piix3_xen_ide_unplug doesn't
> > > > > free
> > > > > the device, it just drops the disks underneath. I think the simplest
> > > > > solution
> > > > > is to _not_ make it a dc->unplug callback at all, and call
> > > > > pci_piix3_xen_ide_unplug from unplug_disks instead of qdev_unplug.
> > > > > qdev_unplug means "ask guest to start unplug", which is not what Xen wants
> > > > > to
> > > > > do here.
> > > >
> > > > Yes, you are right, pci_piix3_xen_ide_unplug is not called anymore.
> > > > Calling it directly from unplug_disks fixes the issue:
> > > >
> > > >
> > > > ---
> > > >
> > > > Call pci_piix3_xen_ide_unplug from unplug_disks
> > > >
> > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > >
> > > > diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> > > > index 0eda301..40757eb 100644
> > > > --- a/hw/ide/piix.c
> > > > +++ b/hw/ide/piix.c
> > > > @@ -167,7 +167,7 @@ static int pci_piix_ide_initfn(PCIDevice *dev)
> > > > return 0;
> > > > }
> > > >
> > > > -static int pci_piix3_xen_ide_unplug(DeviceState *dev)
> > > > +int pci_piix3_xen_ide_unplug(DeviceState *dev)
> > > > {
> > > > PCIIDEState *pci_ide;
> > > > DriveInfo *di;
> > > > @@ -266,7 +266,6 @@ static void piix3_ide_xen_class_init(ObjectClass *klass,
> > > > void *data)
> > > > k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
> > > > k->class_id = PCI_CLASS_STORAGE_IDE;
> > > > set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
> > > > - dc->unplug = pci_piix3_xen_ide_unplug;
> > > > }
> > > >
> > > > static const TypeInfo piix3_ide_xen_info = {
> > > > diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
> > > > index 70875e4..1d9d0e9 100644
> > > > --- a/hw/xen/xen_platform.c
> > > > +++ b/hw/xen/xen_platform.c
> > > > @@ -27,6 +27,7 @@
> > > >
> > > > #include "hw/hw.h"
> > > > #include "hw/i386/pc.h"
> > > > +#include "hw/ide.h"
> > > > #include "hw/pci/pci.h"
> > > > #include "hw/irq.h"
> > > > #include "hw/xen/xen_common.h"
> > > > @@ -110,7 +111,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void
> > > > *o)
> > > > if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
> > > > PCI_CLASS_STORAGE_IDE
> > > > && strcmp(d->name, "xen-pci-passthrough") != 0) {
> > > > - qdev_unplug(DEVICE(d), NULL);
> > > > + pci_piix3_xen_ide_unplug(DEVICE(d));
> > > > }
> > > > }
> > > >
> > > > diff --git a/include/hw/ide.h b/include/hw/ide.h
> > > > index 507e6d3..bc8bd32 100644
> > > > --- a/include/hw/ide.h
> > > > +++ b/include/hw/ide.h
> > > > @@ -17,6 +17,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo
> > > > **hd_table,
> > > > PCIDevice *pci_piix3_xen_ide_init(PCIBus *bus, DriveInfo **hd_table, int
> > > > devfn);
> > > > PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int
> > > > devfn);
> > > > PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int
> > > > devfn);
> > > > +int pci_piix3_xen_ide_unplug(DeviceState *dev);
> > > > void vt82c686b_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn);
> > > >
> > > > /* ide-mmio.c */
> > > >
> > >
> > > Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> >
> > Thanks. Should I send it to Peter via the xen tree or anybody else wants
> > to pick this up?
>
> I'll rebase my tree on top of this, to avoid bisect failures.
Oh sorry, I noticed what broke this is - is merged already.
Pls merge fix through xen tree then, makes more sense.
next prev parent reply other threads:[~2014-02-19 9:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 16:47 [Qemu-devel] [PULL 00/20] acpi,pc,pci fixes and enhancements Michael S. Tsirkin
2014-02-10 16:47 ` [Qemu-devel] [PULL 01/20] pcihp: reduce number of device check events Michael S. Tsirkin
2014-02-10 16:47 ` [Qemu-devel] [PULL 02/20] pcihp: replace enable|disable_device() with oneliners Michael S. Tsirkin
2014-02-10 16:47 ` [Qemu-devel] [PULL 03/20] pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR Michael S. Tsirkin
2014-02-10 16:47 ` [Qemu-devel] [PULL 04/20] pcihp: make pci_read() mmio calback compatible with legacy ACPI hotplug Michael S. Tsirkin
2014-02-10 16:47 ` [Qemu-devel] [PULL 05/20] pcihp: remove unused AcpiPciHpPciStatus.device_present field Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 06/20] hw:piix4:acpi: reuse pcihp code for legacy PCI hotplug Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 07/20] qtest: don't report signals if qtest driver enabled Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 08/20] pc_piix: enable legacy hotplug for Xen Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 09/20] pc.c: better error message on initrd sizing failure Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 10/20] loader: document that errno is set Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 11/20] define hotplug interface Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 12/20] qdev: add to BusState "hotplug-handler" link Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 13/20] qdev: add "hotpluggable" property to Device Michael S. Tsirkin
2014-02-18 16:35 ` Andreas Färber
2014-02-18 16:55 ` Igor Mammedov
2014-03-07 17:56 ` Andreas Färber
2014-02-10 16:48 ` [Qemu-devel] [PULL 14/20] hw/acpi: move typeinfo to the file end Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 15/20] qdev:pci: refactor PCIDevice to use generic "hotpluggable" property Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 16/20] acpi/piix4pm: convert ACPI PCI hotplug to use hotplug-handler API Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 17/20] pci/shpc: convert SHPC " Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 18/20] pci/pcie: convert PCIE " Michael S. Tsirkin
2014-02-10 16:48 ` [Qemu-devel] [PULL 19/20] hw/pci: switch to a generic hotplug handling for PCIDevice Michael S. Tsirkin
2014-02-10 16:49 ` [Qemu-devel] [PULL 20/20] ACPI: Remove commented-out code from HPET._CRS Michael S. Tsirkin
2014-02-13 16:29 ` [Qemu-devel] [PULL 00/20] acpi,pc,pci fixes and enhancements Peter Maydell
2014-02-18 12:16 ` Stefano Stabellini
2014-02-18 12:27 ` Paolo Bonzini
2014-02-18 12:45 ` Stefano Stabellini
2014-02-18 13:08 ` Igor Mammedov
2014-02-18 14:27 ` Stefano Stabellini
2014-02-18 13:10 ` Paolo Bonzini
2014-02-18 14:25 ` Stefano Stabellini
2014-02-18 14:26 ` Paolo Bonzini
2014-02-18 17:10 ` Stefano Stabellini
2014-02-19 9:08 ` Michael S. Tsirkin
2014-02-19 9:29 ` Michael S. Tsirkin [this message]
2014-02-19 11:53 ` Stefano Stabellini
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=20140219092904.GA11116@redhat.com \
--to=mst@redhat.com \
--cc=Anthony.Perard@citrix.com \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.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 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).