From patchwork Fri Feb 26 21:35:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 8442191 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 04EAC9F2F0 for ; Fri, 26 Feb 2016 21:39:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8E6A203B8 for ; Fri, 26 Feb 2016 21:39:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD86F2037C for ; Fri, 26 Feb 2016 21:39:09 +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 1aZQ4u-0005Fz-Mt; Fri, 26 Feb 2016 21:37:36 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZQ4q-00052p-7Z for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2016 21:37:33 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E37B203EC; Fri, 26 Feb 2016 21:37:10 +0000 (UTC) Received: from gandalf.local.home (cpe-67-246-153-56.stny.res.rr.com [67.246.153.56]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E1F3203DA; Fri, 26 Feb 2016 21:37:09 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.86) (envelope-from ) id 1aZQ4S-0004Wq-FM; Fri, 26 Feb 2016 16:37:08 -0500 Message-Id: <20160226213708.401914663@goodmis.org> User-Agent: quilt/0.61-1 Date: Fri, 26 Feb 2016 16:35:53 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Subject: [PATCH RT 02/10] ARM: smp: Move clear_tasks_mm_cpumask() call to __cpu_die() References: <20160226213551.557375746@goodmis.org> MIME-Version: 1.0 Content-Disposition: inline; filename=0002-ARM-smp-Move-clear_tasks_mm_cpumask-call-to-__cpu_di.patch X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160226_133732_399188_1E61E258 X-CRM114-Status: GOOD ( 17.05 ) X-Spam-Score: -4.2 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Grygorii Strashko , Russell King , stable-rt@vger.kernel.org, Sebastian Andrzej Siewior , Sekhar Nori , Carsten Emde , Paul Gortmaker , philipp@peloton-tech.com, Austin Schuh , John Kacur , Thomas Gleixner , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 3.14.61-rt63-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: Grygorii Strashko When running with the RT-kernel (4.1.5-rt5) on TI OMAP dra7-evm and trying to do Suspend to RAM, the following backtrace occurs: Disabling non-boot CPUs ... PM: noirq suspend of devices complete after 7.295 msecs Disabling non-boot CPUs ... BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:917 in_atomic(): 1, irqs_disabled(): 128, pid: 18, name: migration/1 INFO: lockdep is turned off. irq event stamp: 122 hardirqs last enabled at (121): [] _raw_spin_unlock_irqrestore+0x88/0x90 hardirqs last disabled at (122): [] _raw_spin_lock_irq+0x28/0x5c softirqs last enabled at (0): [] copy_process.part.52+0x410/0x19d8 softirqs last disabled at (0): [< (null)>] (null) Preemption disabled at:[< (null)>] (null) CPU: 1 PID: 18 Comm: migration/1 Tainted: G W 4.1.4-rt3-01046-g96ac8da #204 Hardware name: Generic DRA74X (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x88/0xdc) [] (dump_stack) from [] (___might_sleep+0x198/0x2a8) [] (___might_sleep) from [] (rt_spin_lock+0x30/0x70) [] (rt_spin_lock) from [] (find_lock_task_mm+0x9c/0x174) [] (find_lock_task_mm) from [] (clear_tasks_mm_cpumask+0xb4/0x1ac) [] (clear_tasks_mm_cpumask) from [] (__cpu_disable+0x98/0xbc) [] (__cpu_disable) from [] (take_cpu_down+0x1c/0x50) [] (take_cpu_down) from [] (multi_cpu_stop+0x11c/0x158) [] (multi_cpu_stop) from [] (cpu_stopper_thread+0xc4/0x184) [] (cpu_stopper_thread) from [] (smpboot_thread_fn+0x18c/0x324) [] (smpboot_thread_fn) from [] (kthread+0xe8/0x104) [] (kthread) from [] (ret_from_fork+0x14/0x3c) CPU1: shutdown PM: Calling sched_clock_suspend+0x0/0x40 PM: Calling timekeeping_suspend+0x0/0x2e0 PM: Calling irq_gc_suspend+0x0/0x68 PM: Calling fw_suspend+0x0/0x2c PM: Calling cpu_pm_suspend+0x0/0x28 Also, sometimes system stucks right after displaying "Disabling non-boot CPUs ...". The root cause of above backtrace is task_lock() which takes a sleeping lock on -RT. To fix the issue, move clear_tasks_mm_cpumask() call from __cpu_disable() to __cpu_die() which is called on the thread which is asking for a target CPU to be shutdown. In addition, this change restores CPUhotplug functionality on TI OMAP dra7-evm and CPU1 can be unplugged/plugged many times. Signed-off-by: Grygorii Strashko Cc: Steven Rostedt Cc: Cc: Sekhar Nori Cc: Austin Schuh Cc: Cc: Russell King Cc: Cc: stable-rt@vger.kernel.org Link: http://lkml.kernel.org/r/1441995683-30817-1-git-send-email-grygorii.strashko@ti.com Signed-off-by: Thomas Gleixner Signed-off-by: Steven Rostedt --- arch/arm/kernel/smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 8cd3724714fe..0480b2685da0 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -209,8 +209,6 @@ int __cpu_disable(void) flush_cache_louis(); local_flush_tlb_all(); - clear_tasks_mm_cpumask(cpu); - return 0; } @@ -226,6 +224,9 @@ void __cpu_die(unsigned int cpu) pr_err("CPU%u: cpu didn't die\n", cpu); return; } + + clear_tasks_mm_cpumask(cpu); + printk(KERN_NOTICE "CPU%u: shutdown\n", cpu); /*