public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] virtio-pci: mask notifier error handling fixups
Date: Tue, 18 Jan 2011 08:29:13 -0700	[thread overview]
Message-ID: <1295364553.30628.7.camel@x201> (raw)
In-Reply-To: <20110118134257.GA30044@redhat.com>

On Tue, 2011-01-18 at 15:42 +0200, Michael S. Tsirkin wrote:
> Fix virtio-pci error handling in the mask notifiers: be careful to undo
> exactly what we did so far.
> 
> Reported-by: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---

Looks right.

Acked-by: Alex Williamson <alex.williamson@redhat.com>

>  hw/virtio-pci.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index bf3cf4f..dd8887a 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -612,6 +612,9 @@ static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
>      return 0;
>  undo:
>      while (--n >= 0) {
> +        if (virtio_queue_vector(vdev, n) != vector) {
> +            continue;
> +        }
>          virtio_pci_mask_vq(dev, vector, virtio_get_queue(vdev, n), !masked);
>      }
>      return r;
> @@ -681,9 +684,18 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
>  
>  assign_error:
>      /* We get here on assignment failure. Recover by undoing for VQs 0 .. n. */
> +    if (assign) {
> +        msix_unset_mask_notifier(&proxy->pci_dev);
> +    }
> +
>      while (--n >= 0) {
>          virtio_pci_set_guest_notifier(opaque, n, !assign);
>      }
> +
> +    if (!assign) {
> +        msix_set_mask_notifier(&proxy->pci_dev,
> +                               virtio_pci_mask_notifier);
> +    }
>      return r;
>  }
>  




  reply	other threads:[~2011-01-18 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 13:42 [PATCH] virtio-pci: mask notifier error handling fixups Michael S. Tsirkin
2011-01-18 15:29 ` Alex Williamson [this message]
2011-01-20 16:34 ` Marcelo Tosatti

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=1295364553.30628.7.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@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