2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

x86/alternatives: Simplify smp_text_poke_single() by using tp_vec and existing APIs

Instead of constructing a vector on-stack, just use the already
available batch-patching vector - which should always be empty
at this point.

This will allow subsequent simplifications.

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-25-mingo@kernel.org
This commit is contained in:
Ingo Molnar 2025-04-11 07:40:36 +02:00
parent eaa24c9177
commit c8976ade0c

View File

@ -2904,8 +2904,13 @@ void __ref smp_text_poke_batch_add(void *addr, const void *opcode, size_t len, c
*/ */
void __ref smp_text_poke_single(void *addr, const void *opcode, size_t len, const void *emulate) void __ref smp_text_poke_single(void *addr, const void *opcode, size_t len, const void *emulate)
{ {
struct smp_text_poke_loc tp; struct smp_text_poke_loc *tp;
text_poke_int3_loc_init(&tp, addr, opcode, len, emulate); /* Batch-patching should not be mixed with single-patching: */
smp_text_poke_batch_process(&tp, 1); WARN_ON_ONCE(tp_vec_nr != 0);
tp = &tp_vec[tp_vec_nr++];
text_poke_int3_loc_init(tp, addr, opcode, len, emulate);
smp_text_poke_batch_finish();
} }