Re: [PATCH] Fix bugs in msix_set/unset_mask_notifier() routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>

Note: this is qemu-kvm only patch.

> 
> 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;
>      }
>      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;
>  }
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux