From patchwork Fri May 2 19:37:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 4105121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9C3E0BFF02 for ; Fri, 2 May 2014 19:39:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF80E20375 for ; Fri, 2 May 2014 19:39:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 064EF202AE for ; Fri, 2 May 2014 19:39:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WgJH0-0003MH-AJ; Fri, 02 May 2014 19:37:30 +0000 Received: from galois.linutronix.de ([2001:470:1f0b:db:abcd:42:0:1]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WgJGy-0003IR-Ar for linux-arm-kernel@lists.infradead.org; Fri, 02 May 2014 19:37:28 +0000 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1WgJGb-0008TJ-9b; Fri, 02 May 2014 21:37:05 +0200 Date: Fri, 2 May 2014 21:37:05 +0200 From: Sebastian Andrzej Siewior To: Thomas Gleixner Subject: Re: BUG: spinlock trylock failure on UP, i.MX28 3.12.15-rt25 Message-ID: <20140502193705.GI9178@linutronix.de> References: <534C3606.7010206@meduna.org> <534C731F.1050406@meduna.org> <534DADF1.6060608@meduna.org> <20140422115439.GA20669@linutronix.de> <20140422094657.5b6ca1e2@gandalf.local.home> <53569E05.8010600@linutronix.de> <20140422134802.73fc1fa4@gandalf.local.home> <20140422141650.7f43d5ba@gandalf.local.home> <20140502183824.GH9178@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Key-Id: 97C4700B X-Key-Fingerprint: 09E2 D1F3 9A3A FF13 C3D3 961C 0688 1C1E 97C4 700B User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140502_123728_536012_6ACA31E6 X-CRM114-Status: GOOD ( 14.26 ) X-Spam-Score: -0.7 (/) Cc: "linux-rt-users@vger.kernel.org" , Peter Zijlstra , "linux-kernel@vger.kernel.org" , Steven Rostedt , Stanislav Meduna , Linux ARM Kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Thomas Gleixner | 2014-05-02 21:01:50 [+0200]: >It's different as it CANNOT fail on UP. That's called from the idle >code and there is no way that anything holds that lock on UP when idle >runs. Okay, so I will add the patch here. The same thing (mostly) but it will also skip the irq_work_needs_cpu() check since we will run the timer softirq anyway. From: Sebastian Andrzej Siewior Date: Fri, 2 May 2014 21:31:50 +0200 Subject: [PATCH] timer: do not spin_trylock() on UP This will void a warning comming from the spin-lock debugging code. The lock avoiding idea is from Steven Rostedt. Signed-off-by: Sebastian Andrzej Siewior --- kernel/timer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/timer.c b/kernel/timer.c index 54596b5..8750875 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1455,18 +1455,31 @@ void run_local_timers(void) struct tvec_base *base = __this_cpu_read(tvec_bases); hrtimer_run_queues(); /* * We can access this lockless as we are in the timer * interrupt. If there are no timers queued, nothing to do in * the timer softirq. */ #ifdef CONFIG_PREEMPT_RT_FULL + +#ifndef CONFIG_SMP + /* + * The spin_do_trylock() later may fail as the lock may be hold before + * the interrupt arrived. The spin-lock debugging code will raise a + * warning if the try_lock fails on UP. Since this is only an + * optimization for the FULL_NO_HZ case (not to run the timer softirq on + * an nohz_full CPU) we don't really care and shedule the softirq. + */ + raise_softirq(TIMER_SOFTIRQ); + return; +#endif + /* On RT, irq work runs from softirq */ if (irq_work_needs_cpu()) { raise_softirq(TIMER_SOFTIRQ); return; } if (!spin_do_trylock(&base->lock)) { raise_softirq(TIMER_SOFTIRQ); return;