public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/alternative: Replace DPRINTK with pr_debug
@ 2026-02-01 18:58 hugopoggetti
  2026-02-01 19:05 ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: hugopoggetti @ 2026-02-01 18:58 UTC (permalink / raw)
  To: tglx; +Cc: mingo, bp, dave.hansen, x86, linux-kernel, hugo.poggetti

Replace the custom DPRINTK macro with the standard pr_debug()
to use the kernel's standard debugging infrastructure.

Signed-off-by: hugopoggetti <hugo.poggetti@epitech.eu>
---
 arch/x86/kernel/alternative.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 28518371d8bf..f462d47e3344 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "SMP alternatives: " fmt
 
+#include <linux/kernel.h>
 #include <linux/mmu_context.h>
 #include <linux/perf_event.h>
 #include <linux/vmalloc.h>
@@ -50,12 +51,6 @@ static int __init setup_noreplace_smp(char *str)
 }
 __setup("noreplace-smp", setup_noreplace_smp);
 
-#define DPRINTK(type, fmt, args...)					\
-do {									\
-	if (debug_alternative & DA_##type)				\
-		printk(KERN_DEBUG pr_fmt(fmt) "\n", ##args);		\
-} while (0)
-
 #define DUMP_BYTES(type, buf, len, fmt, args...)			\
 do {									\
 	if (unlikely(debug_alternative & DA_##type)) {			\
@@ -603,7 +598,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
 	u8 *instr, *replacement;
 	struct alt_instr *a, *b;
 
-	DPRINTK(ALT, "alt table %px, -> %px", start, end);
+	pr_debug("alt table %px, -> %px", start, end);
 
 	/*
 	 * KASAN_SHADOW_START is defined using
@@ -656,7 +651,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
 			continue;
 		}
 
-		DPRINTK(ALT, "feat: %d*32+%d, old: (%pS (%px) len: %d), repl: (%px, len: %d) flags: 0x%x",
+		pr_debug("feat: %d*32+%d, old: (%pS (%px) len: %d), repl: (%px, len: %d) flags: 0x%x",
 			a->cpuid >> 5,
 			a->cpuid & 0x1f,
 			instr, instr, a->instrlen,
@@ -974,7 +969,7 @@ void __init_or_module noinline apply_retpolines(s32 *start, s32 *end)
 			continue;
 		}
 
-		DPRINTK(RETPOLINE, "retpoline at: %pS (%px) len: %d to: %pS",
+		pr_debug("retpoline at: %pS (%px) len: %d to: %pS",
 			addr, addr, insn.length,
 			addr + insn.length + insn.immediate.value);
 
@@ -1062,7 +1057,7 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
 			      addr, dest, 5, addr))
 			continue;
 
-		DPRINTK(RET, "return thunk at: %pS (%px) len: %d to: %pS",
+		pr_debug("return thunk at: %pS (%px) len: %d to: %pS",
 			addr, addr, insn.length,
 			addr + insn.length + insn.immediate.value);
 
@@ -1122,7 +1117,7 @@ static void __init_or_module poison_endbr(void *addr)
 	if (WARN_ON_ONCE(!is_endbr(addr)))
 		return;
 
-	DPRINTK(ENDBR, "ENDBR at: %pS (%px)", addr, addr);
+	pr_debug("ENDBR at: %pS (%px)", addr, addr);
 
 	/*
 	 * When we have IBT, the lack of ENDBR will trigger #CP
@@ -2136,7 +2131,7 @@ void __init_or_module alternatives_smp_module_add(struct module *mod,
 	smp->locks_end	= locks_end;
 	smp->text	= text;
 	smp->text_end	= text_end;
-	DPRINTK(SMP, "locks %p -> %p, text %p -> %p, name %s\n",
+	pr_debug("locks %p -> %p, text %p -> %p, name %s\n",
 		smp->locks, smp->locks_end,
 		smp->text, smp->text_end, smp->name);
 
-- 
2.52.0


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

* Re: [PATCH] x86/alternative: Replace DPRINTK with pr_debug
  2026-02-01 18:58 [PATCH] x86/alternative: Replace DPRINTK with pr_debug hugopoggetti
@ 2026-02-01 19:05 ` Borislav Petkov
  2026-02-02 10:04   ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2026-02-01 19:05 UTC (permalink / raw)
  To: hugopoggetti; +Cc: tglx, mingo, dave.hansen, x86, linux-kernel, hugo.poggetti

On Sun, Feb 01, 2026 at 07:58:28PM +0100, hugopoggetti wrote:
> Replace the custom DPRINTK macro with the standard pr_debug()
> to use the kernel's standard debugging infrastructure.

No thanks. pr_debug() depends on a bunch of config options and we want
alternatives debugging to JustWork(tm), without a bunch of fuss.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] x86/alternative: Replace DPRINTK with pr_debug
  2026-02-01 19:05 ` Borislav Petkov
@ 2026-02-02 10:04   ` Peter Zijlstra
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2026-02-02 10:04 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: hugopoggetti, tglx, mingo, dave.hansen, x86, linux-kernel,
	hugo.poggetti

On Sun, Feb 01, 2026 at 08:05:27PM +0100, Borislav Petkov wrote:
> On Sun, Feb 01, 2026 at 07:58:28PM +0100, hugopoggetti wrote:
> > Replace the custom DPRINTK macro with the standard pr_debug()
> > to use the kernel's standard debugging infrastructure.
> 
> No thanks. pr_debug() depends on a bunch of config options and we want
> alternatives debugging to JustWork(tm), without a bunch of fuss.

Also, he completely broke 'debug_alternative' for bonus points..

So yeah, no touching unless you've actually went through the pain of
debugging the alternative code :-)

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

end of thread, other threads:[~2026-02-02 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-01 18:58 [PATCH] x86/alternative: Replace DPRINTK with pr_debug hugopoggetti
2026-02-01 19:05 ` Borislav Petkov
2026-02-02 10:04   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox