* [PATCH 4/4] s390: ptdump: use seq_puts() in pt_dump_seq_puts() macro
@ 2025-10-18 17:05 Josephine Pfeiffer
2025-10-20 9:17 ` Heiko Carstens
0 siblings, 1 reply; 2+ messages in thread
From: Josephine Pfeiffer @ 2025-10-18 17:05 UTC (permalink / raw)
To: agordeev, gerald.schaefer; +Cc: hca, gor, linux-s390, linux-kernel
The pt_dump_seq_puts() macro incorrectly uses seq_printf() instead of
seq_puts(). This is both a performance issue and conceptually wrong,
as the macro name suggests plain string output (puts) but the
implementation uses formatted output (printf).
The macro is used in dump_pagetables.c:67-68 and 131 to output
constant strings. Using seq_printf() adds unnecessary overhead for
format string parsing.
This bug was introduced in commit 6bf9a639e76e1 ("s390/mm,ptdump: make
page table dumping seq_file optional") in 2020, which explicitly stated
it was the "s390 version of commit ae5d1cf358a5 ("arm64: dump: Make the
page table dumping seq_file optional")", copying the buggy arm64
implementation.
Fixes: 6bf9a639e76e1 ("s390/mm,ptdump: make page table dumping seq_file optional")
Signed-off-by: Josephine Pfeiffer <hi@josie.lol>
---
arch/s390/mm/dump_pagetables.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c
index 9af2aae0a515..3692f9d20f0d 100644
--- a/arch/s390/mm/dump_pagetables.c
+++ b/arch/s390/mm/dump_pagetables.c
@@ -51,7 +51,7 @@ struct pg_state {
struct seq_file *__m = (m); \
\
if (__m) \
- seq_printf(__m, fmt); \
+ seq_puts(__m, fmt); \
})
static void print_prot(struct seq_file *m, unsigned int pr, int level)
--
2.51.1.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4/4] s390: ptdump: use seq_puts() in pt_dump_seq_puts() macro
2025-10-18 17:05 [PATCH 4/4] s390: ptdump: use seq_puts() in pt_dump_seq_puts() macro Josephine Pfeiffer
@ 2025-10-20 9:17 ` Heiko Carstens
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2025-10-20 9:17 UTC (permalink / raw)
To: Josephine Pfeiffer
Cc: agordeev, gerald.schaefer, gor, linux-s390, linux-kernel
On Sat, Oct 18, 2025 at 07:05:21PM +0200, Josephine Pfeiffer wrote:
> The pt_dump_seq_puts() macro incorrectly uses seq_printf() instead of
> seq_puts(). This is both a performance issue and conceptually wrong,
> as the macro name suggests plain string output (puts) but the
> implementation uses formatted output (printf).
>
> The macro is used in dump_pagetables.c:67-68 and 131 to output
> constant strings. Using seq_printf() adds unnecessary overhead for
> format string parsing.
>
> This bug was introduced in commit 6bf9a639e76e1 ("s390/mm,ptdump: make
> page table dumping seq_file optional") in 2020, which explicitly stated
> it was the "s390 version of commit ae5d1cf358a5 ("arm64: dump: Make the
> page table dumping seq_file optional")", copying the buggy arm64
> implementation.
>
> Fixes: 6bf9a639e76e1 ("s390/mm,ptdump: make page table dumping seq_file optional")
> Signed-off-by: Josephine Pfeiffer <hi@josie.lol>
...
> - seq_printf(__m, fmt); \
> + seq_puts(__m, fmt); \
So yes, it should have been seq_puts() instead of seq_printf(), but
there really is no _bug_ here, except of wasted CPU cycles for a seq
file which isn't enabled in any production kernel.
I'll apply this and change the commit message accordingly.
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-20 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-18 17:05 [PATCH 4/4] s390: ptdump: use seq_puts() in pt_dump_seq_puts() macro Josephine Pfeiffer
2025-10-20 9:17 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox