How to handle Hotplug with UIO userspace driver

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Dec 8 18:24:54 EST 2014


Hi Greg,

>> I saw a patch for this very situation (UIO & hotplug) being discussed on LKML
>> almost 4 yrs back, although I don't see it in my kernel version - 3.16.0
>> (Ubuntu 3.16.0-24-generic).
>> The LKML link:
>>
>> https://lkml.org/lkml/2010/9/20/21
>>
>> Wouldn't this solve the issue? I wonder why it didn't make it into mainline?
>
> No idea, that UIO maintainer must be really lazy and never apply patches :)
>
> Try that series on your kernel and see what happens.  If it works,
> please resend that patch series.

I tried out a dummy uio driver with a userspace program accessing the
mmaped space (attached). On doing an unregister of the uio device, I
see a crash/bug being triggered. Sometimes the kernel continues to
run, sometimes failing during rmmod of my module, sometimes locks up
during reboot (trying this on VirtualBox VM) and other times there's
no crash at all (but I'm just getting lucky).

Although with the patch applied, the user process gets a SIGBUS and
exits when I do an uio_unregister_device() call in my driver. So I
guess this patch is needed.


A generic question, if I have to apply the patches and do a sanity
build, which branch should I be applying the patch to? linux-next?
linux-stable?

Thanks,
-mandeep


>
> thanks,
>
> greg k-h



More information about the Kernelnewbies mailing list