x86/irq/64: Init hardirq_stack_ptr during CPU hotplug
authorThomas Gleixner <tglx@linutronix.de>
Sun, 14 Apr 2019 16:00:05 +0000 (18:00 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 17 Apr 2019 13:34:21 +0000 (15:34 +0200)
Preparatory change for disentangling the irq stack union as a
prerequisite for irq stacks with guard pages.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: "Chang S. Bae" <chang.seok.bae@intel.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Nicolai Stange <nstange@suse.de>
Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: x86-ml <x86@kernel.org>
Cc: Yi Wang <wang.yi59@zte.com.cn>
Link: https://lkml.kernel.org/r/20190414160146.177558566@linutronix.de
arch/x86/include/asm/irq.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/irq_64.c

index d751e8440a6bbf9776b0d1786a1ca5c743db48c9..8f95686ec27e09662c1be58e2b6cb0d5aa79c67f 100644 (file)
@@ -16,11 +16,7 @@ static inline int irq_canonicalize(int irq)
        return ((irq == 2) ? 9 : irq);
 }
 
-#ifdef CONFIG_X86_32
 extern int irq_init_percpu_irqstack(unsigned int cpu);
-#else
-static inline int irq_init_percpu_irqstack(unsigned int cpu) { return 0; }
-#endif
 
 #define __ARCH_HAS_DO_SOFTIRQ
 
index 13ec72bb8f368b5a7030f4eec957ee76ebaab29d..1222080838dac3c208aace3a60ccc1c4fe8b9888 100644 (file)
@@ -1510,9 +1510,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
        &init_task;
 EXPORT_PER_CPU_SYMBOL(current_task);
 
-DEFINE_PER_CPU(char *, hardirq_stack_ptr) =
-       init_per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE;
-
+DEFINE_PER_CPU(char *, hardirq_stack_ptr);
 DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1;
 
 DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT;
index f0c7356c89699daa13c2e1a30b4adc10132ca2ce..c0bea0d7d76aebf59ef3af728adaae380253f8c3 100644 (file)
@@ -87,3 +87,18 @@ bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
        generic_handle_irq_desc(desc);
        return true;
 }
+
+static int map_irq_stack(unsigned int cpu)
+{
+       void *va = per_cpu_ptr(irq_stack_union.irq_stack, cpu);
+
+       per_cpu(hardirq_stack_ptr, cpu) = va + IRQ_STACK_SIZE;
+       return 0;
+}
+
+int irq_init_percpu_irqstack(unsigned int cpu)
+{
+       if (per_cpu(hardirq_stack_ptr, cpu))
+               return 0;
+       return map_irq_stack(cpu);
+}