From patchwork Mon Jan 5 14:54:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 5568521 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 B635A9F162 for ; Mon, 5 Jan 2015 14:59:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E72DB20131 for ; Mon, 5 Jan 2015 14:59:13 +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 187572012E for ; Mon, 5 Jan 2015 14:59:13 +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 1Y895e-0007cH-AM; Mon, 05 Jan 2015 14:57:06 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y894H-0006je-46 for linux-arm-kernel@lists.infradead.org; Mon, 05 Jan 2015 14:55:42 +0000 Received: by mail-wi0-f177.google.com with SMTP id l15so3428646wiw.16 for ; Mon, 05 Jan 2015 06:55:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ipD5rlBtt0mUeIHt6TaNBw2U88EVjlQTGSDUcOUu+/s=; b=Xe3z/i7qNcJSV8u+st/IRZ4itcAQ1E3DmkIQbo+rhVOu+/mwIF77DuwduAn65cZKKH 0npeiOr5dMYAKbOrK3G1wEHyL54g02PuLQa3f3Jvf4NL/ktqVSqtl3DATPj76joMm0I7 WYjLDjXELSM7yNeuGdE5waOlPqtvXZJL+QggwwlHbQX4hKXvkG6ukzMYG07KkwlRDxyk 1Ocnz6zMDv5OxF5zsXLUDbegW8oNvVXKy3ZbhzddoZQut5iCz9hWgpOWT/ic48LOh9L3 NOwqnzd+yelXJPskujqNJPcAhziTDPieqdUOO5l7UUfDVCRbMappc/P+tLwPi4TWI+AA 6dxw== X-Gm-Message-State: ALoCoQn86n7PymFjiz3HxXxjXzpvBMniLeBwCu0QBMpG9hInLgPGWjPeNUIsG3LB+g12DXkewYpZ X-Received: by 10.180.75.42 with SMTP id z10mr26549626wiv.70.1420469717705; Mon, 05 Jan 2015 06:55:17 -0800 (PST) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id n5sm10239010wic.6.2015.01.05.06.55.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jan 2015 06:55:16 -0800 (PST) From: Daniel Thompson To: Thomas Gleixner , Jason Cooper Subject: [PATCH 3.19-rc2 v13 5/5] ARM: Fix on-demand backtrace triggered by IRQ Date: Mon, 5 Jan 2015 14:54:59 +0000 Message-Id: <1420469699-25350-6-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1420469699-25350-1-git-send-email-daniel.thompson@linaro.org> References: <1415968543-29469-1-git-send-email-daniel.thompson@linaro.org> <1420469699-25350-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150105_065541_346272_8A39E2F2 X-CRM114-Status: GOOD ( 12.33 ) X-Spam-Score: -0.7 (/) Cc: Daniel Thompson , linaro-kernel@lists.linaro.org, Russell King , patches@linaro.org, Stephen Boyd , linux-kernel@vger.kernel.org, Steven Rostedt , Daniel Drake , Dmitry Pervushin , Dirk Behme , John Stultz , Tim Sander , Sumit Semwal , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Currently if arch_trigger_all_cpu_backtrace() is called with interrupts disabled and on a platform the delivers IPI_CPU_BACKTRACE using regular IRQ requests the system will wedge for ten seconds waiting for the current CPU to react to a masked interrupt. This patch resolves this issue by calling directly into the backtrace dump code instead of generating an IPI. Signed-off-by: Daniel Thompson Cc: Steven Rostedt --- arch/arm/kernel/smp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 12667eb68198..644f654f7a7e 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -767,7 +767,10 @@ void ipi_cpu_backtrace(struct pt_regs *regs) /* Replace printk to write into the NMI seq */ this_cpu_write(printk_func, nmi_vprintk); printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu); - show_regs(regs); + if (regs != NULL) + show_regs(regs); + else + dump_stack(); this_cpu_write(printk_func, printk_func_save); cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask)); @@ -812,6 +815,16 @@ void arch_trigger_all_cpu_backtrace(bool include_self) seq_buf_init(&s->seq, s->buffer, NMI_BUF_SIZE); } + /* + * If irqs are disabled on the current processor then, if + * IPI_CPU_BACKTRACE is delivered using IRQ, we will won't be able to + * react to IPI_CPU_BACKTRACE until we leave this function. We avoid + * the potential timeout (not to mention the failure to print useful + * information) by calling the backtrace directly. + */ + if (include_self && irqs_disabled()) + ipi_cpu_backtrace(in_interrupt() ? get_irq_regs() : NULL); + if (!cpumask_empty(to_cpumask(backtrace_mask))) { pr_info("Sending NMI to %s CPUs:\n", (include_self ? "all" : "other"));