linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/alternatives: Make smp_text_poke_batch_process subsume smp_text_poke_batch_finish
@ 2025-04-03 15:39 Nikolay Borisov
  2025-04-04  9:55 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Borisov @ 2025-04-03 15:39 UTC (permalink / raw)
  To: mingo; +Cc: x86, linux-kernel, Nikolay Borisov

Simplify the alternatives interface some more by moving the
poke_batch_finish check into poke_batch_process and renaming the latter.
The net effect is one less function name to consider when reading the
code.

Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
---
 arch/x86/kernel/alternative.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 5b1a6252a4b9..a5ecaebe1ea9 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2434,7 +2434,7 @@ struct smp_text_poke_loc {
 	u8 len;
 	u8 opcode;
 	const u8 text[TEXT_POKE_MAX_OPCODE_SIZE];
-	/* see smp_text_poke_batch_process() */
+	/* see smp_text_poke_batch_finish() */
 	u8 old;
 };
 
@@ -2507,7 +2507,7 @@ noinstr int smp_text_poke_int3_trap_handler(struct pt_regs *regs)
 		return 0;
 
 	/*
-	 * Discount the INT3. See smp_text_poke_batch_process().
+	 * Discount the INT3. See smp_text_poke_batch_finish().
 	 */
 	ip = (void *) regs->ip - INT3_INSN_SIZE;
 
@@ -2565,7 +2565,7 @@ noinstr int smp_text_poke_int3_trap_handler(struct pt_regs *regs)
 }
 
 /**
- * smp_text_poke_batch_process() -- update instructions on live kernel on SMP
+ * smp_text_poke_batch_finish() -- update instructions on live kernel on SMP
  *
  * Input state:
  *  text_poke_array.vec: vector of instructions to patch
@@ -2587,12 +2587,16 @@ noinstr int smp_text_poke_int3_trap_handler(struct pt_regs *regs)
  *		  replacing opcode
  *	- SMP sync all CPUs
  */
-static void smp_text_poke_batch_process(void)
+void smp_text_poke_batch_finish(void)
 {
 	unsigned char int3 = INT3_INSN_OPCODE;
 	unsigned int i;
 	int do_sync;
 
+
+	if (!text_poke_array.nr_entries)
+		return;
+
 	lockdep_assert_held(&text_mutex);
 
 	/*
@@ -2832,12 +2836,6 @@ static bool text_poke_addr_ordered(void *addr)
 	return true;
 }
 
-void smp_text_poke_batch_finish(void)
-{
-	if (text_poke_array.nr_entries)
-		smp_text_poke_batch_process();
-}
-
 /**
  * smp_text_poke_batch_add() -- update instruction on live kernel on SMP, batched
  * @addr:	address to patch
@@ -2854,7 +2852,7 @@ void smp_text_poke_batch_finish(void)
 void __ref smp_text_poke_batch_add(void *addr, const void *opcode, size_t len, const void *emulate)
 {
 	if (text_poke_array.nr_entries == TEXT_POKE_ARRAY_MAX || !text_poke_addr_ordered(addr))
-		smp_text_poke_batch_process();
+		smp_text_poke_batch_finish();
 	__smp_text_poke_batch_add(addr, opcode, len, emulate);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/alternatives: Make smp_text_poke_batch_process subsume smp_text_poke_batch_finish
  2025-04-03 15:39 [PATCH] x86/alternatives: Make smp_text_poke_batch_process subsume smp_text_poke_batch_finish Nikolay Borisov
@ 2025-04-04  9:55 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2025-04-04  9:55 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: x86, linux-kernel


* Nikolay Borisov <nik.borisov@suse.com> wrote:

> Simplify the alternatives interface some more by moving the
> poke_batch_finish check into poke_batch_process and renaming the latter.
> The net effect is one less function name to consider when reading the
> code.
> 
> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
> ---
>  arch/x86/kernel/alternative.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)

Applied, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-04  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 15:39 [PATCH] x86/alternatives: Make smp_text_poke_batch_process subsume smp_text_poke_batch_finish Nikolay Borisov
2025-04-04  9:55 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).