Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/alternatives: Update the comments in smp_text_poke_batch_process()

- Capitalize 'INT3' consistently,

- make it clear that 'sync cores' means an SMP sync to all CPUs,

- fix typos and spelling.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250411054105.2341982-51-mingo@kernel.org

Ingo Molnar dac0d754 2c373ca0

+15 -13
+15 -13
arch/x86/kernel/alternative.c
··· 2561 2561 2562 2562 /** 2563 2563 * smp_text_poke_batch_process() -- update instructions on live kernel on SMP 2564 - * @text_poke_array.vec: vector of instructions to patch 2565 - * @text_poke_array.nr_entries: number of entries in the vector 2566 2564 * 2567 - * Modify multi-byte instruction by using int3 breakpoint on SMP. 2568 - * We completely avoid stop_machine() here, and achieve the 2569 - * synchronization using int3 breakpoint. 2565 + * Input state: 2566 + * text_poke_array.vec: vector of instructions to patch 2567 + * text_poke_array.nr_entries: number of entries in the vector 2568 + * 2569 + * Modify multi-byte instructions by using INT3 breakpoints on SMP. 2570 + * We completely avoid using stop_machine() here, and achieve the 2571 + * synchronization using INT3 breakpoints and SMP cross-calls. 2570 2572 * 2571 2573 * The way it is done: 2572 2574 * - For each entry in the vector: 2573 - * - add a int3 trap to the address that will be patched 2574 - * - sync cores 2575 + * - add an INT3 trap to the address that will be patched 2576 + * - SMP sync all CPUs 2575 2577 * - For each entry in the vector: 2576 2578 * - update all but the first byte of the patched range 2577 - * - sync cores 2579 + * - SMP sync all CPUs 2578 2580 * - For each entry in the vector: 2579 - * - replace the first byte (int3) by the first byte of 2581 + * - replace the first byte (INT3) by the first byte of the 2580 2582 * replacing opcode 2581 - * - sync cores 2583 + * - SMP sync all CPUs 2582 2584 */ 2583 2585 static void smp_text_poke_batch_process(void) 2584 2586 { ··· 2608 2606 cond_resched(); 2609 2607 2610 2608 /* 2611 - * Corresponding read barrier in int3 notifier for making sure the 2609 + * Corresponding read barrier in INT3 notifier for making sure the 2612 2610 * text_poke_array.nr_entries and handler are correctly ordered wrt. patching. 2613 2611 */ 2614 2612 smp_wmb(); 2615 2613 2616 2614 /* 2617 - * First step: add a int3 trap to the address that will be patched. 2615 + * First step: add a INT3 trap to the address that will be patched. 2618 2616 */ 2619 2617 for (i = 0; i < text_poke_array.nr_entries; i++) { 2620 2618 text_poke_array.vec[i].old = *(u8 *)text_poke_addr(&text_poke_array.vec[i]); ··· 2687 2685 } 2688 2686 2689 2687 /* 2690 - * Third step: replace the first byte (int3) by the first byte of 2688 + * Third step: replace the first byte (INT3) by the first byte of the 2691 2689 * replacing opcode. 2692 2690 */ 2693 2691 for (do_sync = 0, i = 0; i < text_poke_array.nr_entries; i++) {