Message ID | 20240503171847.68267-2-puranjay@kernel.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v3,1/2] arm64/arch_timer: include <linux/percpu.h> | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Quoting Puranjay Mohan (2024-05-03 10:18:47) > Remove the percpu variable cpu_number as it is used only in > set_smp_ipi_range() as a dummy variable to be passed to ipi_handler(). > Use irq_stat in place of cpu_number here like arm32. > > [1] https://github.com/puranjaymohan/linux/commit/77d3fdd Maybe you should have put this under the cut for the patch so its on the mailing list, and lore. > > Signed-off-by: Puranjay Mohan <puranjay@kernel.org> > Acked-by: Mark Rutland <mark.rutland@arm.com> > --- Reviewed-by: Stephen Boyd <swboyd@chromium.org> > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > index 4ced34f62dab..98d4e352c3d0 100644 > --- a/arch/arm64/kernel/smp.c > +++ b/arch/arm64/kernel/smp.c > @@ -1021,12 +1016,12 @@ void __init set_smp_ipi_range(int ipi_base, int n) > > if (ipi_should_be_nmi(i)) { > err = request_percpu_nmi(ipi_base + i, ipi_handler, > - "IPI", &cpu_number); > + "IPI", &irq_stat); I know this is mirroring arm, but it would be nice to have a comment saying that we need some percpu variable here even if the handler doesn't use it.
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index efb13112b408..2510eec026f7 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -25,22 +25,11 @@ #ifndef __ASSEMBLY__ -#include <asm/percpu.h> - #include <linux/threads.h> #include <linux/cpumask.h> #include <linux/thread_info.h> -DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number); - -/* - * We don't use this_cpu_read(cpu_number) as that has implicit writes to - * preempt_count, and associated (compiler) barriers, that we'd like to avoid - * the expense of. If we're preemptible, the value can be stale at use anyway. - * And we can't use this_cpu_ptr() either, as that winds up recursing back - * here under CONFIG_DEBUG_PREEMPT=y. - */ -#define raw_smp_processor_id() (*raw_cpu_ptr(&cpu_number)) +#define raw_smp_processor_id() (current_thread_info()->cpu) /* * Logical CPU mapping. diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 4ced34f62dab..98d4e352c3d0 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -55,9 +55,6 @@ #include <trace/events/ipi.h> -DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number); -EXPORT_PER_CPU_SYMBOL(cpu_number); - /* * as from 2.5, kernels no longer have an init_tasks structure * so we need some other way of telling a new secondary core @@ -742,8 +739,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) */ for_each_possible_cpu(cpu) { - per_cpu(cpu_number, cpu) = cpu; - if (cpu == smp_processor_id()) continue; @@ -1021,12 +1016,12 @@ void __init set_smp_ipi_range(int ipi_base, int n) if (ipi_should_be_nmi(i)) { err = request_percpu_nmi(ipi_base + i, ipi_handler, - "IPI", &cpu_number); + "IPI", &irq_stat); WARN(err, "Could not request IPI %d as NMI, err=%d\n", i, err); } else { err = request_percpu_irq(ipi_base + i, ipi_handler, - "IPI", &cpu_number); + "IPI", &irq_stat); WARN(err, "Could not request IPI %d as IRQ, err=%d\n", i, err); }