kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sridhar Samudrala <sri@us.ibm.com>
Cc: Avi Kivity <avi@redhat.com>, "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] Fix bugs in msix_set/unset_mask_notifier() routines
Date: Wed, 2 Jun 2010 20:47:04 +0300	[thread overview]
Message-ID: <20100602174704.GA16303@redhat.com> (raw)
In-Reply-To: <1275494978.989.62.camel@w-sridhar.beaverton.ibm.com>

On Wed, Jun 02, 2010 at 09:09:37AM -0700, Sridhar Samudrala wrote:
> 
> I am hitting the following assertions in msix.c when doing a guest reboot or live migration
> using vhost.
> qemu-kvm/hw/msix.c:375: msix_mask_all: Assertion `r >= 0' failed.
> qemu-kvm/hw/msix.c:640: msix_unset_mask_notifier: Assertion `dev->msix_mask_notifier_opaque[vector]' failed.
> 
> The following patch fixes the bugs in handling msix_is_masked() condition
> in msix_set/unset_mask_notifier() routines.
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> 

I take back the ACK.

> diff --git a/hw/msix.c b/hw/msix.c
> index 1398680..a191df1 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -609,7 +609,7 @@ void msix_unuse_all_vectors(PCIDevice *dev)
>  
>  int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque)
>  {
> -    int r;
> +    int r = 0;
>      if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
>          return 0;
>  
> @@ -619,13 +619,15 @@ int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque)
>  
>      /* Unmask the new notifier unless vector is masked. */
>      if (msix_is_masked(dev, vector)) {
> -        return 0;
> +        goto out;
>      }
>      r = dev->msix_mask_notifier(dev, vector, opaque,
>                                  msix_is_masked(dev, vector));
>      if (r < 0) {
>          return r;
>      }
> +
> +out:
>      dev->msix_mask_notifier_opaque[vector] = opaque;
>      return r;
>  }
> @@ -640,8 +642,8 @@ int msix_unset_mask_notifier(PCIDevice *dev, unsigned vector)
>      assert(dev->msix_mask_notifier_opaque[vector]);
>  
>      /* Mask the old notifier unless it is already masked. */
> -    if (msix_is_masked(dev, vector)) {
> -        return 0;
> +    if (!msix_is_masked(dev, vector)) {
> +        goto out;
>      }

Wait a second, the logic is reverted here.

>      r = dev->msix_mask_notifier(dev, vector,
>                                  dev->msix_mask_notifier_opaque[vector],
> @@ -649,6 +651,8 @@ int msix_unset_mask_notifier(PCIDevice *dev, unsigned vector)
>      if (r < 0) {
>          return r;
>      }
> +
> +out:
>      dev->msix_mask_notifier_opaque[vector] = NULL;
>      return r;
>  }
> 
> 


I find the goto's confusing. I'll post a patch without.



      parent reply	other threads:[~2010-06-02 17:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 16:09 [PATCH] Fix bugs in msix_set/unset_mask_notifier() routines Sridhar Samudrala
2010-06-02 17:14 ` Michael S. Tsirkin
2010-06-02 17:47 ` Michael S. Tsirkin [this message]

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=20100602174704.GA16303@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=sri@us.ibm.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).