diff mbox series

[SRU,Bionic] UBUNTU: SAUCE: arm64: capabilities: Move setup_boot_cpu_capabilities() call to correct place

Message ID 20191126003039.823882-1-dann.frazier@canonical.com
State New
Headers show
Series [SRU,Bionic] UBUNTU: SAUCE: arm64: capabilities: Move setup_boot_cpu_capabilities() call to correct place | expand

Commit Message

dann frazier Nov. 26, 2019, 12:30 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1852723

In order to diagnose this issue, I prepared my own "clean-room" backport
of the encompassing patch series. My backport didn't have this bug, and
a git diff between mine and Ubuntu's showed one obvious difference:
in my working backport, the call to setup_boot_cpu_capabilities() was in
init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
through the history, it appears that the introduction of this issue went
back to an earlier patch that had added a call to
update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
init_cpu_features(). The code at this site continued to evolve, eventually
replacing the update_cpu_errata_workarounds() with the one to
setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
that moving this call matches both mainline and stable 4.14.y.

Verified to fix booting on ThunderX2 and Kunpeng920 systems.

Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
Signed-off-by: dann frazier <dann.frazier@canonical.com>
---
 arch/arm64/kernel/cpufeature.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Stefan Bader Nov. 26, 2019, 9:09 a.m. UTC | #1
On 26.11.19 01:30, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1852723
> 
> In order to diagnose this issue, I prepared my own "clean-room" backport
> of the encompassing patch series. My backport didn't have this bug, and
> a git diff between mine and Ubuntu's showed one obvious difference:
> in my working backport, the call to setup_boot_cpu_capabilities() was in
> init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
> through the history, it appears that the introduction of this issue went
> back to an earlier patch that had added a call to
> update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
> init_cpu_features(). The code at this site continued to evolve, eventually
> replacing the update_cpu_errata_workarounds() with the one to
> setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
> that moving this call matches both mainline and stable 4.14.y.
> 
> Verified to fix booting on ThunderX2 and Kunpeng920 systems.
> 
> Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  arch/arm64/kernel/cpufeature.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index d19a7b8bb6fb0..b96d1a635a16a 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -572,6 +572,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
>  		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
>  		sve_init_vq_map();
>  	}
> +
> +	/*
> +	 * Detect and enable early CPU capabilities based on the boot CPU,
> +	 * after we have initialised the CPU feature infrastructure.
> +	 */
> +	setup_boot_cpu_capabilities();
>  }
>  
>  static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
> @@ -588,12 +594,6 @@ static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
>  		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
>  		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
>  	}
> -
> -	/*
> -	 * Detect and enable early CPU capabilities based on the boot CPU,
> -	 * after we have initialised the CPU feature infrastructure.
> -	 */
> -	setup_boot_cpu_capabilities();
>  }
>  
>  static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)
>
Kleber Sacilotto de Souza Nov. 26, 2019, 9:41 a.m. UTC | #2
On 26.11.19 01:30, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1852723
> 
> In order to diagnose this issue, I prepared my own "clean-room" backport
> of the encompassing patch series. My backport didn't have this bug, and
> a git diff between mine and Ubuntu's showed one obvious difference:
> in my working backport, the call to setup_boot_cpu_capabilities() was in
> init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
> through the history, it appears that the introduction of this issue went
> back to an earlier patch that had added a call to
> update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
> init_cpu_features(). The code at this site continued to evolve, eventually
> replacing the update_cpu_errata_workarounds() with the one to
> setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
> that moving this call matches both mainline and stable 4.14.y.
> 
> Verified to fix booting on ThunderX2 and Kunpeng920 systems.
> 
> Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
> Signed-off-by: dann frazier <dann.frazier@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  arch/arm64/kernel/cpufeature.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index d19a7b8bb6fb0..b96d1a635a16a 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -572,6 +572,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
>  		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
>  		sve_init_vq_map();
>  	}
> +
> +	/*
> +	 * Detect and enable early CPU capabilities based on the boot CPU,
> +	 * after we have initialised the CPU feature infrastructure.
> +	 */
> +	setup_boot_cpu_capabilities();
>  }
>  
>  static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
> @@ -588,12 +594,6 @@ static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
>  		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
>  		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
>  	}
> -
> -	/*
> -	 * Detect and enable early CPU capabilities based on the boot CPU,
> -	 * after we have initialised the CPU feature infrastructure.
> -	 */
> -	setup_boot_cpu_capabilities();
>  }
>  
>  static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)
>
Andrea Righi Nov. 26, 2019, 9:42 a.m. UTC | #3
On Mon, Nov 25, 2019 at 05:30:39PM -0700, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1852723
> 
> In order to diagnose this issue, I prepared my own "clean-room" backport
> of the encompassing patch series. My backport didn't have this bug, and
> a git diff between mine and Ubuntu's showed one obvious difference:
> in my working backport, the call to setup_boot_cpu_capabilities() was in
> init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
> through the history, it appears that the introduction of this issue went
> back to an earlier patch that had added a call to
> update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
> init_cpu_features(). The code at this site continued to evolve, eventually
> replacing the update_cpu_errata_workarounds() with the one to
> setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
> that moving this call matches both mainline and stable 4.14.y.
> 
> Verified to fix booting on ThunderX2 and Kunpeng920 systems.
> 
> Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
> Signed-off-by: dann frazier <dann.frazier@canonical.com>

Acked-by: Andrea Righi <andrea.righi@canonical.com>

> ---
>  arch/arm64/kernel/cpufeature.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index d19a7b8bb6fb0..b96d1a635a16a 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -572,6 +572,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
>  		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
>  		sve_init_vq_map();
>  	}
> +
> +	/*
> +	 * Detect and enable early CPU capabilities based on the boot CPU,
> +	 * after we have initialised the CPU feature infrastructure.
> +	 */
> +	setup_boot_cpu_capabilities();
>  }
>  
>  static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
> @@ -588,12 +594,6 @@ static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
>  		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
>  		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
>  	}
> -
> -	/*
> -	 * Detect and enable early CPU capabilities based on the boot CPU,
> -	 * after we have initialised the CPU feature infrastructure.
> -	 */
> -	setup_boot_cpu_capabilities();
>  }
>  
>  static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)
> -- 
> 2.24.0
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Kamal Mostafa Nov. 26, 2019, 3:56 p.m. UTC | #4
Excellent work Dann -- thanks for fixing my damage!

Acked-by: Kamal Mostafa <kamal@canonical.com>

 -Kamal

On Mon, Nov 25, 2019 at 05:30:39PM -0700, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1852723
> 
> In order to diagnose this issue, I prepared my own "clean-room" backport
> of the encompassing patch series. My backport didn't have this bug, and
> a git diff between mine and Ubuntu's showed one obvious difference:
> in my working backport, the call to setup_boot_cpu_capabilities() was in
> init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
> through the history, it appears that the introduction of this issue went
> back to an earlier patch that had added a call to
> update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
> init_cpu_features(). The code at this site continued to evolve, eventually
> replacing the update_cpu_errata_workarounds() with the one to
> setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
> that moving this call matches both mainline and stable 4.14.y.
> 
> Verified to fix booting on ThunderX2 and Kunpeng920 systems.
> 
> Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> ---
>  arch/arm64/kernel/cpufeature.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index d19a7b8bb6fb0..b96d1a635a16a 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -572,6 +572,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
>  		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
>  		sve_init_vq_map();
>  	}
> +
> +	/*
> +	 * Detect and enable early CPU capabilities based on the boot CPU,
> +	 * after we have initialised the CPU feature infrastructure.
> +	 */
> +	setup_boot_cpu_capabilities();
>  }
>  
>  static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
> @@ -588,12 +594,6 @@ static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
>  		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
>  		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
>  	}
> -
> -	/*
> -	 * Detect and enable early CPU capabilities based on the boot CPU,
> -	 * after we have initialised the CPU feature infrastructure.
> -	 */
> -	setup_boot_cpu_capabilities();
>  }
>  
>  static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)
> -- 
> 2.24.0
>
Stefan Bader Nov. 26, 2019, 3:58 p.m. UTC | #5
On 26.11.19 01:30, dann frazier wrote:
> BugLink: https://bugs.launchpad.net/bugs/1852723
> 
> In order to diagnose this issue, I prepared my own "clean-room" backport
> of the encompassing patch series. My backport didn't have this bug, and
> a git diff between mine and Ubuntu's showed one obvious difference:
> in my working backport, the call to setup_boot_cpu_capabilities() was in
> init_cpu_features(), while Ubuntu had it in update_cpu_ftr_reg(). Looking
> through the history, it appears that the introduction of this issue went
> back to an earlier patch that had added a call to
> update_cpu_errata_workarounds() in update_cpu_ftr_reg() instead of
> init_cpu_features(). The code at this site continued to evolve, eventually
> replacing the update_cpu_errata_workarounds() with the one to
> setup_boot_cpu_capabilities(), but did so in the wrong function. I verified
> that moving this call matches both mainline and stable 4.14.y.
> 
> Verified to fix booting on ThunderX2 and Kunpeng920 systems.
> 
> Fixes: 2cd18ebbeda69 ("arm64: capabilities: Move errata work around check on boot CPU")
> Signed-off-by: dann frazier <dann.frazier@canonical.com>
> ---

Applied to bionic/master-next. And included in respin #6. Thanks.

-Stefan

>  arch/arm64/kernel/cpufeature.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index d19a7b8bb6fb0..b96d1a635a16a 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -572,6 +572,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
>  		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
>  		sve_init_vq_map();
>  	}
> +
> +	/*
> +	 * Detect and enable early CPU capabilities based on the boot CPU,
> +	 * after we have initialised the CPU feature infrastructure.
> +	 */
> +	setup_boot_cpu_capabilities();
>  }
>  
>  static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
> @@ -588,12 +594,6 @@ static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
>  		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
>  		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
>  	}
> -
> -	/*
> -	 * Detect and enable early CPU capabilities based on the boot CPU,
> -	 * after we have initialised the CPU feature infrastructure.
> -	 */
> -	setup_boot_cpu_capabilities();
>  }
>  
>  static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)
>
diff mbox series

Patch

diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index d19a7b8bb6fb0..b96d1a635a16a 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -572,6 +572,12 @@  void __init init_cpu_features(struct cpuinfo_arm64 *info)
 		init_cpu_ftr_reg(SYS_ZCR_EL1, info->reg_zcr);
 		sve_init_vq_map();
 	}
+
+	/*
+	 * Detect and enable early CPU capabilities based on the boot CPU,
+	 * after we have initialised the CPU feature infrastructure.
+	 */
+	setup_boot_cpu_capabilities();
 }
 
 static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
@@ -588,12 +594,6 @@  static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
 		ftr_new = arm64_ftr_safe_value(ftrp, ftr_new, ftr_cur);
 		reg->sys_val = arm64_ftr_set_value(ftrp, reg->sys_val, ftr_new);
 	}
-
-	/*
-	 * Detect and enable early CPU capabilities based on the boot CPU,
-	 * after we have initialised the CPU feature infrastructure.
-	 */
-	setup_boot_cpu_capabilities();
 }
 
 static int check_update_ftr_reg(u32 sys_id, int cpu, u64 val, u64 boot)