[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzFvSC2Afizxm+eB@google.com>
Date: Mon, 26 Sep 2022 18:22:16 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: John Ogness <john.ogness@...utronix.de>
Cc: Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH printk 18/18] printk: Handle dropped message smarter
On (22/09/24 02:10), John Ogness wrote:
[..]
> +/**
> + * cons_print_dropped - Print 'dropped' message if required
> + * @desc: Pointer to the output descriptor
> + *
> + * Prints the 'dropped' message info the output buffer if @desc->dropped is
> + * not 0 and the regular format is requested. Extended format does not
> + * need this message because it prints the sequence numbers.
> + *
> + * In regular format the extended message buffer is not in use.
> + * So print into it at the beginning and move the resulting string
> + * just in front of the regular text buffer so that the message can
> + * be printed in one go.
> + *
> + * In case of a message this returns with @desc->outbuf and @desc->len
> + * updated. If no message is required then @desc is not modified.
> + */
> +static void cons_print_dropped(struct cons_outbuf_desc *desc)
A silly nit: as far as I can tell printk API uses console_foo for
naming, so my personal preference would be to spell console_ instead
of cons_ (in this and in previous patches).
> +{
> + struct cons_text_buf *txtbuf = desc->txtbuf;
> + size_t len;
> +
> + if (!desc->dropped || desc->extmsg)
> + return;
> +
> + if (WARN_ON_ONCE(desc->outbuf != txtbuf->text))
> + return;
> +
> + /* Print it into ext_text which is unused */
> + len = snprintf(txtbuf->ext_text, DROPPED_TEXT_MAX,
> + "** %lu printk messages dropped **\n", desc->dropped);
> + desc->dropped = 0;
> +
> + /* Copy it just below text so it goes out with one write */
> + memcpy(txtbuf->text - len, txtbuf->ext_text, len);
> +
> + /* Update the descriptor */
> + desc->len += len;
> + desc->outbuf -= len;
> +}
> +
>
An even sillier nit: extra blank line /* can't help noticing it every time
I read this function :) */
Powered by blists - more mailing lists