From patchwork Tue Aug 26 19:26:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 383195 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 4962314003E for ; Wed, 27 Aug 2014 05:28:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753771AbaHZT1O (ORCPT ); Tue, 26 Aug 2014 15:27:14 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:33993 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753665AbaHZT1N (ORCPT ); Tue, 26 Aug 2014 15:27:13 -0400 Received: by mail-pd0-f172.google.com with SMTP id y13so22794570pdi.31 for ; Tue, 26 Aug 2014 12:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=oRDDGW9YnQ+5GIEsjVF4rDCIdrLNo3GsZMH1CFknw2E=; b=jfovES14X1awPvMQC91Hhy2Vg0R4gP9q/gJ5S/I92a5wKJWHoHB7f8ddzDGI6EvY5Q tqZWs5pJZhKydxHNqo1NGlXg/zeq2kuh9cxJ20U0nCHKzTjLIeDoZrSwy/SQ1qczX8FV /8sU+lnsiEF+DM6Bzqu3tqqLLzZF0GIlRqLBttLuPteQIuxLgwEKXDMMWIzOma1MIv6Y AGeua2qKyck4+Hz2vGEonqa2mi5DIMymQGy0ORhgi5g3pSZzX1B/cg8eMzR/foJXlW9R GyzgLUhwpCgvGpye/jxC+UdcvZKBlPdpfXYJzy/nOIdSsPe2N1JjbfhPzZdq8jXtThhw HA/w== X-Received: by 10.70.102.129 with SMTP id fo1mr39912034pdb.14.1409081232880; Tue, 26 Aug 2014 12:27:12 -0700 (PDT) Received: from f1.synalogic.ca ([108.203.76.248]) by mx.google.com with ESMTPSA id zf5sm4049240pbc.44.2014.08.26.12.27.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Aug 2014 12:27:12 -0700 (PDT) From: Benjamin Poirier To: Prashant Sreedharan , Michael Chan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 1/4] tg3: Limit minimum tx queue wakeup threshold Date: Tue, 26 Aug 2014 12:26:15 -0700 Message-Id: <1409081178-4877-1-git-send-email-bpoirier@suse.de> X-Mailer: git-send-email 1.8.4.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tx_pending may be set by the user (via ethtool -G) to a low enough value that TG3_TX_WAKEUP_THRESH becomes smaller than MAX_SKB_FRAGS + 1. This may cause the tx queue to be waked when there are in fact not enough descriptors to handle an skb with max frags. This in turn causes tg3_start_xmit() to return NETDEV_TX_BUSY and print error messages. Fix the problem by putting a limit to how low TG3_TX_WAKEUP_THRESH can go. Signed-off-by: Benjamin Poirier --- I noticed the problem in a 3.0 kernel when setting `ethtool eth0 -G tx 50` and running a netperf TCP_STREAM test. The console fills up with [10597.596155] tg3 0000:06:00.0: eth0: BUG! Tx Ring full when queue awake! The problem in tg3 remains in current kernels though it does not reproduce as easily since "5640f76 net: use a per task frag allocator (v3.7-rc1)". I reproduced on current kernels by using the fail_page_alloc fault injection mechanism to force the creation of skbs with many order-0 frags. Note that the following script may also trigger another bug (NETDEV WATCHDOG), which is fixed in the next patch. $ cat /tmp/doit.sh F="/sys/kernel/debug/fail_page_alloc" echo -1 > "$F/times" echo 0 > "$F/verbose" echo 0 > "$F/ignore-gfp-wait" echo 1 > "$F/task-filter" echo 100 > "$F/probability" netperf -H 192.168.9.30 -l100 -t omni -- -d send & n=$! sleep 0.3 echo 1 > "/proc/$n/make-it-fail" sleep 10 kill "$n" --- drivers/net/ethernet/broadcom/tg3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3ac5d23..b11c0fd 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -202,7 +202,8 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) #endif /* minimum number of free TX descriptors required to wake up TX process */ -#define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4) +#define TG3_TX_WAKEUP_THRESH(tnapi) max_t(u32, (tnapi)->tx_pending / 4, \ + MAX_SKB_FRAGS + 1) #define TG3_TX_BD_DMA_MAX_2K 2048 #define TG3_TX_BD_DMA_MAX_4K 4096