From: John Snow <jsnow@redhat.com>
To: "Marc Marí" <marc.mari.barcelo@gmail.com>, qemu-devel@nongnu.org
Cc: afaerber@suse.de, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c
Date: Tue, 24 Feb 2015 13:09:01 -0500 [thread overview]
Message-ID: <54ECBE3D.3060808@redhat.com> (raw)
In-Reply-To: <1424795655-16952-1-git-send-email-marc.mari.barcelo@gmail.com>
On 02/24/2015 11:34 AM, Marc Marí 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í <marc.mari.barcelo@gmail.com>
> ---
> 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 = readl(vqpci->msix_addr);
> - writel(vqpci->msix_addr, 0);
> - return data == vqpci->msix_data;
> + if (data == 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 = readl(dev->config_msix_addr);
> - writel(dev->config_msix_addr, 0);
> - return data == dev->config_msix_data;
> + if (data == 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 <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
next prev parent reply other threads:[~2015-02-24 18:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 16:34 [Qemu-devel] [PATCH] libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c Marc Marí
2015-02-24 18:09 ` John Snow [this message]
2015-03-10 20:50 ` John Snow
2015-03-10 20:53 ` Marc Marí
2015-03-10 20:53 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54ECBE3D.3060808@redhat.com \
--to=jsnow@redhat.com \
--cc=afaerber@suse.de \
--cc=marc.mari.barcelo@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).