From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/9] ARM: change NR_IPIS to 8
Date: Thu, 18 Feb 2016 16:18:59 +0100 [thread overview]
Message-ID: <2915766.O3WEnikESX@wuerfel> (raw)
In-Reply-To: <20160218143709.GQ19428@n2100.arm.linux.org.uk>
On Thursday 18 February 2016 14:37:09 Russell King - ARM Linux wrote:
> On Thu, Feb 18, 2016 at 03:01:54PM +0100, Arnd Bergmann wrote:
> > When function tracing for IPIs is enabled, we get a warning for an
> > overflow of the ipi_types array with the IPI_CPU_BACKTRACE type
> > as triggered by raise_nmi():
> >
> > arch/arm/kernel/smp.c: In function 'raise_nmi':
> > arch/arm/kernel/smp.c:489:2: error: array subscript is above array bounds [-Werror=array-bounds]
> > trace_ipi_raise(target, ipi_types[ipinr]);
>
> We really don't want to treat the backtrace IPI as a normal IPI at all -
> we want it to invoke the least amount of code possible. Hence this code
> which avoids the issue:
>
> if ((unsigned)ipinr < NR_IPI) {
> trace_ipi_entry_rcuidle(ipi_types[ipinr]);
> __inc_irq_stat(cpu, ipi_irqs[ipinr]);
> }
>
> However, what's missing is that the addition of tracing here missed
> that CPU_BACKTRACE is not to be traced. The call in raise_nmi()
> should have been converted to __smp_cross_call() to avoid the
> tracing code.
I've replaced the patch locally with the version below now, and
will throw it into the randconfig build test infrastructure to
make sure I didn't screw up in an obvious way here.
Arnd
>From 7528c9b0558fdf4de785e62e61f0dd2ffe874110 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Sun, 31 Jan 2016 22:26:21 +0100
Subject: [PATCH] ARM: prevent tracing IPI_CPU_BACKTRACE
When function tracing for IPIs is enabled, we get a warning for an
overflow of the ipi_types array with the IPI_CPU_BACKTRACE type
as triggered by raise_nmi():
arch/arm/kernel/smp.c: In function 'raise_nmi':
arch/arm/kernel/smp.c:489:2: error: array subscript is above array bounds [-Werror=array-bounds]
trace_ipi_raise(target, ipi_types[ipinr]);
This is a correct warning as we actually overflow the array here.
This patch raise_nmi() to call __smp_cross_call() instead of
smp_cross_call(), to avoid calling into ftrace. For clarification,
I'm also adding a two new code comments describing how this one
is special.
The warning appears to have shown up after patch e7273ff49acf
("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI"), which
changed the number assignment from '15' to '8', but as far as I can
tell has existed since the IPI tracepoints were first introduced.
If we decide to backport this patch to stable kernels, we probably
need to backport e7273ff49acf as well.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: e7273ff49acf ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI")
Fixes: 365ec7b17327 ("ARM: add IPI tracepoints") # v3.17
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index 3d7351c844aa..2fd0a2619b0b 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -5,6 +5,7 @@
#include <linux/threads.h>
#include <asm/irq.h>
+/* number of IPIS _not_ including IPI_CPU_BACKTRACE */
#define NR_IPI 7
typedef struct {
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index b4048e370730..9802a94260db 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -72,6 +72,10 @@ enum ipi_msg_type {
IPI_CPU_STOP,
IPI_IRQ_WORK,
IPI_COMPLETION,
+ /*
+ * CPU_BACKTRACE is special and not included in NR_IPI
+ * or tracable with trace_ipi_*
+ */
IPI_CPU_BACKTRACE,
/*
* SGI8-15 can be reserved by secure firmware, and thus may
@@ -757,7 +761,7 @@ static void raise_nmi(cpumask_t *mask)
if (cpumask_test_cpu(smp_processor_id(), mask) && irqs_disabled())
nmi_cpu_backtrace(NULL);
- smp_cross_call(mask, IPI_CPU_BACKTRACE);
+ __smp_cross_call(mask, IPI_CPU_BACKTRACE);
}
void arch_trigger_all_cpu_backtrace(bool include_self)
next prev parent reply other threads:[~2016-02-18 15:18 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 14:01 [PATCH 0/9] ARM: randconfig testing fallout Arnd Bergmann
2016-02-18 14:01 ` [PATCH 1/9] ARM: ARMv7-M uses BE-8, not BE-32 Arnd Bergmann
2016-02-18 16:06 ` Nicolas Pitre
2016-02-18 16:12 ` Arnd Bergmann
2016-02-19 8:47 ` Vladimir Murzin
2016-02-19 10:17 ` Arnd Bergmann
2016-02-18 14:01 ` [PATCH 2/9] ARM: change NR_IPIS to 8 Arnd Bergmann
2016-02-18 14:26 ` Marc Zyngier
2016-02-18 14:37 ` Russell King - ARM Linux
2016-02-18 15:18 ` Arnd Bergmann [this message]
2018-09-18 8:19 ` Chunyan Zhang
2016-02-18 14:01 ` [PATCH 3/9] ARM: make free_memmap as __init Arnd Bergmann
2016-02-18 15:55 ` Nicolas Pitre
2016-02-18 14:01 ` [PATCH 4/9] ARM: add CONFIG_PHYS_OFFSET default values Arnd Bergmann
2016-02-18 16:02 ` Nicolas Pitre
2016-02-19 8:33 ` Arnd Bergmann
2016-02-19 14:29 ` Chris Brandt
2016-02-19 15:34 ` Arnd Bergmann
2016-02-19 16:43 ` Russell King - ARM Linux
2016-02-19 17:18 ` Chris Brandt
2016-02-19 17:57 ` Nicolas Pitre
2016-02-19 16:10 ` Nicolas Pitre
2016-02-19 16:23 ` Arnd Bergmann
2016-02-19 17:31 ` Nicolas Pitre
2016-02-19 18:07 ` Russell King - ARM Linux
2016-02-19 21:14 ` Arnd Bergmann
2016-02-18 14:01 ` [PATCH 5/9] ARM: atags_to_fdt: don't warn about stack size Arnd Bergmann
2016-02-18 16:13 ` Nicolas Pitre
2016-02-18 16:26 ` [PATCH v2] " Arnd Bergmann
2016-02-18 17:14 ` Nicolas Pitre
2016-02-19 16:58 ` Arnd Bergmann
2016-02-18 14:01 ` [PATCH 6/9] ARM: uaccess: avoid warning for NOMMU in access_ok Arnd Bergmann
2016-02-18 16:15 ` Nicolas Pitre
2016-02-18 14:01 ` [PATCH 7/9] ARM: move NO_DMA definition to ecard.h Arnd Bergmann
2016-02-18 16:17 ` Nicolas Pitre
2016-02-18 14:02 ` [PATCH 8/9] ARM: do not use optimized do_div for ARMv3 Arnd Bergmann
2016-02-18 17:20 ` Nicolas Pitre
2016-02-19 9:03 ` Arnd Bergmann
2016-02-19 18:44 ` Nicolas Pitre
2016-02-18 14:02 ` [PATCH 9/9] ARM: fix kprobe test with CONFIG_CPU_32v3 Arnd Bergmann
2016-02-18 14:21 ` Jon Medhurst (Tixy)
2016-02-18 16:21 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2915766.O3WEnikESX@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).