Re: [dpdk-dev] [PATCH 0/2] uio_msi: device driver

Alexander Duyck
2015-10-02T01:39:13Z

On 10/01/2015 05:04 PM, Stephen Hemminger wrote:
> On Thu, 1 Oct 2015 16:43:23 -0700
> Alexander Duyck <alexander.duyck@gmail.com> wrote:
>
>> Yes, but in the case of something like a VF it is going to just make a
>> bigger mess of things since INTx doesn't work. So what would you expect
>> your driver to do in that case? Also we have to keep in mind that the
>> MSI-X failure case is very unlikely.
>>
>> One other thing that just occurred to me is that you may want to try
>> using the range allocation call instead of a hard set number of
>> interrupts. Then if you start running short on vectors you don't hard
>> fail and instead just allocate what you can.
> I tried that but the bookkeeping gets messy since there is no good
> way to communicate that back to userspace and have it adapt.

Actually I kind of just realized that uio_msi_open is kind of messed
up. So if the MSI-X allocation fails due to no resources it will return
a positive value indicating the number of vectors that could be
allocated, a negative value if one of the input values is invalid, or
0. I'm not sure if returning a positive value on failure is an issue or
not. I know the open call is supposed to return a negative value or the
file descriptor if not negative. I don't know if the return value might
be interpreted as a file descriptor or not.

Also if MSI-X is supported by the hardware, but disabled for some reason
by the kernel ("pci=nomsi") then this driver is rendered inoperable
since it will never give you anything but -EINVAL from the open call.

I really think you should probably look at taking care of enabling MSI-X
and maybe MSI as a fall-back in probe. At least then you can post a
message about how many vectors are enabled and what type. Then if you
cannot enable any interrupts due to MSI being disabled you can simply
fail at probe time and let then load a different driver.

- Alex