From patchwork Tue Apr 22 18:16:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 4034001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CF3159F319 for ; Tue, 22 Apr 2014 18:20:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A287A2021F for ; Tue, 22 Apr 2014 18:20:16 +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 5236B201BA for ; Tue, 22 Apr 2014 18:20:12 +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 1WcfGX-0003WM-Aa; Tue, 22 Apr 2014 18:17:57 +0000 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.230] helo=cdptpa-oedge-vip.email.rr.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcfFp-0003NJ-Ct for linux-arm-kernel@lists.infradead.org; Tue, 22 Apr 2014 18:17:14 +0000 Received: from [67.246.153.56] ([67.246.153.56:51236] helo=gandalf.local.home) by cdptpa-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 39/FE-10911-312B6535; Tue, 22 Apr 2014 18:16:52 +0000 Date: Tue, 22 Apr 2014 14:16:50 -0400 From: Steven Rostedt To: Steven Rostedt Subject: Re: BUG: spinlock trylock failure on UP, i.MX28 3.12.15-rt25 Message-ID: <20140422141650.7f43d5ba@gandalf.local.home> In-Reply-To: <20140422134802.73fc1fa4@gandalf.local.home> 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> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.22; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140422_111713_545694_C9CA1F53 X-CRM114-Status: GOOD ( 11.82 ) X-Spam-Score: 0.0 (/) Cc: "linux-rt-users@vger.kernel.org" , Peter Zijlstra , Sebastian Andrzej Siewior , "linux-kernel@vger.kernel.org" , Stanislav Meduna , Thomas Gleixner , 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 On Tue, 22 Apr 2014 13:48:02 -0400 Steven Rostedt wrote: > I need to take a deeper look into the actual code. But as trylocks on > UP are nops (always succeed), and if it expects to be able to do > something in a critical section that is protected by spinlocks (again > nops on UP), this would be broken for UP. Reading the code, I see it's broken. We should add something like this: Signed-off-by: Steven Rostedt diff --git a/kernel/timer.c b/kernel/timer.c index cc34e42..a03164a 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1447,6 +1447,12 @@ static void run_timer_softirq(struct softirq_action *h) __run_timers(base); } +#ifdef CONFIG_SMP +#define timer_should_raise_softirq(lock) !spin_do_trylock(lock) +#else +#define timer_should_raise_softirq(lock) 1 +#endif + /* * Called by the local, per-CPU timer interrupt on SMP. */ @@ -1467,7 +1473,7 @@ void run_local_timers(void) return; } - if (!spin_do_trylock(&base->lock)) { + if (timer_should_raise_softirq(&base->lock)) { raise_softirq(TIMER_SOFTIRQ); return; }