metag: 4KB stacks + SMP fix + tweak
cover metag: 4KB stacks + SMP fix + tweak
A couple of patches I've applied for v4.4 relating to 4KB stack support with SMP. Basically 4KB stacks never quite worked with SMP since the IRQ stack was never set up on secondary threads. This causes boot failure if enabled accidentally.
The first patch sets up and tears down the IRQ stack state, and the second is just a small clean up to avoid bit rot.
James Hogan (2):
metag: SMP: Fix 4KiB stack setup on secondary CPUs
metag: Turn irq_ctx_* macros into static inlines
arch/metag/include/asm/irq.h | 8 ++++++-- arch/metag/kernel/smp.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.4.10
A message that is not in the archive (sent off-list or not yet received): 1446160781-12548-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org
PATCH 1/2 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.
--- arch/metag/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+)
arch/metag/kernel/smp.c +2 -0
@@ -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 ();
Signature · 1 line
2.4.10
PATCH 2/2 metag: Turn irq_ctx_* macros into static inlines
In reply to a message not in the archiveThe 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.
--- arch/metag/include/asm/irq.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/metag/include/asm/irq.h +6 -2
@@ -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 );
Signature · 1 line
2.4.10