From: Paolo Bonzini Subject: Re: [PULL 00/20] acpi,pc,pci fixes and enhancements Date: Tue, 18 Feb 2014 14:10:48 +0100 Message-ID: <53035BD8.6050805@redhat.com> References: <1392050814-31814-1-git-send-email-mst@redhat.com> <530351B4.1010402@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Stefano Stabellini Cc: Peter Maydell , xen-devel@lists.xensource.com, "Michael S. Tsirkin" , QEMU Developers , armbru@redhat.com, Anthony Liguori , Anthony.Perard@citrix.com List-Id: xen-devel@lists.xenproject.org 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. Paolo