[RESEND v2 0/2] arm64: spectre: Fix hard lockup and cleanup mitigation messages

From: shechenglong

Date: Wed Oct 29 2025 - 00:03:31 EST


On Wed, Sep 24, 2025 at 08:32:47PM +0800, shechenglong wrote:
> relocate the printk() calls from spectre_v4_mitigations_off() and
> spectre_v2_mitigations_off() into setup_system_capabilities()
> function, preventing hard lockups that occur when printk() is invoked from scheduler context.
>
> Link:
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/2025091806
> 4907.1832-1-shechenglong@xxxxxxxxxxx/
> Suggested-by: Mark Rutland <mark.rutland@xxxxxxx>
> Suggested-by: Catalin Marinas <catalin.marinas@xxxxxxx>
> Signed-off-by: shechenglong <shechenglong@xxxxxxxxxxx>

Thanks for the review and suggestions, Will!

This v2 series addresses your comments:
- Fixed the message to use "command-line" consistently
- Created spectre_print_disabled_mitigations() function to handle all spectre mitigation messages
- Added a separate patch to remove the CONFIG_MITIGATE_SPECTRE_BHB option

The series includes two patches:

Patch 1: "fix hard lockup triggered by printk calls within scheduling context"
- Moves printk calls from scheduler context to setup_system_capabilities()
- Prevents hard lockups by avoiding printk in unsafe contexts
- Consolidates spectre mitigation status reporting

Patch 2: "Remove the print when the CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY Kconfig option is disabled"
- Removes the obsolete CONFIG_MITIGATE_SPECTRE_BHB Kconfig option
- Cleans up the spectre mitigation code as suggested

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

arch/arm64/include/asm/spectre.h | 2 ++
arch/arm64/kernel/cpufeature.c | 7 ++++++-
arch/arm64/kernel/proton-pack.c | 28 ++++++++++++++--------------
3 files changed, 22 insertions(+), 17 deletions(-)

--
2.25.1