From patchwork Fri Oct 19 04:58:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1616591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id D4F843FCFC for ; Fri, 19 Oct 2012 04:59:47 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TP4eY-0006rb-4t; Fri, 19 Oct 2012 04:57:46 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TP4eU-0006rN-Ry for linux-arm-kernel@lists.infradead.org; Fri, 19 Oct 2012 04:57:43 +0000 Received: by mail-da0-f49.google.com with SMTP id q27so50016daj.36 for ; Thu, 18 Oct 2012 21:57:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=gqMDnl8bSjNQCXlWUHrf24KxWtDNfD/m3S56x5Y9wqw=; b=SVB30y2jCyYBqBls8msje6jfqPo+hIphKEbsDKrs8AJ1I+YRuFTtfcilDmyU5MyLuF ujVNvtQuXlqa3AeWOSeAmxqw9kJFBbQ88MK28aMnphKOZ9PLQh7GEcaUoRwuSoW8t2HU Ck8u57Mn9nUTp3aTEQQ8U3hA2DmMnR6Z7x635i5WAyXOXH2r6LL7vOgX5Wt5Xhsx3NAc MpQop2hMygsjTIbHLkLvny+0KMlRbOwZ3IWHO/XQPwWeieDN5QANcAPbIECZiqXNJk9U zXSgP1YXTgiowwMZYYZtsMH3djr4WNe9VKpGoWnp3EaDPuByHMR43DNWb3UlO858Vvot kVnQ== Received: by 10.68.222.105 with SMTP id ql9mr1786722pbc.97.1350622659977; Thu, 18 Oct 2012 21:57:39 -0700 (PDT) Received: from S2101-09.ap.freescale.net ([121.236.108.206]) by mx.google.com with ESMTPS id w4sm455363paz.38.2012.10.18.21.57.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 21:57:39 -0700 (PDT) Date: Fri, 19 Oct 2012 12:58:07 +0800 From: Shawn Guo To: Peter Chen , Linus Walleij , Russell King Subject: Re: Do we need to fix below dump during cpu hot plug operation? Message-ID: <20121019045802.GA21078@S2101-09.ap.freescale.net> References: <20121019015621.GA17360@nchen-desktop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121019015621.GA17360@nchen-desktop> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnMnolLlAIKMw5e7UK7ozR0GOokPS36lJ5HNFgXF0lhlHZKlbwszZdAFA/w8fH+6B33EZH3 X-Spam-Note: CRM114 invocation failed 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 [209.85.210.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-arm-kernel@lists.infradead.org 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 On Fri, Oct 19, 2012 at 09:56:22AM +0800, Peter Chen wrote: > Hi all, > > When doing system suspend/resume or CPU hot plug at SMP platform (like > Freescale i.mx6Q sabrelite board), if local time is enabled, > there is a clk_get_rate at twd_timer_setup during the atomic context. > So, if mutex_lock debug is enabled, there will be below dump message. > Although it will not affect future system use, it is boring message. > Thanks for reporting, Peter. We should fix the warning. Having not turned on those warning options in imx defconfig might be the reason that we had not noticed it. Since the driver is able to update the twd_timer_rate whenever clock rate changes after system boots up, the clk_get_rate call in twd_timer_setup should be only needed when we get a valid twd_clk at the first time. So let's move clk_get_rate call into if (!twd_clk) block just after twd_get_clock(). Linus, Russell, Does it seem to be a valid fix? Shawn 8<--- > BUG: sleeping function called from invalid context at /home/b29397/work/code/git/linus/linux-2.6/kernel/mutex.c:269 > no locks held by swapper/1/0. > irq event stamp: 279320 > hardirqs last enabled at (279319): [<80052bd0>] idle_task_exit+0x16c/0x1a0 > hardirqs last disabled at (279320): [<8051a470>] cpu_die+0x28/0x98 > softirqs last enabled at (279304): [<8002ae3c>] _local_bh_enable+0x14/0x18 > softirqs last disabled at (279303): [<8002aea8>] irq_enter+0x68/0x78 > Backtrace: > [<8001284c>] (dump_backtrace+0x0/0x10c) from [<8052b614>] (dump_stack+0x18/0x1c) > r7:8062b070 r6:0000010d r5:00000000 r4:bf88c000 > [<8052b5fc>] (dump_stack+0x0/0x1c) from [<80050bb4>] (__might_sleep+0x1ec/0x238) > [<800509c8>] (__might_sleep+0x0/0x238) from [<8052cf60>] (mutex_lock_nested+0x38/0x3bc) > r7:00000000 r6:bf88c000 r5:808b19e0 r4:808a5360 > [<8052cf28>] (mutex_lock_nested+0x0/0x3bc) from [<803e2108>] (clk_get_rate+0x1c/0x84) > [<803e20ec>] (clk_get_rate+0x0/0x84) from [<8052900c>] (twd_timer_setup+0x28c/0x2e0) > r5:808b19e0 r4:817c0200 > [<80528d80>] (twd_timer_setup+0x0/0x2e0) from [<805288b8>] (percpu_timer_setup+0x6c/0xdc) > r9:412fc09a r8:1000406a r7:808b19d8 r6:bf88c000 r5:80879c14 > r4:817c0200 > [<8052884c>] (percpu_timer_setup+0x0/0xdc) from [<80528a68>] (secondary_start_kernel+0x140/0x19c) > r5:80879c14 r4:00000001 > [<80528928>] (secondary_start_kernel+0x0/0x19c) from [<10528248>] (0x10528248) > r7:808b19d8 r6:10c03c7d r5:0000001f r4:4f87806a > BUG: scheduling while atomic: swapper/1/0/0x40000002 > no locks held by swapper/1/0. > Modules linked in: > irq event stamp: 279320 > hardirqs last enabled at (279319): [<80052bd0>] idle_task_exit+0x16c/0x1a0 > hardirqs last disabled at (279320): [<8051a470>] cpu_die+0x28/0x98 > softirqs last enabled at (279304): [<8002ae3c>] _local_bh_enable+0x14/0x18 > softirqs last disabled at (279303): [<8002aea8>] irq_enter+0x68/0x78 > Backtrace: > [<8001284c>] (dump_backtrace+0x0/0x10c) from [<8052b614>] (dump_stack+0x18/0x1c) > r7:00000001 r6:bf88c000 r5:bf890000 r4:bf890000 > [<8052b5fc>] (dump_stack+0x0/0x1c) from [<800539b4>] (__schedule_bug+0x5c/0x7c) > [<80053958>] (__schedule_bug+0x0/0x7c) from [<8052e1a8>] (__schedule+0x620/0x6e0) > r5:bf890000 r4:819215c0 > [<8052db88>] (__schedule+0x0/0x6e0) from [<8052e320>] (_cond_resched+0x44/0x58) > [<8052e2dc>] (_cond_resched+0x0/0x58) from [<8052cf64>] (mutex_lock_nested+0x3c/0x3bc) > r5:808b19e0 r4:808a5360 > [<8052cf28>] (mutex_lock_nested+0x0/0x3bc) from [<803e2108>] (clk_get_rate+0x1c/0x84) > [<803e20ec>] (clk_get_rate+0x0/0x84) from [<8052900c>] (twd_timer_setup+0x28c/0x2e0) > r5:808b19e0 r4:817c0200 > [<80528d80>] (twd_timer_setup+0x0/0x2e0) from [<805288b8>] (percpu_timer_setup+0x6c/0xdc) > r9:412fc09a r8:1000406a r7:808b19d8 r6:bf88c000 r5:80879c14 > r4:817c0200 > [<8052884c>] (percpu_timer_setup+0x0/0xdc) from [<80528a68>] (secondary_start_kernel+0x140/0x19c) > r5:80879c14 r4:00000001 > [<80528928>] (secondary_start_kernel+0x0/0x19c) from [<10528248>] (0x10528248) > r7:808b19d8 r6:10c03c7d r5:0000001f r4:4f87806a > > -- > > Best Regards, > Peter Chen > diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index e1f9069..c1f54a1 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -273,13 +273,13 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk) { struct clock_event_device **this_cpu_clk; - if (!twd_clk) + if (!twd_clk) { twd_clk = twd_get_clock(); - - if (!IS_ERR_OR_NULL(twd_clk)) - twd_timer_rate = clk_get_rate(twd_clk); - else + if (!IS_ERR_OR_NULL(twd_clk)) + twd_timer_rate = clk_get_rate(twd_clk); + } else { twd_calibrate_rate(); + } __raw_writel(0, twd_base + TWD_TIMER_CONTROL);