* question about pci_enable_msix_range
@ 2016-03-15 10:26 Julia Lawall
2016-03-15 14:29 ` Alex Williamson
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2016-03-15 10:26 UTC (permalink / raw)
To: alex.williamson, kvm, linux-kernel
Cc: Alexander Gordeev, Bjorn Helgaas, Alex Williamson
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about pci_enable_msix_range
2016-03-15 10:26 question about pci_enable_msix_range Julia Lawall
@ 2016-03-15 14:29 ` Alex Williamson
2016-03-15 14:33 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2016-03-15 14:29 UTC (permalink / raw)
To: Julia Lawall; +Cc: kvm, linux-kernel, Alexander Gordeev, Bjorn Helgaas
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about pci_enable_msix_range
2016-03-15 14:29 ` Alex Williamson
@ 2016-03-15 14:33 ` Julia Lawall
0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2016-03-15 14:33 UTC (permalink / raw)
To: Alex Williamson; +Cc: kvm, linux-kernel, Alexander Gordeev, Bjorn Helgaas
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-15 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15 10:26 question about pci_enable_msix_range Julia Lawall
2016-03-15 14:29 ` Alex Williamson
2016-03-15 14:33 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.