[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r1qszhjs.fsf@jogness.linutronix.de>
Date: Wed, 23 Sep 2020 16:42:23 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH printk 1/5] printk: get new seq before enabling interrupts
On 2020-09-23, Petr Mladek <pmladek@...e.com> wrote:
>> After copying all records to the dynamic ringbuffer, setup_log_buf()
>> checks to see if any records were dropped during the switch. However,
>> it needs to check before enabling interrupts since new records could
>> arrive in an interrupt, thus causing setup_log_buf() to erroneously
>> think that it had dropped messages.
>
> Have you seen the problem, please?
>
>> Signed-off-by: John Ogness <john.ogness@...utronix.de>
>> ---
>> kernel/printk/printk.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
>> index 1fe3d0cb2fe0..00bc1fce3299 100644
>> --- a/kernel/printk/printk.c
>> +++ b/kernel/printk/printk.c
>> @@ -1181,12 +1181,12 @@ void __init setup_log_buf(int early)
>> */
>> prb = &printk_rb_dynamic;
>>
>> + seq = prb_next_seq(&printk_rb_static) - seq;
>> +
>> logbuf_unlock_irqrestore(flags);
>>
>> - if (seq != prb_next_seq(&printk_rb_static)) {
>
> I can't see how these two values could get modified after enabling interrupts.
>
> + @seq is set in the for-cycle before the interrupts are enabled.
>
> + @prb is updated before the interrupts are enabled. So that
> the static buffer should not longer be used after that.
You are correct. This patch should be disregarded.
John Ogness
Powered by blists - more mailing lists