From: Petr Mladek <pmladek@suse.com>
To: Avi Weiss <thnkslprpt@gmail.com>
Cc: Chris Down <chris@chrisdown.name>,
John Ogness <john.ogness@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
printk@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: Fix skipped entries after index iterator restart
Date: Tue, 24 Nov 2026 11:19:36 +0100 [thread overview]
Message-ID: <awVkuPWD6DHnuV98@pathway.suse.cz> (raw)
In-Reply-To: <20261116085609.476250-2-thnkslprpt@gmail.com>
On Mon 2026-11-16 10:56:10, Avi Weiss wrote:
> seq_read_iter() can advance the iterator before the next record
> fits in the read buffer. When iteration resumes, pi_start() calls
> pi_next() at the saved position and advances past the pending printk
> index entry. As a result, index reads can silently omit formats.
>
> Return the entry corresponding to the saved position without
> advancing the iterator.
Great catch!
But honestly, I was a bit confused by the description. I think that
it is not easy to describe it a reasonable way. Well, I wonder
if the following is more clear:
<proposal>
seq_read_iter() calls pi_next() until it reads the last entry or until
the given read buffer gets full. The it calls pi_stop() in both
situations.
The next seq_read_iter() calls pi_start() to (re)start the session.
pi_start() is supposed to either start from the the beginning or
return the last entry which did not fit into the read buffer.
By other words, pi_start() should not call pi_next() which would return
the next entry. Instead it should return the entry which did not fit
into the buffer last time. Otherwise, the entry would get skipped.
Note that *pos is off-by-one because "0" position is used for the
title string (struct seq_operations). So that pr_start() should
return the *pos - 1 entry.
</proposal>
> Fixes: 337015573718 ("printk: Userspace format indexing support")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Otherwise the patch looks good to me. With the updated commit
message:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
PS: I am going to wait few days for potential feedback. Then I will
commit the patch with the updated commit messages unless anyone
complains in the meantime.
prev parent reply other threads:[~2026-11-24 10:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 8:56 Avi Weiss
2026-11-16 9:15 ` Andy Shevchenko
2026-11-24 10:28 ` Petr Mladek
2026-11-24 10:41 ` Andy Shevchenko
2026-11-24 10:19 ` Petr Mladek [this message]
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=awVkuPWD6DHnuV98@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=chris@chrisdown.name \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=printk@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=thnkslprpt@gmail.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
all inboxes | Powered by JetHome®