[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2eaeaa69-b2cf-3a3a-0239-2aefcaa836aa@kernel.org>
Date: Sat, 18 Oct 2025 18:21:52 -0600 (MDT)
From: Paul Walmsley <pjw@...nel.org>
To: Josephine Pfeiffer <hi@...ie.lol>
cc: paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
alex@...ti.fr, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] riscv: ptdump: use seq_puts() in pt_dump_seq_puts()
macro
On Sat, 18 Oct 2025, 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 ptdump.c:301 to output a newline character. Using
> seq_printf() adds unnecessary overhead for format string parsing when
> outputting this constant string.
Hard to accept that it's a performance issue. But I think you're right
that generating a newline should be done with seq_puts().
> This bug was introduced in commit 59c4da8640cc ("riscv: Add support to
> dump the kernel page tables") in 2020, which copied the implementation
> pattern from other architectures that had the same bug.
>
> Fixes: 59c4da8640cc ("riscv: Add support to dump the kernel page tables")
> Signed-off-by: Josephine Pfeiffer <hi@...ie.lol>
A better fix would seem to be to just get rid of pt_dump_seq_puts(). It's
only used once in arch/riscv.
Taking a broader view, both pt_dump_seq_puts() and pt_dump_seq_printf()
look completely pointless. Is there any argument for keeping them?
- Paul
Powered by blists - more mailing lists