From patchwork Tue Feb 12 15:49:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 2129171 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 EEB9C3FD4F for ; Tue, 12 Feb 2013 15:53:38 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U5I7S-0006lT-HJ; Tue, 12 Feb 2013 15:50:06 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U5I7O-0006km-Td for linux-arm-kernel@lists.infradead.org; Tue, 12 Feb 2013 15:50:03 +0000 Received: from mailbox.adnet.avionic-design.de (mailbox.avionic-design.de [109.75.18.3]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0LkkrY-1UfinS0TP2-00aj7N; Tue, 12 Feb 2013 16:49:58 +0100 Received: from localhost (localhost [127.0.0.1]) by mailbox.adnet.avionic-design.de (Postfix) with ESMTP id 5D1AA2A28158; Tue, 12 Feb 2013 16:49:57 +0100 (CET) X-Virus-Scanned: amavisd-new at avionic-design.de Received: from mailbox.adnet.avionic-design.de ([127.0.0.1]) by localhost (mailbox.avionic-design.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7La7+QJZCVg5; Tue, 12 Feb 2013 16:49:55 +0100 (CET) Received: from mailman.adnet.avionic-design.de (mailman.adnet.avionic-design.de [172.20.31.172]) by mailbox.adnet.avionic-design.de (Postfix) with ESMTP id 8C7252A28130; Tue, 12 Feb 2013 16:49:55 +0100 (CET) Received: from localhost (avionic-0098.adnet.avionic-design.de [172.20.31.233]) by mailman.adnet.avionic-design.de (Postfix) with ESMTP id 7AEDA100487; Tue, 12 Feb 2013 16:49:51 +0100 (CET) From: Thierry Reding To: Mark Rutland Subject: [PATCH] HACK: ARM: Fix generic timer broadcast for TWD Date: Tue, 12 Feb 2013 16:49:54 +0100 Message-Id: <1360684194-10894-1-git-send-email-thierry.reding@avionic-design.de> X-Mailer: git-send-email 1.8.1.2 X-Provags-ID: V02:K0:5IS8WvU7a9tM5uSRqoz7EFEcOgjN/qGDWS6j+9Ubeek /hpyoKQwL3cYkUyWE7uzLxmS33pscz54nmQ5s9jq/GNrclObcm QZPpHTFnzlNa3TUJJDV8khg9WUCV7cEjm/077ETak0zy2AHP1z Cp+ZfyNrshbtUEfWtj2RV+mQnGSdQYAPe6AcNUffQtUZJ3u0eS JX/NoZSMIivKX9fNmjUpsmepor/5crXcr+zgbCfjznsiMjw3kP LtlDeKvKHw6y8+jMBF6pjNSEjMPJbq5ABiaBFbGwC2EZXvbgGO GHckHxz0BHi0XMV5r4fsb1bbAiaTqSnx4L56iyfsGBVTMSrRCd kWFvyOVyw4NiWNLiLjedt80XgitA/WWrKJYQeo4FyL/7KwkpY4 EH4JbIT6RiSZEYV0KByR6hZEcSPEthDQMLJQ62bWdQPpHaSFnk Djhl8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130212_105003_170936_CE68E65D X-CRM114-Status: GOOD ( 19.90 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.8 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-tegra@vger.kernel.org, Santosh Shilimkar , Russell King , 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This fixes the following crash when booting on Tegra: [ 123.346233] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 123.354346] pgd = c0004000 [ 123.357071] [00000000] *pgd=00000000 [ 123.360687] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM [ 123.366614] Modules linked in: [ 123.369702] CPU: 0 Not tainted (3.8.0-rc7-next-20130212-00002-ga12b34b-dirty #21) [ 123.377541] PC is at 0x0 [ 123.380123] LR is at tick_do_broadcast.constprop.3+0x74/0xb0 [ 123.385802] pc : [<00000000>] lr : [] psr: 20000193 [ 123.385802] sp : c06ede18 ip : 00000002 fp : 00000004 [ 123.397285] r10: c06e8a60 r9 : c06f4f10 r8 : c06f4ca0 [ 123.402520] r7 : 0000001c r6 : b7bf7c40 r5 : c07537d8 r4 : 00000000 [ 123.409055] r3 : 00000000 r2 : 004ac000 r1 : 00000004 r0 : c07537e4 [ 123.415594] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel [ 123.422999] Control: 10c5387d Table: 1ada804a DAC: 00000015 [ 123.428756] Process swapper/0 (pid: 0, stack limit = 0xc06ec238) [ 123.434771] Stack: (0xc06ede18 to 0xc06ee000) [ 123.439145] de00: 00000002 ffffffff [ 123.447348] de20: 7fffffff c0064434 b7bec890 c0707840 b7bf7c40 0000001c 00000000 c0707800 [ 123.455547] de40: df815ad0 00000000 00000000 00000049 c072e8b3 df815a80 00000001 c022db34 [ 123.463749] de60: c022db10 c0079a14 0000001c c0b8ca68 b7bf3dc0 df815a80 df815ad0 c0707800 [ 123.471950] de80: fe000100 df9cb380 c06ec000 c04eb1ac 00000000 c0079b94 df815a80 df815ad0 [ 123.480148] dea0: 00000000 c007c7b0 c007c734 00000049 00000049 c0079410 c06e91f0 c000ec38 [ 123.488349] dec0: fe00010c c06f5048 c06edee8 c00086d4 c005dd20 c032c13c 60000113 ffffffff [ 123.496549] dee0: c06edf1c c000e000 c06edf30 3b9aca00 b7bf2650 0000001c b718bcc0 0000001c [ 123.504747] df00: c0b8c3e8 00000001 df9cb380 c06ec000 c04eb1ac 00000000 00000015 c06edf30 [ 123.512945] df20: c005dd20 c032c13c 60000113 ffffffff b7bf2650 0000001c 00000000 c04eb1ac [ 123.521144] df40: 00000000 df9cb394 c0b8c3e8 c0b8c3e8 c06f9de0 c032be10 df9cb394 c0b8c3e8 [ 123.529341] df60: 00000001 c032dd30 0000004c c0b8c3e8 c0777c94 00000001 c06f9de0 00000000 [ 123.537541] df80: c072ea88 c032bf40 c06ec000 c072ea88 c06ec000 c06f43f4 c04eb1ac c000f008 [ 123.545740] dfa0: c06f4d00 00000000 c072e9c0 c0b89140 ffffffff 411fc090 3fffffff c06b47bc [ 123.553939] dfc0: ffffffff ffffffff c06b42ec 00000000 00000000 c06ddcd0 00000000 10c5387d [ 123.562138] dfe0: c06f43f0 c06ddccc c06f8aa4 0000406a 00000000 00008074 00000000 00000000 [ 123.570369] [] (tick_do_broadcast.constprop.3+0x74/0xb0) from [] (tick_handle_oneshot_broadcast+0xb4/0x108) [ 123.581897] [] (tick_handle_oneshot_broadcast+0xb4/0x108) from [] (tegra_timer_interrupt+0x24/0x2c) [ 123.592727] [] (tegra_timer_interrupt+0x24/0x2c) from [] (handle_irq_event_percpu+0x50/0x194) [ 123.603022] [] (handle_irq_event_percpu+0x50/0x194) from [] (handle_irq_event+0x3c/0x5c) [ 123.612887] [] (handle_irq_event+0x3c/0x5c) from [] (handle_fasteoi_irq+0x7c/0x138) [ 123.622314] [] (handle_fasteoi_irq+0x7c/0x138) from [] (generic_handle_irq+0x20/0x30) [ 123.631923] [] (generic_handle_irq+0x20/0x30) from [] (handle_IRQ+0x38/0x94) [ 123.640740] [] (handle_IRQ+0x38/0x94) from [] (gic_handle_irq+0x28/0x5c) [ 123.649204] [] (gic_handle_irq+0x28/0x5c) from [] (__irq_svc+0x40/0x70) [ 123.657561] Exception stack(0xc06edee8 to 0xc06edf30) [ 123.662637] dee0: c06edf30 3b9aca00 b7bf2650 0000001c b718bcc0 0000001c [ 123.670839] df00: c0b8c3e8 00000001 df9cb380 c06ec000 c04eb1ac 00000000 00000015 c06edf30 [ 123.679027] df20: c005dd20 c032c13c 60000113 ffffffff [ 123.684125] [] (__irq_svc+0x40/0x70) from [] (cpuidle_wrap_enter+0x48/0x94) [ 123.692858] [] (cpuidle_wrap_enter+0x48/0x94) from [] (cpuidle_enter_state+0x14/0x70) [ 123.702461] [] (cpuidle_enter_state+0x14/0x70) from [] (cpuidle_enter_state_coupled+0x208/0x2a0) [ 123.713013] [] (cpuidle_enter_state_coupled+0x208/0x2a0) from [] (cpuidle_idle_call+0xd4/0x124) [ 123.723475] [] (cpuidle_idle_call+0xd4/0x124) from [] (cpu_idle+0xb0/0x124) [ 123.732228] [] (cpu_idle+0xb0/0x124) from [] (start_kernel+0x2a4/0x2f4) [ 123.740586] Code: bad PC value [ 123.743668] ---[ end trace ceed8db1ca3c192e ]--- [ 123.748297] Kernel panic - not syncing: Fatal exception in interrupt [ 125.143549] SMP: failed to stop secondary CPUs Note that I have close to no clue what I'm doing, so the patch might be the completely wrong thing to do. An alternative I had initially thought about was to check for NULL before calling the clock_event_device's .broadcast() function. The reason why I chose to always assign .broadcast instead is that a previous patch (3d06770: Add generic timer broadcast support) aims at generically implementing broadcast support on ARM and providing a tick_broadcast() implementation for this purpose so it seemed like the right thing to do. The above-mentioned patch for some reason removed the assignment to the .broadcast() member for apparently no reason, so maybe that was just done by mistake? Signed-off-by: Thierry Reding --- arch/arm/kernel/smp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 5f73f70..472ba9d 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -467,7 +467,7 @@ void tick_broadcast(const struct cpumask *mask) smp_cross_call(mask, IPI_TIMER); } #else -#define smp_timer_broadcast NULL +#define tick_broadcast NULL #endif static void broadcast_timer_set_mode(enum clock_event_mode mode, @@ -513,6 +513,8 @@ static void __cpuinit percpu_timer_setup(void) if (!lt_ops || lt_ops->setup(evt)) broadcast_timer_setup(evt); + + evt->broadcast = tick_broadcast; } #ifdef CONFIG_HOTPLUG_CPU