From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVR9Z-0000RN-JW for qemu-devel@nongnu.org; Tue, 10 Mar 2015 16:53:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVR9W-0007p9-Bn for qemu-devel@nongnu.org; Tue, 10 Mar 2015 16:53:25 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:37117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVR9W-0007ne-4q for qemu-devel@nongnu.org; Tue, 10 Mar 2015 16:53:22 -0400 Received: by wesx3 with SMTP id x3so4633749wes.4 for ; Tue, 10 Mar 2015 13:53:21 -0700 (PDT) Date: Tue, 10 Mar 2015 21:53:17 +0100 From: Marc =?UTF-8?B?TWFyw60=?= Message-ID: <20150310215317.38d6a69b@crunchbang> In-Reply-To: <54FF5928.1050607@redhat.com> References: <1424795655-16952-1-git-send-email-marc.mari.barcelo@gmail.com> <54ECBE3D.3060808@redhat.com> <54FF5928.1050607@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: qemu-devel@nongnu.org, stefanha@redhat.com, afaerber@suse.de El Tue, 10 Mar 2015 16:50:48 -0400 John Snow escribi=C3=B3: >=20 >=20 > On 02/24/2015 01:09 PM, John Snow wrote: > > > > > > On 02/24/2015 11:34 AM, Marc Mar=C3=AD wrote: > >> The MSIX interrupt was always acked without checking its value, > >> which caused a > >> race condition. If the ISR was raised between the read and the > >> acking, the ISR > >> was never detected and it timed out. > >> > >> Signed-off-by: Marc Mar=C3=AD > >> --- > >> tests/libqos/virtio-pci.c | 16 ++++++++++++---- > >> 1 file changed, 12 insertions(+), 4 deletions(-) > >> > >> diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c > >> index 788ebaf..c74a669 100644 > >> --- a/tests/libqos/virtio-pci.c > >> +++ b/tests/libqos/virtio-pci.c > >> @@ -140,8 +140,12 @@ static bool > >> qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq) > >> return qpci_msix_pending(dev->pdev, > >> vqpci->msix_entry); } else { > >> data =3D readl(vqpci->msix_addr); > >> - writel(vqpci->msix_addr, 0); > >> - return data =3D=3D vqpci->msix_data; > >> + if (data =3D=3D vqpci->msix_data) { > >> + writel(vqpci->msix_addr, 0); > >> + return true; > >> + } else { > >> + return false; > >> + } > >> } > >> } else { > >> return qpci_io_readb(dev->pdev, dev->addr + > >> QVIRTIO_ISR_STATUS) & 1; > >> @@ -160,8 +164,12 @@ static bool > >> qvirtio_pci_get_config_isr_status(QVirtioDevice *d) > >> return qpci_msix_pending(dev->pdev, > >> dev->config_msix_entry); > >> } else { > >> data =3D readl(dev->config_msix_addr); > >> - writel(dev->config_msix_addr, 0); > >> - return data =3D=3D dev->config_msix_data; > >> + if (data =3D=3D dev->config_msix_data) { > >> + writel(dev->config_msix_addr, 0); > >> + return true; > >> + } else { > >> + return false; > >> + } > >> } > >> } else { > >> return qpci_io_readb(dev->pdev, dev->addr + > >> QVIRTIO_ISR_STATUS) & 2; > >> > > > > 1,600+ runs and no hang, thanks :) > > > > Tested-by: John Snow > > Reviewed-by: John Snow > > >=20 > Ping? >=20 > Still hitting this failure upstream. I think this is in Stefan's pull request, which has issues merging. Marc