From 928df02bd46e2fe02cfd3127ba1814796d6d80b0 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 15 Sep 2015 22:19:04 +0100 Subject: [PATCH 1/3] metag: SMP: Fix 4KiB stack setup on secondary CPUs Back in early 2008, 4KiB stack support was added to reduce memory consumption on workloads with lots of threads, using a separate IRQ stack per CPU to alleviate stack pressure. However the SMP code added a year and a half later didn't set up the IRQ stack when bringing up secondary CPUs, resulting in a crash when SMP is configured with 4KiB stacks, as soon as the first interrupt arrived on a secondary CPU. Fix with calls to irq_ctx_exit()/irq_ctx_exit() when bringing up/down a CPU. Signed-off-by: James Hogan Cc: linux-metag@vger.kernel.org --- arch/metag/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c index ac3a199e33e7..c3c6f0864881 100644 --- a/arch/metag/kernel/smp.c +++ b/arch/metag/kernel/smp.c @@ -312,6 +312,7 @@ void cpu_die(void) { local_irq_disable(); idle_task_exit(); + irq_ctx_exit(smp_processor_id()); (void)cpu_report_death(); @@ -366,6 +367,7 @@ asmlinkage void secondary_start_kernel(void) panic("No TBI found!"); per_cpu_trap_init(cpu); + irq_ctx_init(cpu); preempt_disable(); From 3dce23eb887800e19cc18b389a13290dd12c5905 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 15 Sep 2015 22:50:33 +0100 Subject: [PATCH 2/3] metag: Turn irq_ctx_* macros into static inlines The irq_ctx_init()/irq_ctx_exit() functions are only used for 4KiB stacks, otherwise they are implemented as an empty macro. To prevent future bit rottage due to the cpu argument not being type checked, convert the macros to empty static inline functions. Signed-off-by: James Hogan Cc: linux-metag@vger.kernel.org --- arch/metag/include/asm/irq.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/metag/include/asm/irq.h b/arch/metag/include/asm/irq.h index ad6bd0edbc3b..6ac6d4a051dd 100644 --- a/arch/metag/include/asm/irq.h +++ b/arch/metag/include/asm/irq.h @@ -6,8 +6,12 @@ extern void irq_ctx_init(int cpu); extern void irq_ctx_exit(int cpu); # define __ARCH_HAS_DO_SOFTIRQ #else -# define irq_ctx_init(cpu) do { } while (0) -# define irq_ctx_exit(cpu) do { } while (0) +static inline void irq_ctx_init(int cpu) +{ +} +static inline void irq_ctx_exit(int cpu) +{ +} #endif void tbi_startup_interrupt(int); From f23d0e2468bc538e8c33223af8963ef40b7515bf Mon Sep 17 00:00:00 2001 From: James Hogan Date: Mon, 9 Nov 2015 18:40:59 +0000 Subject: [PATCH 3/3] MAINTAINERS: Change Meta arch port status to Odd Fixes For a while now the Meta architecture port has been supported with only odd fixes rather than any big new features, since it has now been effectively supersceded by MIPS, and there is no prospect of any new products being based on it. Change the maintenance status to Odd Fixes in order to reflect reality. Signed-off-by: James Hogan Cc: linux-metag@vger.kernel.org --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7ba7ab749c85..dc5de44fb50d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6846,7 +6846,7 @@ F: Documentation/hwmon/menf21bmc METAG ARCHITECTURE M: James Hogan L: linux-metag@vger.kernel.org -S: Supported +S: Odd Fixes F: arch/metag/ F: Documentation/metag/ F: Documentation/devicetree/bindings/metag/