From: Peter Zijlstra Date: Fri, 11 Apr 2025 05:40:14 +0000 (+0200) Subject: x86/alternatives: Document the text_poke_bp_batch() synchronization rules a bit more X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d60e4b2410e1b9f7c5ca347c78c6b07175c2e873;p=users%2Fdwmw2%2Flinux.git x86/alternatives: Document the text_poke_bp_batch() synchronization rules a bit more Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Cc: Juergen Gross Cc: "H . Peter Anvin" Cc: Linus Torvalds Cc: Eric Dumazet Cc: Brian Gerst Cc: Josh Poimboeuf Link: https://lore.kernel.org/r/20250411054105.2341982-3-mingo@kernel.org --- diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 85089c79a828e..5f448142aa993 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -2751,6 +2751,13 @@ static void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries /* * Remove and wait for refs to be zero. + * + * Notably, if after step-3 above the INT3 got removed, then the + * text_poke_sync() will have serialized against any running INT3 + * handlers and the below spin-wait will not happen. + * + * IOW. unless the replacement instruction is INT3, this case goes + * unused. */ for_each_possible_cpu(i) { atomic_t *refs = per_cpu_ptr(&bp_refs, i);