From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFkS2-00011V-5E for qemu-devel@nongnu.org; Tue, 18 Feb 2014 08:11:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFkRw-0005rj-3n for qemu-devel@nongnu.org; Tue, 18 Feb 2014 08:11:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFkRv-0005rQ-SK for qemu-devel@nongnu.org; Tue, 18 Feb 2014 08:11:00 -0500 Message-ID: <53035BD8.6050805@redhat.com> Date: Tue, 18 Feb 2014 14:10:48 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1392050814-31814-1-git-send-email-mst@redhat.com> <530351B4.1010402@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 00/20] acpi,pc,pci fixes and enhancements List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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