From patchwork Thu Aug 14 11:15:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 4723751 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 72386C033A for ; Thu, 14 Aug 2014 11:18:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C47B200E5 for ; Thu, 14 Aug 2014 11:18:38 +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 9FD2D201DC for ; Thu, 14 Aug 2014 11:18:36 +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 1XHt1J-0000jh-Vc; Thu, 14 Aug 2014 11:16:37 +0000 Received: from mail-wg0-f45.google.com ([74.125.82.45]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHt1B-0000fl-NE for linux-arm-kernel@lists.infradead.org; Thu, 14 Aug 2014 11:16:30 +0000 Received: by mail-wg0-f45.google.com with SMTP id x12so916410wgg.4 for ; Thu, 14 Aug 2014 04:16:04 -0700 (PDT) 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=+45E1PpbAohMcVbX2SlZzfbbtVHqg6Ik9yuCWpfbLvk=; b=O5d2aSjuL3KePwDI00d9a/fvZQHA/FSUyAwqdSIwuMM2EaOosboc6Qmln1qwGwAtgi yjOgAKJcf94ncrugJVRFNmtrWZ+Z+ZX0PkwkZBDj3hfBuNxDt+wcCn1y2DbCosZnPUJy akAkIue3yYeiLafOV3CIYAfnsWCmTCnXM4iYjOREvnkTMw9x4ZN/99udSDy+SRPGiasi t33xFUsBz+T+Wf8EnpKOB00xM/PPa7a5LjD48KBYZVyIcPZuRNfOcAS+efZnrWgzf0zl Z0d6pxrBMwiT8M7A6xWH+R0bNh7pV8LzxV4VuHzzaHLQboYAaz893IKt9heJl8Z88D46 r5GQ== X-Gm-Message-State: ALoCoQlsexez1+g0r2OjnFwCq503gsMKgzvDEWEwpyiAp2ehQrHfsVVSORzAdtSSAUPaR1n3ISuh X-Received: by 10.180.21.235 with SMTP id y11mr11047647wie.75.1408014964563; Thu, 14 Aug 2014 04:16:04 -0700 (PDT) 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 gb5sm18966593wib.8.2014.08.14.04.16.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Aug 2014 04:16:03 -0700 (PDT) From: Daniel Thompson To: Russell King Subject: [RFC PATCH 2/3] arm: kgdb: Add support for IPI FIQ roundup Date: Thu, 14 Aug 2014 12:15:50 +0100 Message-Id: <1408014951-24820-3-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1408014951-24820-1-git-send-email-daniel.thompson@linaro.org> References: <53EC9404.5010908@linaro.org> <1408014951-24820-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140814_041629_915069_B3E1F9ED X-CRM114-Status: GOOD ( 14.52 ) X-Spam-Score: -0.7 (/) Cc: Daniel Thompson , linaro-kernel@lists.linaro.org, Catalin Marinas , patches@linaro.org, kgdb-bugreport@lists.sourceforge.net, Linus Walleij , Nicolas Pitre , linux-kernel@vger.kernel.org, Frederic Weisbecker , Anton Vorontsov , Ben Dooks , John Stultz , Fabio Estevam , Colin Cross , kernel-team@android.com, Dave Martin , 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Rounding up the other CPUs using FIQ improves debugger robustness. Signed-off-by: Daniel Thompson --- arch/arm/include/asm/kgdb.h | 1 + arch/arm/kernel/kgdb.c | 20 ++++++++++++++++---- arch/arm/kernel/kgdb_fiq.c | 7 ++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h index 5de21f01..ceb466f 100644 --- a/arch/arm/include/asm/kgdb.h +++ b/arch/arm/include/asm/kgdb.h @@ -50,6 +50,7 @@ static inline void arch_kgdb_breakpoint(void) extern void kgdb_handle_bus_error(void); extern int kgdb_fault_expected; +extern int kgdb_fiq_enabled; extern char kgdb_fiq_handler; extern char kgdb_fiq_handler_end; asmlinkage void __exception_irq_entry kgdb_fiq_do_handle(struct pt_regs *regs); diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index a74b53c..e5c3ec0 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c @@ -175,14 +175,26 @@ static struct undef_hook kgdb_compiled_brkpt_hook = { static void kgdb_call_nmi_hook(void *ignored) { - kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); + kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); } void kgdb_roundup_cpus(unsigned long flags) { - local_irq_enable(); - smp_call_function(kgdb_call_nmi_hook, NULL, 0); - local_irq_disable(); +#ifdef CONFIG_FIQ + struct cpumask mask; + + if (kgdb_fiq_enabled) { + cpumask_copy(&mask, cpu_online_mask); + cpumask_clear_cpu(raw_smp_processor_id(), &mask); + if (!cpumask_empty(&mask)) + send_fiq_ipi_mask(&mask); + return; + } +#endif + + local_irq_enable(); + smp_call_function(kgdb_call_nmi_hook, NULL, 0); + local_irq_disable(); } static int __kgdb_notify(struct die_args *args, unsigned long cmd) diff --git a/arch/arm/kernel/kgdb_fiq.c b/arch/arm/kernel/kgdb_fiq.c index a894dde..f7a2c3d 100644 --- a/arch/arm/kernel/kgdb_fiq.c +++ b/arch/arm/kernel/kgdb_fiq.c @@ -24,7 +24,7 @@ #include #include -static int kgdb_fiq_enabled; +int kgdb_fiq_enabled; module_param_named(enable, kgdb_fiq_enabled, int, 0600); MODULE_PARM_DESC(enable, "set to 1 to enable FIQ KGDB"); @@ -40,6 +40,11 @@ asmlinkage void __exception_irq_entry kgdb_fiq_do_handle(struct pt_regs *regs) { int actual; + if (!kgdb_nmicallback(raw_smp_processor_id(), regs)) { + handle_IPI_FIQ(regs); + return; + } + nmi_enter(); actual = ack_fiq(kgdb_fiq); WARN_ON(actual != kgdb_fiq);