Skip to content

Commit 481a819

Browse files
Oliver Hartkoppdavem330
authored andcommitted
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>
1 parent 0b6a05c commit 481a819

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/net/can/vcan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
8080
skb->dev = dev;
8181
skb->ip_summed = CHECKSUM_UNNECESSARY;
8282

83-
netif_rx(skb);
83+
netif_rx_ni(skb);
8484
}
8585

8686
static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)

net/can/af_can.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
199199
* @skb: pointer to socket buffer with CAN frame in data section
200200
* @loop: loopback for listeners on local CAN sockets (recommended default!)
201201
*
202+
* Due to the loopback this routine must not be called from hardirq context.
203+
*
202204
* Return:
203205
* 0 on success
204206
* -ENETDOWN when the selected interface is down
@@ -278,7 +280,7 @@ int can_send(struct sk_buff *skb, int loop)
278280
}
279281

280282
if (newskb)
281-
netif_rx(newskb);
283+
netif_rx_ni(newskb);
282284

283285
/* update statistics */
284286
can_stats.tx_frames++;

0 commit comments

Comments
 (0)