From patchwork Tue Feb 5 06:26:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2096371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id D74FEDF24C for ; Tue, 5 Feb 2013 07:06:24 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U2cZa-0007Wm-F5; Tue, 05 Feb 2013 07:04:06 +0000 Received: from db3ehsobe005.messaging.microsoft.com ([213.199.154.143] helo=db3outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U2cZT-0007VJ-ET for linux-arm-kernel@lists.infradead.org; Tue, 05 Feb 2013 07:04:00 +0000 Received: from mail126-db3-R.bigfish.com (10.3.81.226) by DB3EHSOBE010.bigfish.com (10.3.84.30) with Microsoft SMTP Server id 14.1.225.23; Tue, 5 Feb 2013 07:03:55 +0000 Received: from mail126-db3 (localhost [127.0.0.1]) by mail126-db3-R.bigfish.com (Postfix) with ESMTP id 3D65D14013E; Tue, 5 Feb 2013 07:03:55 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839he5bhf0ah107ah11b5h121eh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14afh1504h1537h162dh1631h1758h1898h18e1h1946h1155h) Received: from mail126-db3 (localhost.localdomain [127.0.0.1]) by mail126-db3 (MessageSwitch) id 1360047832970643_28205; Tue, 5 Feb 2013 07:03:52 +0000 (UTC) Received: from DB3EHSMHS016.bigfish.com (unknown [10.3.81.246]) by mail126-db3.bigfish.com (Postfix) with ESMTP id E0C8B40045; Tue, 5 Feb 2013 07:03:52 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS016.bigfish.com (10.3.87.116) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 5 Feb 2013 07:03:52 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.2.318.3; Tue, 5 Feb 2013 07:03:50 +0000 Received: from shlinux1.ap.freescale.net (shlinux1.ap.freescale.net [10.192.225.216]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r1573jXo019033; Tue, 5 Feb 2013 00:03:48 -0700 Received: by shlinux1.ap.freescale.net (Postfix, from userid 1013) id 64CDB1AE0CD; Tue, 5 Feb 2013 14:26:19 +0800 (CST) From: Frank Li To: , , , Subject: [PATCH v2 2/2 net-next] net: fec: fix spin_lock dead lock Date: Tue, 5 Feb 2013 14:26:17 +0800 Message-ID: <1360045577-6266-2-git-send-email-Frank.Li@freescale.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1360045577-6266-1-git-send-email-Frank.Li@freescale.com> References: <1360045577-6266-1-git-send-email-Frank.Li@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.net X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130205_020359_710330_920E09FF X-CRM114-Status: GOOD ( 10.79 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [213.199.154.143 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Frank Li , s.hauer@pengutronix.de, shawn.guo@linaro.org, B38611@freescale.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org ========================================================= [ INFO: possible irq lock inversion dependency detected ] 3.8.0-rc5+ #82 Not tainted --------------------------------------------------------- swapper/0/0 just changed the state of lock: (&(&fep->hw_lock)->rlock){..-...}, at: [<8034e2f8>] fec_enet_start_xmit+0x48/0x 2cc but this lock took another, SOFTIRQ-unsafe lock in the past: (prepare_lock){+.+.+.} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(prepare_lock); local_irq_disable() lock(&(&fep->hw_lock)->rlock); lock(prepare_lock); lock(&(&fep->hw_lock)->rlock); *** DEADLOCK *** Signed-off-by: Frank Li --- * fix new problem report by Jim drivers/net/ethernet/freescale/fec_ptp.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index c40526c..1f17ca0 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -104,7 +104,7 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev) unsigned long flags; int inc; - inc = 1000000000 / clk_get_rate(fep->clk_ptp); + inc = 1000000000 / fep->cycle_speed; /* grab the ptp lock */ spin_lock_irqsave(&fep->tmreg_lock, flags); @@ -363,6 +363,8 @@ void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev) fep->ptp_caps.settime = fec_ptp_settime; fep->ptp_caps.enable = fec_ptp_enable; + fep->cycle_speed = clk_get_rate(fep->clk_ptp); + spin_lock_init(&fep->tmreg_lock); fec_ptp_start_cyclecounter(ndev);