From: Paul Walmsley <pjw@kernel.org>
To: Josephine Pfeiffer <hi@josie.lol>
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, alex@ghiti.fr,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] riscv: ptdump: use seq_puts() in pt_dump_seq_puts() macro
Date: Sat, 18 Oct 2025 18:21:52 -0600 (MDT) [thread overview]
Message-ID: <2eaeaa69-b2cf-3a3a-0239-2aefcaa836aa@kernel.org> (raw)
In-Reply-To: <20251018170451.3355496-1-hi@josie.lol>
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@josie.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
next prev parent reply other threads:[~2025-10-19 0:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 17:04 [PATCH 3/4] riscv: ptdump: use seq_puts() in pt_dump_seq_puts() macro Josephine Pfeiffer
2025-10-19 0:21 ` Paul Walmsley [this message]
2025-10-19 14:07 ` Josephine Pfeiffer
2025-10-25 7:15 ` Paul Walmsley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2eaeaa69-b2cf-3a3a-0239-2aefcaa836aa@kernel.org \
--to=pjw@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=hi@josie.lol \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox