From patchwork Wed Mar 5 19:14:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 327122 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B77062C0040 for ; Thu, 6 Mar 2014 06:14:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755998AbaCETOO (ORCPT ); Wed, 5 Mar 2014 14:14:14 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:44611 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755626AbaCETOL (ORCPT ); Wed, 5 Mar 2014 14:14:11 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1WLHGa-0005M1-3J; Wed, 05 Mar 2014 12:14:08 -0700 Received: from c-98-207-154-105.hsd1.ca.comcast.net ([98.207.154.105] helo=eric-ThinkPad-X220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1WLHGY-00042f-CQ; Wed, 05 Mar 2014 12:14:07 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: David Miller Cc: netdev@vger.kernel.org, xiyou.wangcong@gmail.com, mpm@selenic.com, satyam.sharma@gmail.com References: <874n3fow2i.fsf@xmission.com> <20140304.160825.893718566461536483.davem@davemloft.net> Date: Wed, 05 Mar 2014 11:14:02 -0800 In-Reply-To: <20140304.160825.893718566461536483.davem@davemloft.net> (David Miller's message of "Tue, 04 Mar 2014 16:08:25 -0500 (EST)") Message-ID: <87ob1kxxtx.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 X-XM-AID: U2FsdGVkX18z7/QfmkGqXVSUQhqJOjn2F0tLiSysOkE= X-SA-Exim-Connect-IP: 98.207.154.105 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sa07.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=8.0 tests=ALL_TRUSTED,BAYES_40, DCC_CHECK_NEGATIVE, FVGT_m_MULTI_ODD, LotsOfNums_01, T_TM2_M_HEADER_IN_MSG, T_TooManySym_01, T_XMDrugObfuBody_08, XMSubLong autolearn=disabled version=3.3.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: T_TM2_M_HEADER_IN_MSG * 1.2 LotsOfNums_01 BODY: Lots of long strings of numbers * -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% * [score: 0.2148] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.4 FVGT_m_MULTI_ODD Contains multiple odd letter combinations * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 T_XMDrugObfuBody_08 obfuscated drug references X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;David Miller X-Spam-Relay-Country: Subject: Re: [PATCH] netpoll: Don't call driver methods from interrupt context. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 14 Nov 2012 14:26:46 -0700) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David Miller writes: > From: ebiederm@xmission.com (Eric W. Biederman) > Date: Mon, 03 Mar 2014 12:40:05 -0800 > >> [] warn_slowpath_common+0x85/0x9d >> [] warn_slowpath_null+0x1a/0x1c >> [] skb_release_head_state+0x7b/0xe1 >> [] __kfree_skb+0x16/0x81 >> [] consume_skb+0x54/0x69 >> [] bnx2_tx_int.clone.6+0x1b0/0x33e [bnx2] > > Other drivers, such as bnx2x, uses dev_kfree_skb_any(), probably > exactly to deal with this situation. > > If in_irq() is true or interrupts are disabled, __dev_kfree_skb_any > will use __dev_kfree_skb_irq, which will queue up the SKB and schedule > a software interrupt to do the actual work. > > For example, see this commit, which we probably just need to duplicate > into other poll supporting drivers: Fair enough. I will cook up a patch to see about doing this. Especially as this appears to be all that drivers need to do differently in practice. Looking at bnx2x I found at least one more case that needs to be changed, so for netpoll supporting drivers I will plan on simply changing all of the dev_kfree_skb instances to dev_kfree_skby_any so I don't have to worry about missing one by not having audited the code properly. Eric > commit 40955532bc9d865999dfc58b7896605d58650655 > Author: Vladislav Zolotarov > Date: Sun May 22 10:06:58 2011 +0000 > > bnx2x: call dev_kfree_skb_any instead of dev_kfree_skb > > replace function calls when possible call in both irq/non-irq contexts > > Signed-off-by: Dmitry Kravkov > Signed-off-by: Eilon Greenstein > Signed-off-by: David S. Miller > > diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c > index 64d01e7..d5bd35b 100644 > --- a/drivers/net/bnx2x/bnx2x_cmn.c > +++ b/drivers/net/bnx2x/bnx2x_cmn.c > @@ -131,7 +131,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fastpath *fp, > > /* release skb */ > WARN_ON(!skb); > - dev_kfree_skb(skb); > + dev_kfree_skb_any(skb); > tx_buf->first_bd = 0; > tx_buf->skb = NULL; > > @@ -465,7 +465,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, > } else { > DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages" > " - dropping packet!\n"); > - dev_kfree_skb(skb); > + dev_kfree_skb_any(skb); > } > > > diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h > index fab161e..1a3545b 100644 > --- a/drivers/net/bnx2x/bnx2x_cmn.h > +++ b/drivers/net/bnx2x/bnx2x_cmn.h > @@ -840,7 +840,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp, > mapping = dma_map_single(&bp->pdev->dev, skb->data, fp->rx_buf_size, > DMA_FROM_DEVICE); > if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { > - dev_kfree_skb(skb); > + dev_kfree_skb_any(skb); > return -ENOMEM; > } > --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 9d7419e0390b..e790d654f35f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -3719,7 +3719,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) struct bnx2x_eth_q_stats *q_stats = bnx2x_fp_qstats(bp, txdata->parent_fp); q_stats->driver_filtered_tx_pkt++; - dev_kfree_skb(skb); + dev_kfree_skb_any(skb); return NETDEV_TX_OK; } bnx2x_fp_qstats(bp, txdata->parent_fp)->driver_xoff++;