From patchwork Sun Sep 14 11:57:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 37384 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A31BB206A5 for ; Sun, 14 Sep 2014 11:59:32 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id m15sf1489657wgh.7 for ; Sun, 14 Sep 2014 04:59:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=MNzTTGivr8wsMrJIdTwqJmv+hFj45L7uOh+6lA2akPY=; b=AsHsfFiSQbyXBhzTh4RP6mEPye3iM09xjhT9RsNCg+vy/e2POTssrKFu9BoalwfOkj p8L+uHOTiTM87n5Iw/AtpLY35brxMzrd2Ma/uS6KV5MKVLYv+zMIwvxbD/2cmKuMJBmT cP/lp8dmSWyGe1Shysl3+5jbmstbJ5ibHfM7//mPYQRlr0dgoJLDvZ9wXKqdhW9eQ3Ji LsxiETCYnqq9R4oz/vHUBAP6Dpb3jb3OIAqrK8WWSx0FW24/Zl4IDVmS0TlEstuTrmcy ODkVDc+yLv93anhN7vKeYqoPSr72RgpvaLvFW2MUBqyWiGMrfE8ddvX8gMxhObQqkGiP AMSw== X-Gm-Message-State: ALoCoQniwIGg9fRQ/1022IITdgeih/3c1lwqY41uBqAy8dYF1E68tzpGaf/sGorz0qScT8PBjKjG X-Received: by 10.194.203.40 with SMTP id kn8mr746207wjc.4.1410695971797; Sun, 14 Sep 2014 04:59:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.134 with SMTP id b6ls290648lah.42.gmail; Sun, 14 Sep 2014 04:59:31 -0700 (PDT) X-Received: by 10.152.21.6 with SMTP id r6mr21499332lae.6.1410695971518; Sun, 14 Sep 2014 04:59:31 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com [209.85.217.176]) by mx.google.com with ESMTPS id az15si14757388lab.35.2014.09.14.04.59.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 14 Sep 2014 04:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id z11so3042689lbi.21 for ; Sun, 14 Sep 2014 04:59:31 -0700 (PDT) X-Received: by 10.112.75.233 with SMTP id f9mr1362299lbw.102.1410695971457; Sun, 14 Sep 2014 04:59:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.130.169 with SMTP id of9csp74076lbb; Sun, 14 Sep 2014 04:59:30 -0700 (PDT) X-Received: by 10.180.84.66 with SMTP id w2mr15962611wiy.27.1410695970714; Sun, 14 Sep 2014 04:59:30 -0700 (PDT) Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by mx.google.com with ESMTPS id gh6si10668902wic.77.2014.09.14.04.59.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 14 Sep 2014 04:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.176 as permitted sender) client-ip=74.125.82.176; Received: by mail-we0-f176.google.com with SMTP id q58so2739742wes.21 for ; Sun, 14 Sep 2014 04:59:30 -0700 (PDT) X-Received: by 10.194.86.34 with SMTP id m2mr25858969wjz.23.1410695970533; Sun, 14 Sep 2014 04:59:30 -0700 (PDT) Received: from harvey.bri.st.com ([212.183.140.14]) by mx.google.com with ESMTPSA id fh5sm7947027wib.5.2014.09.14.04.59.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Sep 2014 04:59:29 -0700 (PDT) From: Daniel Thompson To: Russell King Cc: Daniel Thompson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Thomas Gleixner , Sumit Semwal Subject: [PATCH 3.17-rc4 v6 6/6] arm: smp: Handle ipi_cpu_backtrace() using FIQ (if available) Date: Sun, 14 Sep 2014 12:57:15 +0100 Message-Id: <1410695835-10496-7-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1410695835-10496-1-git-send-email-daniel.thompson@linaro.org> References: <1410695835-10496-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Previous changes have introduced a replacement default FIQ handler and an implementation of arch_trigger_all_cpu_backtrace for ARM but these are currently independant. This patch plumbs together these features making it possible, on platforms that support it, to trigger backtrace using FIQ. Signed-off-by: Daniel Thompson --- arch/arm/include/asm/smp.h | 3 +++ arch/arm/kernel/fiq.c | 8 ++++---- arch/arm/kernel/smp.c | 4 +++- arch/arm/kernel/traps.c | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h index 2ec765c..0580270 100644 --- a/arch/arm/include/asm/smp.h +++ b/arch/arm/include/asm/smp.h @@ -18,6 +18,8 @@ # error " included in non-SMP build" #endif +#define SMP_IPI_FIQ_MASK 0x0100 + #define raw_smp_processor_id() (current_thread_info()->cpu) struct seq_file; @@ -85,6 +87,7 @@ extern void arch_send_call_function_single_ipi(int cpu); extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); +extern void ipi_cpu_backtrace(struct pt_regs *regs); extern int register_ipi_completion(struct completion *completion, int cpu); struct smp_operations { diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c index 1743049..b37752a 100644 --- a/arch/arm/kernel/fiq.c +++ b/arch/arm/kernel/fiq.c @@ -52,8 +52,8 @@ (unsigned)&vector_fiq_offset; \ }) -static unsigned long no_fiq_insn; -static struct pt_regs def_fiq_regs; +static unsigned long dfl_fiq_insn; +static struct pt_regs dfl_fiq_regs; /* Default reacquire function * - we always relinquish FIQ control @@ -65,7 +65,7 @@ static int fiq_def_op(void *ref, int relinquish) /* Restore default handler and registers */ local_fiq_disable(); set_fiq_regs(&dfl_fiq_regs); - set_fiq_handler(&no_fiq_insn, sizeof(no_fiq_insn)); + set_fiq_handler(&dfl_fiq_insn, sizeof(dfl_fiq_insn)); local_fiq_enable(); /* FIXME: notify irq controller to standard enable FIQs */ @@ -158,7 +158,7 @@ EXPORT_SYMBOL(disable_fiq); void __init init_FIQ(int start) { unsigned offset = FIQ_OFFSET; - no_fiq_insn = *(unsigned long *)(0xffff0000 + offset); + dfl_fiq_insn = *(unsigned long *)(0xffff0000 + offset); get_fiq_regs(&dfl_fiq_regs); fiq_start = start; } diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 94959f9..7a79d11 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -543,7 +543,7 @@ static void ipi_cpu_stop(unsigned int cpu) cpu_relax(); } -static void ipi_cpu_backtrace(struct pt_regs *regs) +void ipi_cpu_backtrace(struct pt_regs *regs) { int cpu = smp_processor_id(); @@ -584,6 +584,8 @@ void handle_IPI(int ipinr, struct pt_regs *regs) unsigned int cpu = smp_processor_id(); struct pt_regs *old_regs = set_irq_regs(regs); + BUILD_BUG_ON(SMP_IPI_FIQ_MASK != BIT(IPI_CPU_BACKTRACE)); + if ((unsigned)ipinr < NR_IPI) { trace_ipi_entry(ipi_types[ipinr]); __inc_irq_stat(cpu, ipi_irqs[ipinr]); diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 92c4ea1..40b1de7 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -483,6 +483,9 @@ asmlinkage void __exception_irq_entry handle_fiq_as_nmi(struct pt_regs *regs) #ifdef CONFIG_ARM_GIC gic_handle_fiq_ipi(); #endif +#ifdef CONFIG_SMP + ipi_cpu_backtrace(regs); +#endif nmi_exit();