How to handle Hotplug with UIO userspace driver
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Mon Dec 8 18:27:09 EST 2014
Sorry, sent it too soon.
Here's the attached driver and userspace app for simulating a crash.
You can run make to build both.
Thanks,
-mandeep
On Mon, Dec 8, 2014 at 3:24 PM, Mandeep Sandhu
<mandeepsandhu.chd at gmail.com> wrote:
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 281 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141208/43b8df28/attachment-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uio_user.c
Type: text/x-csrc
Size: 1244 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141208/43b8df28/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uio_dummy.c
Type: text/x-csrc
Size: 3529 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141208/43b8df28/attachment-0003.bin
More information about the Kernelnewbies
mailing list