Commit be167862 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds
Browse files

ARM: prevent tracing IPI_CPU_BACKTRACE

Patch series "compiler: allow all arches to enable

This patch (of 11):

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 commit e7273ff4 ("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
e7273ff4 as well.

[ rebase on v5.1-rc1]
Fixes: e7273ff4 ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI")
Fixes: 365ec7b1

 ("ARM: add IPI tracepoints") # v3.17
Signed-off-by: default avatarArnd Bergmann <>
Signed-off-by: default avatarMasahiro Yamada <>
Cc: Heiko Carstens <>
Cc: Arnd Bergmann <>
Cc: Ingo Molnar <>
Cc: Christophe Leroy <>
Cc: Mathieu Malaterre <>
Cc: "H. Peter Anvin" <>
Cc: Thomas Gleixner <>
Cc: Benjamin Herrenschmidt <>
Cc: Paul Mackerras <>
Cc: Ralf Baechle <>
Cc: Stefan Agner <>
Cc: Boris Brezillon <>
Cc: Miquel Raynal <>
Cc: Richard Weinberger <>
Cc: David Woodhouse <>
Cc: Brian Norris <>
Cc: Marek Vasut <>
Cc: Russell King <>
Cc: Borislav Petkov <>
Cc: Mark Rutland <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 687a3e4d
......@@ -6,6 +6,7 @@
#include <linux/threads.h>
#include <asm/irq.h>
/* number of IPIS _not_ including IPI_CPU_BACKTRACE */
#define NR_IPI 7
typedef struct {
......@@ -70,6 +70,10 @@ enum ipi_msg_type {
* CPU_BACKTRACE is special and not included in NR_IPI
* or tracable with trace_ipi_*
* SGI8-15 can be reserved by secure firmware, and thus may
......@@ -797,7 +801,7 @@ core_initcall(register_cpufreq_notifier);
static void raise_nmi(cpumask_t *mask)
smp_cross_call(mask, IPI_CPU_BACKTRACE);
__smp_cross_call(mask, IPI_CPU_BACKTRACE);
void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment