summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/alternative.c
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2022-09-12 17:22:06 +0100
committerCatalin Marinas <catalin.marinas@arm.com>2022-09-16 17:15:03 +0100
commitc5ba03260c7afad6977654d6bc7fcabbcd35c379 (patch)
tree609aec69637cc46a28bea8f43c168984481f8973 /arch/arm64/kernel/alternative.c
parent747ad8d557645b8c9adb83334a620426e4c9d60f (diff)
downloadlinux-c5ba03260c7afad6977654d6bc7fcabbcd35c379.tar.bz2
arm64: alternatives: hoist print out of __apply_alternatives()
Printing in the middle of __apply_alternatives() is potentially unsafe and not all that helpful given these days we practically always patch *something*. Hoist the print out of __apply_alternatives(), and add separate prints to __apply_alternatives() and apply_alternatives_all(), which will make it easier to spot if either patching call goes wrong. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: James Morse <james.morse@arm.com> Cc: Joey Gouly <joey.gouly@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Will Deacon <will@kernel.org> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20220912162210.3626215-5-mark.rutland@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/alternative.c')
-rw-r--r--arch/arm64/kernel/alternative.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c
index 9bcaa5eacf16..d94d97cb4a0b 100644
--- a/arch/arm64/kernel/alternative.c
+++ b/arch/arm64/kernel/alternative.c
@@ -156,8 +156,6 @@ static void __nocfi __apply_alternatives(struct alt_region *region, bool is_modu
else
BUG_ON(alt->alt_len != alt->orig_len);
- pr_info_once("patching kernel code\n");
-
origptr = ALT_ORIG_PTR(alt);
updptr = is_module ? origptr : lm_alias(origptr);
nr_inst = alt->orig_len / AARCH64_INSN_SIZE;
@@ -225,6 +223,8 @@ static int __apply_alternatives_multi_stop(void *unused)
void __init apply_alternatives_all(void)
{
+ pr_info("applying system-wide alternatives\n");
+
/* better not try code patching on a live SMP system */
stop_machine(__apply_alternatives_multi_stop, NULL, cpu_online_mask);
}
@@ -244,6 +244,8 @@ void __init apply_boot_alternatives(void)
/* If called on non-boot cpu things could go wrong */
WARN_ON(smp_processor_id() != 0);
+ pr_info("applying boot alternatives\n");
+
__apply_alternatives(&region, false, &boot_capabilities[0]);
}