From patchwork Thu Nov 11 10:17:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: holger@eitzenberger.org X-Patchwork-Id: 70790 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 57933B7122 for ; Thu, 11 Nov 2010 21:17:47 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754944Ab0KKKRn (ORCPT ); Thu, 11 Nov 2010 05:17:43 -0500 Received: from moutng.kundenserver.de ([212.227.17.9]:54206 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754837Ab0KKKRl (ORCPT ); Thu, 11 Nov 2010 05:17:41 -0500 Received: from kruemel.eitzenberger.org (p54AD16B9.dip0.t-ipconnect.de [84.173.22.185]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Lr4CZ-1ObwTg40NX-00ebO1; Thu, 11 Nov 2010 11:17:40 +0100 Received: from holger by kruemel.eitzenberger.org with local (Exim 4.69) (envelope-from ) id 1PGUDr-0006Nw-1A; Thu, 11 Nov 2010 11:17:39 +0100 Date: Thu, 11 Nov 2010 11:17:39 +0100 From: Holger Eitzenberger To: "Brandeburg, Jesse" Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org Subject: Re: [e1000e] BUG triggered in blink path Message-ID: <20101111101738.GA2972@mail.eitzenberger.org> Mail-Followup-To: "Brandeburg, Jesse" , e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org References: <20101109083954.GB11829@mail.eitzenberger.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Provags-ID: V02:K0:sdGbB3KBghVncL5jkC7to90s2Kupx4rnOsHTEaazMVx h/qJU4Af/orY/jT4yxmi2db/AXSRuT3wOvwk7f3KTQh5ApI4OJ mFD+tXGuJV0KC5ka/h2KPNSicZgQqfIXeP75GfhkDQ9PPWI9JV CVJI5BM/KF9jLHwqIOABa7TvZZF4xEJld8zMWMLqC9WgWXin4r tKE/sNWVytjuk4xMhKu37eePd537OWGSAkLhNTq7js= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Jesse, I've attached the patch against net-next-2.6. Please check if it's ok for you. I checked e1000, igb and ixgbe as well, they don't have that problem. /holger > > After taking a look I think this may be caused by initializing > > adapter->led_blink_task several times in e1000_phys_id(), while possibly > > led_blink_task is running: > > > > if ((hw->phy.type == e1000_phy_ife) || > > (hw->mac.type == e1000_pchlan) || > > (hw->mac.type == e1000_82574)) { > > INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task); > > if (!adapter->blink_timer.function) { > > > > I can't reproduce it after moving it inside the following if block, > > but I'm not quite sure if this catches all races in there. Especially > > the msleep_interruptible() may be too optimistic because it may > > actually not wait long enough. Someone with more knowledge of the > > driver should take a look. > > thanks for your investigation and troubleshooting. I don't think it is > correct at all to be calling INIT_WORK more than once. In fact the > INIT_WORK should just be moved into probe, and then e1000_phys_id should > just do schedule_work. > > Reviewed-by: Jesse Brandeburg e1000e: fix double initialization in blink path The kernel goes BUG() at the time 'ethtool -p eth0 3' comes back, which is due to adapter->led_blink_task initialized several times. At the time it is still running this results in a corrupted task_list of the associated workqueue. The fix is to move the workqueue initialization to the probe function instead. Signed-off-by: Holger Eitzenberger Index: net-next-2.6/drivers/net/e1000e/ethtool.c =================================================================== --- net-next-2.6.orig/drivers/net/e1000e/ethtool.c 2010-11-11 10:57:28.000000000 +0100 +++ net-next-2.6/drivers/net/e1000e/ethtool.c 2010-11-11 11:02:21.000000000 +0100 @@ -1860,7 +1860,7 @@ /* bit defines for adapter->led_status */ #define E1000_LED_ON 0 -static void e1000e_led_blink_task(struct work_struct *work) +void e1000e_led_blink_task(struct work_struct *work) { struct e1000_adapter *adapter = container_of(work, struct e1000_adapter, led_blink_task); @@ -1892,7 +1892,6 @@ (hw->mac.type == e1000_pch2lan) || (hw->mac.type == e1000_82583) || (hw->mac.type == e1000_82574)) { - INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task); if (!adapter->blink_timer.function) { init_timer(&adapter->blink_timer); adapter->blink_timer.function = Index: net-next-2.6/drivers/net/e1000e/netdev.c =================================================================== --- net-next-2.6.orig/drivers/net/e1000e/netdev.c 2010-11-11 10:57:28.000000000 +0100 +++ net-next-2.6/drivers/net/e1000e/netdev.c 2010-11-11 11:01:17.000000000 +0100 @@ -5864,6 +5864,7 @@ INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang); + INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task); /* Initialize link parameters. User can change them with ethtool */ adapter->hw.mac.autoneg = 1; Index: net-next-2.6/drivers/net/e1000e/e1000.h =================================================================== --- net-next-2.6.orig/drivers/net/e1000e/e1000.h 2010-11-11 10:57:28.000000000 +0100 +++ net-next-2.6/drivers/net/e1000e/e1000.h 2010-11-11 11:01:57.000000000 +0100 @@ -482,6 +482,7 @@ extern void e1000e_check_options(struct e1000_adapter *adapter); extern void e1000e_set_ethtool_ops(struct net_device *netdev); +extern void e1000e_led_blink_task(struct work_struct *work); extern int e1000e_up(struct e1000_adapter *adapter); extern void e1000e_down(struct e1000_adapter *adapter);