[PATCH v3 0/2] arm64: spectre: Fix hard lockup and cleanup mitigation messages

shechenglong shechenglong at xfusion.com
Fri Oct 31 02:15:04 PDT 2025


On Wed, Oct 29, 2025 at 11:45:54AM +0800, Will Deacon wrote:
> Is the compiler smart enough to store a single string for the
> "mitigation disabled by command-line option\n" part? If not,
> you might want to use %s to avoid wasting memory. (I was going to
> check with llvm but I'm unable to apply your changes due to whitespace
> corruption).

Thanks, Will, for the helpful review. v3 incorporates your suggestion by
factoring the common suffix into a single const string and switching the
pr_info() calls to use "%s". The whitespace corruption has also been fixed
(restore tabs, no line-wrapped literals), so this version should apply
cleanly.


This series addresses one main issues around Spectre mitigation messages:

  1) Avoid multiple copies of the common suffix
     "mitigation disabled by command-line option\n" by using a single
     constant string and "%s" in pr_info().

v3 changes:
  - Fix whitespace corruption (tabs vs spaces).
  - Factor out the common suffix into a single static const and
    use "%s" as suggested.

shechenglong (2):
  cpu:Remove the print when the CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY
    Kconfig option is disabled.
  cpu: fix hard lockup triggered by printk calls within scheduling
    context

 arch/arm64/include/asm/spectre.h |  1 +
 arch/arm64/kernel/cpufeature.c   |  6 ++++++
 arch/arm64/kernel/proton-pack.c  | 37 +++++++++++++++++---------------
 3 files changed, 27 insertions(+), 17 deletions(-)

-- 
2.33.0




More information about the linux-arm-kernel mailing list