linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Fix incorrect per-cpu usage for boot CPU
@ 2016-07-21 10:12 Suzuki K Poulose
  2016-07-21 10:33 ` Mark Rutland
  2016-07-21 15:02 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2016-07-21 10:12 UTC (permalink / raw)
  To: linux-arm-kernel

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: commit 4b998ff1885eec ("arm64: Delay cpuinfo_store_boot_cpu")
Cc: <stable@vger.kernel.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 62ff3c0..d242e81 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -437,9 +437,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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm64: Fix incorrect per-cpu usage for boot CPU
  2016-07-21 10:12 [PATCH] arm64: Fix incorrect per-cpu usage for boot CPU Suzuki K Poulose
@ 2016-07-21 10:33 ` Mark Rutland
  2016-07-21 15:02 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2016-07-21 10:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 21, 2016 at 11:12:55AM +0100, Suzuki K Poulose wrote:
> 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: commit 4b998ff1885eec ("arm64: Delay cpuinfo_store_boot_cpu")
> Cc: <stable@vger.kernel.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  arch/arm64/kernel/smp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index 62ff3c0..d242e81 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -437,9 +437,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)
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm64: Fix incorrect per-cpu usage for boot CPU
  2016-07-21 10:12 [PATCH] arm64: Fix incorrect per-cpu usage for boot CPU Suzuki K Poulose
  2016-07-21 10:33 ` Mark Rutland
@ 2016-07-21 15:02 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2016-07-21 15:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 21, 2016 at 11:12:55AM +0100, Suzuki K. Poulose wrote:
> 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: commit 4b998ff1885eec ("arm64: Delay cpuinfo_store_boot_cpu")
> Cc: <stable@vger.kernel.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Applied. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-21 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 10:12 [PATCH] arm64: Fix incorrect per-cpu usage for boot CPU Suzuki K Poulose
2016-07-21 10:33 ` Mark Rutland
2016-07-21 15:02 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).