[printk] 18a2dc6982: ltp.kmsg01.fail

Petr Mladek pmladek at suse.com
Thu Jul 9 06:59:06 EDT 2020


On Thu 2020-07-09 12:20:35, John Ogness wrote:
> On 2020-07-09, Sergey Senozhatsky <sergey.senozhatsky at 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;


Best Regards,
Petr



More information about the kexec mailing list