From patchwork Tue Sep 15 06:57:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Hartkopp X-Patchwork-Id: 33630 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 9567FB7B6A for ; Tue, 15 Sep 2009 16:58:32 +1000 (EST) Received: by ozlabs.org (Postfix) id 87C11DDD0B; Tue, 15 Sep 2009 16:58:32 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 309D4DDD04 for ; Tue, 15 Sep 2009 16:58:32 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758113AbZIOG6K (ORCPT ); Tue, 15 Sep 2009 02:58:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756984AbZIOG6J (ORCPT ); Tue, 15 Sep 2009 02:58:09 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.162]:54122 "EHLO mo-p00-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757991AbZIOG6I (ORCPT ); Tue, 15 Sep 2009 02:58:08 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1252997889; l=2163; s=domk; d=hartkopp.net; h=Content-Type:Subject:CC:To:MIME-Version:From:Date:X-RZG-CLASS-ID: X-RZG-AUTH; bh=lxKkAI7TnOyfeYW6Vidu2UB9Fjs=; b=ZbAo3WTtPj7sHz9Xo+nPd5c0BkFO0omqUM6RjyL5zWHUuwClhvNlR6pBRNLE7Dy2SGX oeJpxhPPc/tg6BzpOENklHAqUWm0b/qXo0R2tFm3E2puiDgym5sCvR9EqwLf8+BQ70ujB pflfQA+VlSF3XlwEtXVZk5wZrZj6sErfqqo= X-RZG-AUTH: :I2ANY0W6W/eA95XfH/xfO6gOxLxTty/udEMngcJ/VAKW22akG89Z0aF3UbdjCwhs X-RZG-CLASS-ID: mo00 Received: from [109.85.236.69] by post.strato.de (klopstock mo58) (RZmta 21.0) with ESMTP id p0664bl8F64gu4 ; Tue, 15 Sep 2009 08:57:57 +0200 (MEST) Message-ID: <4AAF3AF2.60309@hartkopp.net> Date: Tue, 15 Sep 2009 08:57:54 +0200 From: Oliver Hartkopp User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: David Miller , stable@kernel.org CC: Linux Netdev List , Urs Thuermann , Michael Buesch Subject: [PATCH] can: fix NOHZ local_softirq_pending 08 warning X-Enigmail-Version: 0.96.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Signed-off-by: Urs Thuermann diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c index 6971f6c..80ac563 100644 --- a/drivers/net/can/vcan.c +++ b/drivers/net/can/vcan.c @@ -80,7 +80,7 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev) skb->dev = dev; skb->ip_summed = CHECKSUM_UNNECESSARY; - netif_rx(skb); + netif_rx_ni(skb); } static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) diff --git a/net/can/af_can.c b/net/can/af_can.c index ef1c43a..6068321 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -199,6 +199,8 @@ static int can_create(struct net *net, struct socket *sock, int protocol) * @skb: pointer to socket buffer with CAN frame in data section * @loop: loopback for listeners on local CAN sockets (recommended default!) * + * Due to the loopback this routine must not be called from hardirq context. + * * Return: * 0 on success * -ENETDOWN when the selected interface is down @@ -278,7 +280,7 @@ int can_send(struct sk_buff *skb, int loop) } if (newskb) - netif_rx(newskb); + netif_rx_ni(newskb); /* update statistics */ can_stats.tx_frames++;