From patchwork Tue Feb 18 13:08:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 321467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 23CE82C00C4 for ; Wed, 19 Feb 2014 00:09:44 +1100 (EST) Received: from localhost ([::1]:49148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFkQf-0006zS-V2 for incoming@patchwork.ozlabs.org; Tue, 18 Feb 2014 08:09:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFkQF-0006th-9P for qemu-devel@nongnu.org; Tue, 18 Feb 2014 08:09:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFkQA-0004qC-Ga for qemu-devel@nongnu.org; Tue, 18 Feb 2014 08:09:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFkQA-0004q5-6y for qemu-devel@nongnu.org; Tue, 18 Feb 2014 08:09:10 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1ID921h004648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Feb 2014 08:09:02 -0500 Received: from nial.usersys.redhat.com (dhcp-1-126.brq.redhat.com [10.34.1.126]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1ID8xY9026315; Tue, 18 Feb 2014 08:09:00 -0500 Date: Tue, 18 Feb 2014 14:08:58 +0100 From: Igor Mammedov To: Stefano Stabellini Message-ID: <20140218140858.4bcc511b@nial.usersys.redhat.com> In-Reply-To: References: <1392050814-31814-1-git-send-email-mst@redhat.com> <530351B4.1010402@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , xen-devel@lists.xensource.com, "Michael S. Tsirkin" , QEMU Developers , armbru@redhat.com, Anthony Liguori , Anthony.Perard@citrix.com, Paolo Bonzini Subject: Re: [Qemu-devel] [PULL 00/20] acpi,pc,pci fixes and enhancements X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Tue, 18 Feb 2014 12:45:29 +0000 Stefano Stabellini wrote: > On Tue, 18 Feb 2014, Paolo Bonzini wrote: > > Il 18/02/2014 13:16, Stefano Stabellini ha scritto: > > > It looks like that this series breaks disk unplug > > > (hw/ide/piix.c:pci_piix3_xen_ide_unplug). > > > > > > I bisected it and the problem is caused by: > > > > > > commit 5e95494380ecf83c97d28f72134ab45e0cace8f9 > > > Author: Igor Mammedov > > > Date: Wed Feb 5 16:36:52 2014 +0100 > > > > > > hw/pci: switch to a generic hotplug handling for PCIDevice > > > > > > make qdev_unplug()/device_set_realized() to call hotplug handler's > > > plug/unplug methods if available and remove not needed anymore > > > hot(un)plug handling from PCIDevice. > > > > > > In case if hotplug handler is not available, revert to the legacy > > > hotplug method for compatibility with not yet converted buses. > > > > > > Signed-off-by: Igor Mammedov > > > Reviewed-by: Michael S. Tsirkin > > > Signed-off-by: Michael S. Tsirkin > > > > > > > > > > What exactly breaks? > > 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. > Could you try with following debug patch? diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 64b66e0..84aa8be 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -214,6 +214,7 @@ void qdev_unplug(DeviceState *dev, Error **errp) return; } + fprintf(stderr, "dc->hotpluggable %d\n", dc->hotpluggable); if (!dc->hotpluggable) { error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(OBJECT(dev))); @@ -223,8 +224,12 @@ void qdev_unplug(DeviceState *dev, Error **errp) qdev_hot_removed = true; if (dev->parent_bus && dev->parent_bus->hotplug_handler) { + fprintf(stderr, "bus name: %s, hotplug_handler: %s\n", + dev->parent_bus->name, + object_get_typename(OBJECT(dev->parent_bus->hotplug_handler))); hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev, errp); } else { + fprintf(stderr, "legacy unplug: %p\n", dc->unplug); assert(dc->unplug != NULL); if (dc->unplug(dev) < 0) { /* legacy handler */ error_set(errp, QERR_UNDEFINED_ERROR); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1acd2b2..74b0cac 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -238,6 +238,7 @@ static void pc_init1(QEMUMachineInitArgs *args, if (pci_enabled && acpi_enabled) { i2c_bus *smbus; + fprintf(stderr, "create piix4_pm_init\n"); smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); /* TODO: Populate SPD eeprom data. */ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,