From: Suzuki K Poulose Date: Thu, 21 Jul 2016 10:12:55 +0000 (+0100) Subject: arm64: Fix incorrect per-cpu usage for boot CPU X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9113c2aa05e9848cd4f1154abee17d4f265f012d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git arm64: Fix incorrect per-cpu usage for boot CPU In smp_prepare_boot_cpu(), we invoke cpuinfo_store_boot_cpu to store the cpuinfo in a per-cpu ptr, before initialising the per-cpu offset for the boot CPU. This patch reorders the sequence to make sure we initialise the per-cpu offset before accessing the per-cpu area. Commit 4b998ff1885eec ("arm64: Delay cpuinfo_store_boot_cpu") fixed the issue where we modified the per-cpu area even before the kernel initialises the per-cpu areas, but failed to wait until the boot cpu updated it's offset. Fixes: 4b998ff1885e ("arm64: Delay cpuinfo_store_boot_cpu") Cc: # 4.4+ Cc: Will Deacon Signed-off-by: Suzuki K Poulose Acked-by: Mark Rutland Signed-off-by: Catalin Marinas --- diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index c0a772560ab7..298dd745651e 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -436,9 +436,9 @@ void __init smp_cpus_done(unsigned int max_cpus) void __init smp_prepare_boot_cpu(void) { + set_my_cpu_offset(per_cpu_offset(smp_processor_id())); cpuinfo_store_boot_cpu(); save_boot_cpu_run_el(); - set_my_cpu_offset(per_cpu_offset(smp_processor_id())); } static u64 __init of_get_cpu_mpidr(struct device_node *dn)