All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH printk v2 3/4] printk: Skip unfinalized records in panic
Date: Wed, 18 Oct 2023 16:20:40 +0200	[thread overview]
Message-ID: <ZS_puLYK4TZR12Cx@alley> (raw)
In-Reply-To: <ZS_Vg4vvT29LxWSD@alley>

On Wed 2023-10-18 14:54:29, Petr Mladek wrote:
> On Tue 2023-10-17 23:31:25, John Ogness wrote:
> > On 2023-10-17, Petr Mladek <pmladek@suse.com> wrote:
> > > BTW: The support for data-less records were added by the commit
> > >      ("printk: ringbuffer: support dataless records"). It was
> > >      needed to handle empty lines: printk("\n"). It is strange
> > >      that we skip them instead of printing the empty line.
> > 
> > We do not skip them. That was the whole point of adding support for
> > data-less records. ;-)
> > 
> > get_data() returns "" and @data_size=0

Ah, I see it now. The code really handles printk("\n") correctly.

There are two types of dataless records:

      + #define NO_LPOS 0x3. It is used for storing zero size data.

      + #define FAILED_LPOS 0x1. It is used when the code failed
	  to allocate enough space on the ring buffer or when
	  they were overwritten.

BLK_DATALESS() returns true for both of them.

Sigh, we should really distinguish in the comments when functions
handle the two situations different way. Especially we should not
use the ambiguous "dataless record" word.

I think about "empty line record" and "records with missing data".
And I would rename NO_LPOS to EMPTY_LINE_LPOS to make the meaning
more obvious.

Also it would make sense to use 0x2 for EMPTY_LINE_LPOS and

#define FAILED_LPOS		0x1
#define EMPTY_LINE_LPOS		0x2
#define DATALESS_LPOS_MASK	(FAILED_LPOS | EMPTY_LINE_LPOS)

#define LPOS_DATALESS(lpos)	((lpos) & DATALESS_LPOS_MASK)

> > copy_data() returns true (but does not copy any data)
> > 
> > prb_read() returns true (we are assuming it is finalized)
> > 
> > _prb_read_valid() returns true
> 
> This is not true if I read the code correctly.
> 
> > prb_read_valid() return true
> > 
> > record_print_text() creates a string with prefix and adds "\n"
> > 
> > printk_get_next_message() returns something to print

If we used the right terms in the comments then they might stay short
and still be clear.

Best Regards,
Petr

  parent reply	other threads:[~2023-10-18 14:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13 20:43 [PATCH printk v2 0/4] fix console flushing on panic John Ogness
2023-10-13 20:43 ` [PATCH printk v2 1/4] printk: For @suppress_panic_printk check other panic John Ogness
2023-10-16 13:05   ` Petr Mladek
2023-10-13 20:43 ` [PATCH printk v2 2/4] printk: Add this_cpu_in_panic() John Ogness
2023-10-16 13:14   ` Petr Mladek
2023-10-13 20:43 ` [PATCH printk v2 3/4] printk: Skip unfinalized records in panic John Ogness
2023-10-17 11:27   ` Petr Mladek
2023-10-17 21:25     ` John Ogness
2023-10-18  8:24       ` John Ogness
2023-10-18 13:15         ` Petr Mladek
2023-10-18 12:54       ` Petr Mladek
2023-10-18 13:45         ` John Ogness
2023-10-18 15:27           ` Petr Mladek
2023-10-18 15:50             ` John Ogness
2023-10-19 10:29               ` Petr Mladek
2023-10-18 14:20         ` Petr Mladek [this message]
2023-10-23  9:53           ` John Ogness
2023-10-13 20:43 ` [PATCH printk v2 4/4] printk: Ignore waiter on panic John Ogness
2023-10-18  9:56   ` Petr Mladek
2023-10-23  9:15     ` John Ogness
2023-10-13 20:46 ` [PATCH printk v2 0/4] fix console flushing " John Ogness

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=ZS_puLYK4TZR12Cx@alley \
    --to=pmladek@suse.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.