lin-bus / linux-lin

Linux kernel LIN bus support implemented as TTY line discipline for generic UART conrollers, documentation https://github.com/lin-bus/linux-lin/wiki, based on https://github.com/lin-bus/linux-lin/wiki/sllin-rtlws14-paper.pdf, more CAN related projects http://canbus.pages.fel.cvut.cz/
https://github.com/lin-bus/linux-lin/wiki
38 stars 26 forks source link

sllin: fix 'NOHZ tick-stop error' on kernels < 5.18 #20

Closed fvalla-MTA closed 1 year ago

fvalla-MTA commented 1 year ago

The slin_send_canfr() function is called for different reasons, and in particular both in interrupt and thread context. In the latter case, pre-5.18 kernels complain with 'NOHZ tick-stop error: Non-RCU local softirq work is pending', as the netif_rx() function is meant to be called only as part of an interrupt service routine.

Fix the issue above calling netif_rx_ni() instead of netif_rx() when not in an interrupt context.

Limit this behaviour to kernels older than 5.18, since starting with this version netif_rx() can be called in any context and netif_rx_ni() has been removed entirely in:

2655926aea9b: net: Remove netif_rx_any_context() and netif_rx_ni()

Signed-off-by: Francesco Valla francesco.valla@mta.it

ppisa commented 1 year ago

Thanks for the FIX, I have checked by https://elixir.bootlin.com that the function is really only present up to 5.17 Linux kernel and that it appears in 2.4.x kernels so limiting it by minimal version id out of sllLIN scope.