mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jonas Rebmann <jre@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH] commands: dmesg: clear logbuffer fully if not requested otherwise
Date: Mon, 20 Oct 2025 14:36:11 +0200	[thread overview]
Message-ID: <f4c0e6e7-9725-414f-b405-c098b6459753@pengutronix.de> (raw)
In-Reply-To: <aPYCgfi-oX6zQgY-@pengutronix.de>

Hi Sascha,

On 2025-10-20 11:36, Sascha Hauer wrote:
>> If loglevels are selected using -l or -p in addition to cleaning being
>> selected using -c, only clean those messages shown by the loglevel
>> selection.
> 
> I find this behaviour rather surprising. The only useful thing I could
> think of we can do with this is "Discard unimportant messages", but only
> by printing them. It would be more useful if we had a -C (uppercase)
> option to discard messages without printing them. But even with that,
> there are many things we can do with this behaviour that are not useful
> and only a few that are actually useful. We could delete for example all
> "info" messages and keep the more and less important messages, but why
> would we want to do this?
> > I think you should rather use the filter options -l and -p to limit the
> output to the messages you are interested in and finally use -c to clear
> the buffer.

I think both behaviors could come as a surprise depending on how you
look at it but if no one raises another position, I can make sure that
in v2, -c will always clear all messages of all loglevels which is also
much closer to the current behavior. I'd then add a warning that in
these cases, filtered-out messages are cleared without being shown.

However I disagree about the -C option and the idea of clearing in a
separate step.

My concept of -c is that it 'consumes' the ringbuffer, a 'dequeue'
operation, if you will. This needs to be a single step to ensure that no
messages get lost or duplicated.

For example in some long-running test, you might run `dmesg -c`
periodically and store the output. It should be guaranteed that when
doing this, you never loose a single log message (if you clear often
enough to never fill/overflow the buffer). I think the prior
implementation couldn't guarantee that, but my patch changes that. From
that perspective, the option to clear the buffer in a separate step
would not help.

In a 'consume and filter' scenario, one should just use dmesg -c -r and
perform the loglevel filtering elsewhere instead of 'consuming' per
loglevel by mixing -c with -l/-p which is why I'm ok with the change.

Regards,
Jonas

-- 
Pengutronix e.K.                           | Jonas Rebmann               |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



  reply	other threads:[~2025-10-20 12:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 11:04 Jonas Rebmann
2025-10-17 11:17 ` Ahmad Fatoum
2025-10-20  9:36 ` Sascha Hauer
2025-10-20 12:36   ` Jonas Rebmann [this message]
2025-10-20 13:23     ` Sascha Hauer

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=f4c0e6e7-9725-414f-b405-c098b6459753@pengutronix.de \
    --to=jre@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox