Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357975 > unrolled thread

question about pci_enable_msix_range

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2016-03-15 11:30 +0100
Last post2016-03-15 15:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  question about pci_enable_msix_range Julia Lawall <julia.lawall@lip6.fr> - 2016-03-15 11:30 +0100
    Re: question about pci_enable_msix_range Alex Williamson <alex.williamson@redhat.com> - 2016-03-15 15:30 +0100
      Re: question about pci_enable_msix_range Julia Lawall <julia.lawall@lip6.fr> - 2016-03-15 15:40 +0100

#1357975 — question about pci_enable_msix_range

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-03-15 11:30 +0100
Subjectquestion about pci_enable_msix_range
Message-ID<rcUoG-If-23@gated-at.bofh.it>
Hello,

I was looking at the following code in the file
drivers/vfio/pci/vfio_pci_intrs.c:

                ret = pci_enable_msix_range(pdev, vdev->msix, 1, nvec);
                if (ret < nvec) {
                        if (ret > 0)
                                pci_disable_msix(pdev);
                        kfree(vdev->msix);
                        kfree(vdev->ctx);
                        return ret;
                }

I was wondering what is the point of using a range of 1 .. nvec if there
is going to be a failure if the number of allocated irqs is less than
nvec?

thanks,
julia

[toc] | [next] | [standalone]


#1358064

FromAlex Williamson <alex.williamson@redhat.com>
Date2016-03-15 15:30 +0100
Message-ID<rcY8V-3eT-1@gated-at.bofh.it>
In reply to#1357975
On Tue, 15 Mar 2016 11:26:50 +0100 (CET)
Julia Lawall <julia.lawall@lip6.fr> wrote:

> Hello,
> 
> I was looking at the following code in the file
> drivers/vfio/pci/vfio_pci_intrs.c:
> 
>                 ret = pci_enable_msix_range(pdev, vdev->msix, 1, nvec);
>                 if (ret < nvec) {
>                         if (ret > 0)
>                                 pci_disable_msix(pdev);
>                         kfree(vdev->msix);
>                         kfree(vdev->ctx);
>                         return ret;
>                 }
> 
> I was wondering what is the point of using a range of 1 .. nvec if there
> is going to be a failure if the number of allocated irqs is less than
> nvec?

Hi Julia,

The intention is that on failure we can indicate to the user a value
that might work.  If we were to call with {nvec, nvec} we'd only get
back -ENOSPC and the user could only arbitrarily decrease the request
by some amount and try again.  By using {1, nvec} we can hopefully
provide a useful next step.  On the other hand, we haven't enabled the
number of vectors the user requested, so it doesn't seem to make sense
to leave any enabled.  Thanks,

Alex

[toc] | [prev] | [next] | [standalone]


#1358077

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-03-15 15:40 +0100
Message-ID<rcYiC-3jk-25@gated-at.bofh.it>
In reply to#1358064

On Tue, 15 Mar 2016, Alex Williamson wrote:

> On Tue, 15 Mar 2016 11:26:50 +0100 (CET)
> Julia Lawall <julia.lawall@lip6.fr> wrote:
>
> > Hello,
> >
> > I was looking at the following code in the file
> > drivers/vfio/pci/vfio_pci_intrs.c:
> >
> >                 ret = pci_enable_msix_range(pdev, vdev->msix, 1, nvec);
> >                 if (ret < nvec) {
> >                         if (ret > 0)
> >                                 pci_disable_msix(pdev);
> >                         kfree(vdev->msix);
> >                         kfree(vdev->ctx);
> >                         return ret;
> >                 }
> >
> > I was wondering what is the point of using a range of 1 .. nvec if there
> > is going to be a failure if the number of allocated irqs is less than
> > nvec?
>
> Hi Julia,
>
> The intention is that on failure we can indicate to the user a value
> that might work.  If we were to call with {nvec, nvec} we'd only get
> back -ENOSPC and the user could only arbitrarily decrease the request
> by some amount and try again.  By using {1, nvec} we can hopefully
> provide a useful next step.  On the other hand, we haven't enabled the
> number of vectors the user requested, so it doesn't seem to make sense
> to leave any enabled.  Thanks,

Ah, OK I see now that the ret will be the value that works in this case,
not a normal failure value.  Thanks for the feedback, which has made
things a lot clearer.

julia

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web