> -----Original Message-----
> From: Jan Beulich <jbeul...@suse.com>
> Sent: 05 December 2019 08:44
> To: Durrant, Paul <pdurr...@amazon.com>
> Cc: Sander Eikelenboom <li...@eikelenboom.it>; xen-
> de...@lists.xenproject.org; Igor Druzhinin <igor.druzhi...@citrix.com>;
> Paul Durrant <p...@xen.org>
> Subject: Re: xen-unstable (4.14 to be): Assertion '!preempt_count()'
> failed at preempt.c:36
> 
> On 05.12.2019 09:35, Durrant, Paul wrote:
> > --- a/xen/drivers/passthrough/pci.c
> > +++ b/xen/drivers/passthrough/pci.c
> > @@ -1696,16 +1696,12 @@ int iommu_do_pci_domctl(
> >
> >          pcidevs_lock();
> >          ret = device_assigned(seg, bus, devfn);
> > -        if ( domctl->cmd == XEN_DOMCTL_test_assign_device )
> > +        if ( ret && domctl->cmd == XEN_DOMCTL_test_assign_device )
> >          {
> > -            if ( ret )
> > -            {
> > -                printk(XENLOG_G_INFO
> > -                       "%04x:%02x:%02x.%u already assigned, or non-
> existent\n",
> > -                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
> > -                ret = -EINVAL;
> > -            }
> > -            break;
> > +            printk(XENLOG_G_INFO
> > +                   "%04x:%02x:%02x.%u already assigned, or non-
> existent\n",
> > +                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
> > +            ret = -EINVAL;
> >          }
> 
> But this seems wrong - you'd end up calling assign_device() even
> for the XEN_DOMCTL_test_assign_device case, when ret is 0. All we
> want is to delete the break statement afaict.
> 

Ah, yes; that logic is quite confusing. The patch should indeed be:

---8<---
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ced0c28e4f..c07a63981a 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1705,7 +1705,6 @@ int iommu_do_pci_domctl(
                        seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
                 ret = -EINVAL;
             }
-            break;
         }
         else if ( !ret )
             ret = assign_device(d, seg, bus, devfn, flags);
---8<---

> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to