Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/irq/64: Init hardirq_stack_ptr during CPU hotplug

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

authored by

Thomas Gleixner and committed by
Borislav Petkov
0ac26104 66c7ceb4

+16 -7
-4
arch/x86/include/asm/irq.h
··· 16 16 return ((irq == 2) ? 9 : irq); 17 17 } 18 18 19 - #ifdef CONFIG_X86_32 20 19 extern int irq_init_percpu_irqstack(unsigned int cpu); 21 - #else 22 - static inline int irq_init_percpu_irqstack(unsigned int cpu) { return 0; } 23 - #endif 24 20 25 21 #define __ARCH_HAS_DO_SOFTIRQ 26 22
+1 -3
arch/x86/kernel/cpu/common.c
··· 1510 1510 &init_task; 1511 1511 EXPORT_PER_CPU_SYMBOL(current_task); 1512 1512 1513 - DEFINE_PER_CPU(char *, hardirq_stack_ptr) = 1514 - init_per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE; 1515 - 1513 + DEFINE_PER_CPU(char *, hardirq_stack_ptr); 1516 1514 DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1; 1517 1515 1518 1516 DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT;
+15
arch/x86/kernel/irq_64.c
··· 87 87 generic_handle_irq_desc(desc); 88 88 return true; 89 89 } 90 + 91 + static int map_irq_stack(unsigned int cpu) 92 + { 93 + void *va = per_cpu_ptr(irq_stack_union.irq_stack, cpu); 94 + 95 + per_cpu(hardirq_stack_ptr, cpu) = va + IRQ_STACK_SIZE; 96 + return 0; 97 + } 98 + 99 + int irq_init_percpu_irqstack(unsigned int cpu) 100 + { 101 + if (per_cpu(hardirq_stack_ptr, cpu)) 102 + return 0; 103 + return map_irq_stack(cpu); 104 + }