From patchwork Sun May 9 16:15:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 52002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 14DA7B7D47 for ; Mon, 10 May 2010 02:20:06 +1000 (EST) Received: from localhost ([127.0.0.1]:44449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OB9EZ-00050H-5K for incoming@patchwork.ozlabs.org; Sun, 09 May 2010 12:20:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OB9Dv-000501-Oy for qemu-devel@nongnu.org; Sun, 09 May 2010 12:19:23 -0400 Received: from [140.186.70.92] (port=47486 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OB9Dt-0004zQ-CN for qemu-devel@nongnu.org; Sun, 09 May 2010 12:19:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OB9Dr-0004KE-Sc for qemu-devel@nongnu.org; Sun, 09 May 2010 12:19:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8030) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OB9Dr-0004K2-LK for qemu-devel@nongnu.org; Sun, 09 May 2010 12:19:19 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o49GJFZC010537 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 9 May 2010 12:19:15 -0400 Received: from redhat.com (vpn1-6-177.ams2.redhat.com [10.36.6.177]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o49GJDLA017773; Sun, 9 May 2010 12:19:13 -0400 Date: Sun, 9 May 2010 19:15:16 +0300 From: "Michael S. Tsirkin" To: quintela@redhat.com, qemu-devel@nongnu.org, Anthony Liguori Message-ID: <20100509161503.GA20492@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH master+0.12] pci: irq_state vmstate breakage X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Code for saving irq_state got vm_state macros wrong, passing in the wrong parameter. As a result, we both saved a wrong value and restored it to a wrong offset. This leads to device and bus irq counts getting out of sync, which in turn leads to interrupts getting lost or never cleared, such as https://bugzilla.redhat.com/show_bug.cgi?id=588133 Signed-off-by: Michael S. Tsirkin Acked-by: Juan Quintela --- Juan, could you please take a look at this patch? I managed to catch this bug by looking at a savevm image which already has a wrong value, but I could not reproduce it locally so I don't know for sure whether patch is enough, or there are other bugs. Anthony, this is a regression introduced in eea4acfa5c1ef26439a718375475fe468b7f2fba so we need the fix on 0.12 branch as well. hw/pci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 95bfa3d..5452b86 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -325,7 +325,7 @@ static VMStateInfo vmstate_info_pci_config = { static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size) { - PCIDevice *s = container_of(pv, PCIDevice, config); + PCIDevice *s = container_of(pv, PCIDevice, irq_state); uint32_t irq_state[PCI_NUM_PINS]; int i; for (i = 0; i < PCI_NUM_PINS; ++i) { @@ -347,7 +347,7 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size) static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size) { int i; - PCIDevice *s = container_of(pv, PCIDevice, config); + PCIDevice *s = container_of(pv, PCIDevice, irq_state); for (i = 0; i < PCI_NUM_PINS; ++i) { qemu_put_be32(f, pci_irq_state(s, i));