mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jonas Rebmann <jre@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: Re: [PATCH v2] commands: dmesg: clear logbuffer fully if not requested otherwise
Date: Mon, 3 Nov 2025 09:51:41 +0100	[thread overview]
Message-ID: <aQhtHSHzotzjye99@pengutronix.de> (raw)
In-Reply-To: <20251029-dmesg-v2-1-c54c7daef91b@pengutronix.de>

On Wed, Oct 29, 2025 at 02:18:27PM +0100, Jonas Rebmann wrote:
> Previously, `dmesg -c` would clear the logbuffer except for the last 10
> lines. This comes with a fair amount of surprise given linux `dmesg -c`
> clears the whole logbuffer.
> 
> Clear the complete logbuffer given `dmesg -c` but with an optional
> argument `dmesg -c [<num>]` to keep <num> lines.
> 
> While at it, add documentation for log_print(), and switch it from
> ctrlc() to ctrlc_non_interruptible(). This ensures that the complete
> execution of the dmesg command has no resched() point so that no other
> thread can intermittently modify the logbuffer, and that no message
> could arrive from another thread during log_print() and be interleaved
> with the dmesg output.
> 
> If loglevels are selected using -l or -p in addition to clearing being
> selected using -c, then messages of any loglevel are cleared.
> 
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
> Changes in v2:
> - Switch from ctrlc() to ctrlc_non_interruptible() instead of clearing
>   in log_print() (Thanks, Ahmad)
> - Improve documentation
> - Always clear all loglevels regardless of -l/-p (Thanks, Sascha)
> - Style improvements (Thanks, Ahmad)
> - Link to v1: https://lore.barebox.org/barebox/20251017-dmesg-v1-1-ac9c2fb021f6@pengutronix.de
> ---
>  .../migration-guides/migration-2025.11.0.rst       |  9 ++++++++
>  commands/dmesg.c                                   | 25 ++++++++++++----------
>  common/console_common.c                            | 12 ++++++++++-
>  3 files changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/migration-guides/migration-2025.11.0.rst b/Documentation/migration-guides/migration-2025.11.0.rst
> index a9c7abb66e..2649923bbc 100644
> --- a/Documentation/migration-guides/migration-2025.11.0.rst
> +++ b/Documentation/migration-guides/migration-2025.11.0.rst
> @@ -18,3 +18,12 @@ Karo TX6X
>  The barebox update handler for this SoM no longer unconditionally updates
>  /dev/mmc3.boot0, but instead it now updates the inactive boot partition
>  on /dev/mmc3 and then sets it as active allowing for power-fail safety.
> +
> +Shell
> +-----
> +
> +* An optional parameter was added to the `-c` option of `dmesg` allowing
> +  configuration of the number of lines to remain in the log buffer after
> +  clearing. When no parameter is provided to `-c`, zero is assumed, and no
> +  lines are retained. Earlier versions always left 10 lines of logs remain in
> +  the log buffer.

Moved this to the migration guide for v2025.12.0. while applying.

Sascha

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



      parent reply	other threads:[~2025-11-03  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 13:18 Jonas Rebmann
2025-11-03  8:50 ` Sascha Hauer
2025-11-03  8:51 ` Sascha Hauer [this message]

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=aQhtHSHzotzjye99@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jre@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