From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUgnQ-00024v-U7 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUgnK-0007xA-Pe for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:18:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUgnK-0007wo-GJ for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:18:50 -0400 Message-ID: <5339B184.1090503@redhat.com> Date: Mon, 31 Mar 2014 20:18:44 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <53387E35.3010909@redhat.com> <533899F1.1030808@suse.de> <5339B077.4040707@redhat.com> In-Reply-To: <5339B077.4040707@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] 2.0 regression: loadvm assertion with ehci + tablet List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cole Robinson , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: "Michael S. Tsirkin" , qemu-devel , Gerd Hoffmann Il 31/03/2014 20:14, Cole Robinson ha scritto: > irq_state is cleared before pci_device_deassert_intx. But tries to clear all > irqs via pci_irq_handler, but that function will exit without taking any > action if the requested irq level matches what we already track in irq_state. > Since irq_state is 0, pci_device_deassert_intx is basically a no-op. Any > interrupts with level=1 will not be cleared, which is the case with the usb > tablet after usb_detach. Thanks for the analysis. It's my bug indeed. > This fixes things for me, but I have no idea if it's the proper fix: > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 8f722dd..1912dfb 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -189,9 +189,9 @@ static void pci_do_device_reset(PCIDevice *dev) > { > int r; > > + pci_device_deassert_intx(dev); > dev->irq_state = 0; > pci_update_irq_status(dev); > - pci_device_deassert_intx(dev); > /* Clear all writable bits */ > pci_word_test_and_clear_mask(dev->config + PCI_COMMAND, > pci_get_word(dev->wmask + PCI_COMMAND) | Yes, the patch is fine. Even better, dev->irq_state = 0 could become an assertion too, and the call to pci_update_irq_status is not necessary at all. Paolo