Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: fix NOHZ local_softirq_pending 08 warning

When using nanosleep() in an userspace application we get a ratelimit warning

NOHZ: local_softirq_pending 08

for 10 times.

The echo of CAN frames is done from process context and softirq context only.
Therefore the usage of netif_rx() was wrong (for years).

This patch replaces netif_rx() with netif_rx_ni() which has to be used from
process/softirq context. It also adds a missing comment that can_send() must
no be used from hardirq context.

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Oliver Hartkopp and committed by
David S. Miller
481a8199 0b6a05c1

+4 -2
+1 -1
drivers/net/can/vcan.c
··· 80 80 skb->dev = dev; 81 81 skb->ip_summed = CHECKSUM_UNNECESSARY; 82 82 83 - netif_rx(skb); 83 + netif_rx_ni(skb); 84 84 } 85 85 86 86 static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
+3 -1
net/can/af_can.c
··· 199 199 * @skb: pointer to socket buffer with CAN frame in data section 200 200 * @loop: loopback for listeners on local CAN sockets (recommended default!) 201 201 * 202 + * Due to the loopback this routine must not be called from hardirq context. 203 + * 202 204 * Return: 203 205 * 0 on success 204 206 * -ENETDOWN when the selected interface is down ··· 280 278 } 281 279 282 280 if (newskb) 283 - netif_rx(newskb); 281 + netif_rx_ni(newskb); 284 282 285 283 /* update statistics */ 286 284 can_stats.tx_frames++;