On Fri, Nov 24, 2023 at 11:15:13AM +0800, Huang Shijie wrote: > In current code, init_irq_stacks() will call cpu_to_node(). > The cpu_to_node() depends on percpu "numa_node" which is initialized in: > arch_call_rest_init() --> rest_init() -- kernel_init() > --> kernel_init_freeable() --> smp_prepare_cpus() > > But init_irq_stacks() is called in init_IRQ() which is before > arch_call_rest_init(). > > So in init_irq_stacks(), the cpu_to_node() does not work, it > always return 0. In NUMA, it makes the node 1 cpu accesses the IRQ stack which > is in the node 0. > > This patch fixes it by: > 1.) export the early_cpu_to_node(), and use it in the init_irq_stacks(). > 2.) change init_irq_stacks() to __init function. > > Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx> > Signed-off-by: Huang Shijie <shijie@xxxxxxxxxxxxxxxxxxxxxx> > --- > v3 --> v4: > 1.) keep early_cpu_to_node() as __init function. > 2.) change init_irq_stacks() to __init function. > > --- > arch/arm64/kernel/irq.c | 5 +++-- > drivers/base/arch_numa.c | 2 +- > include/asm-generic/numa.h | 2 ++ > 3 files changed, 6 insertions(+), 3 deletions(-) Greg, Rafael - any objections to taking this patch through the arm64 tree? -- Catalin