From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
kernel test robot <rong.a.chen@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrea Parri <parri.andrea@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Paul McKenney <paulmck@kernel.org>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
lkp@lists.01.org
Subject: Re: [printk] 18a2dc6982: ltp.kmsg01.fail
Date: Thu, 9 Jul 2020 13:13:11 +0200 [thread overview]
Message-ID: <20200709111310.GD11164@alley> (raw)
In-Reply-To: <20200709105906.GC11164@alley>
On Thu 2020-07-09 12:59:06, Petr Mladek wrote:
> On Thu 2020-07-09 12:20:35, John Ogness wrote:
> > On 2020-07-09, Sergey Senozhatsky <sergey.senozhatsky@gmail.com> wrote:
> > > On (20/07/09 15:14), kernel test robot wrote:
> > > [..]
> > >
> > > Took me a while to find the FAIL-ed test:
> > >
> > >> kmsg01.c:393: INFO: TEST: read returns EPIPE when messages get overwritten
> > >> kmsg01.c:398: INFO: first seqno: 0
> > >> kmsg01.c:411: INFO: first seqno now: 881
> > >> kmsg01.c:425: FAIL: read returned: 77: SUCCESS (0)
> > >
> > > So this is seq number related
> > > https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/logging/kmsg/kmsg01.c#L383
> >
> > Excellent test.
> >
> > Since the messages are above the expected average size, the dataring is
> > wrapping before the descriptor ring. This means that the initial
> > descriptors are still there, but their data is gone. Initially I would
> > generate an EPIPE for this, but it was changed. Here is the thread [0]
> > we had about this.
>
> I see. IMHO, the following should do the job. The check is done only
> when the above prb_read_valid() succeeded. Therefore the printk_record
> has to include a valid value. And it must be the first valid record
> when some messages were lost.
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 62fc1abd9c4d..5d4760b5c671 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -775,9 +775,9 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
> logbuf_lock_irq();
> }
>
> - if (user->seq < prb_first_seq(prb)) {
> + if (user->seq < r->info->seq) {
> /* our last seen message is gone, return error and reset */
> - user->seq = prb_first_seq(prb);
> + user->seq = r->info->seq;
> ret = -EPIPE;
> logbuf_unlock_irq();
> goto out;
I though more about it. IMHO, it will be better to modify
prb_first_seq() to do the same cycle as prb_next_seq()
and return seq number of the first valid entry.
IMHO, basically any caller in printk.c expects this behavior.
For example, devkmsg user would expect reading valid entry after doing
SEEK_SET. I would also expect to get valid record right after opening
devkmsg, etc.
The current prb_first_seq() is needed only _prb_read_valid(). For,
this I would rename the original function to prb_tail_seq().
Best Regards,
Petr
next prev parent reply other threads:[~2020-07-09 11:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 14:59 [PATCH v4 0/4] printk: replace ringbuffer John Ogness
2020-07-07 14:59 ` [PATCH v4 1/4] crash: add VMCOREINFO macro to define offset in a struct declared by typedef John Ogness
2020-07-07 14:59 ` [PATCH v4 2/4] printk: add lockless ringbuffer John Ogness
2020-07-07 14:59 ` [PATCH v4 3/4] Revert "printk: lock/unlock console only for new logbuf entries" John Ogness
2020-07-08 14:34 ` Petr Mladek
2020-07-09 1:20 ` Sergey Senozhatsky
2020-07-07 14:59 ` [PATCH v4 4/4] printk: use the lockless ringbuffer John Ogness
2020-07-07 19:25 ` kernel test robot
2020-07-08 13:18 ` John Ogness
2020-07-08 14:35 ` Petr Mladek
2020-07-08 19:24 ` kernel test robot
2020-07-09 7:14 ` [printk] 18a2dc6982: ltp.kmsg01.fail kernel test robot
2020-07-09 8:33 ` Sergey Senozhatsky
2020-07-09 10:14 ` John Ogness
2020-07-09 10:59 ` Petr Mladek
2020-07-09 11:13 ` Petr Mladek [this message]
2020-07-09 11:17 ` John Ogness
2020-07-09 12:25 ` Petr Mladek
2020-07-09 13:07 ` Sergey Senozhatsky
2020-07-09 14:41 ` Petr Mladek
2020-07-08 15:20 ` [PATCH v4 0/4] printk: replace ringbuffer Petr Mladek
2020-07-09 7:03 ` John Ogness
2020-07-10 9:11 ` Petr Mladek
2020-07-10 9:52 ` John Ogness
2020-07-10 14:15 ` Petr Mladek
2020-07-14 2:56 ` Sergey Senozhatsky
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=20200709111310.GD11164@alley \
--to=pmladek@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@lists.01.org \
--cc=parri.andrea@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rong.a.chen@intel.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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