RTDM module ownership

Jan Kiszka jan.kiszka at siemens.com
Fri Jul 3 08:14:15 CEST 2020


On 02.07.20 10:32, Richard Weinberger via Xenomai wrote:
> Hi!
> 
> I'm working on a kernel module which is used on plain Linux and
> Xenomai (RTDM), while reviewing RTDM to understand refcounting I found
> something that is not entirely clear to me.
> 
> Why does __rtdm_dev_open() not grab a reference on the RTDM module owner?
> This leads to the case where one can rmmod the module while it is in use.
> Unloading will block uninterruptible in rtdm_dev_unregister() in the
> module's cleanup funktion.
> 
> In contrast, on regular Linux rmmod will refuse to unload the module
> if the device node is still open because fops_get() or other helpers
> gained a reference on the owner.
> 

First of all, your driver is apparently not reacting on the close 
request that it receives in that case. This leads the the stall you see.

Still, we could indeed run some module_put/get on open/socket/close. I 
thought we did, but that was once RTnet [1].

Jan

[1] 
https://gitlab.denx.de/Xenomai/xenomai/-/commit/11bbdef0e9486d8f952ea29023882449331af1aa

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list