Re: [PATCH printk v5 6/8] printk: introduce console_prepend_dropped() for dropped messages

From: Petr Mladek
Date: Mon Jan 09 2023 - 09:12:53 EST


On Mon 2023-01-09 11:13:58, John Ogness wrote:
> Currently "dropped messages" are separately printed immediately
> before printing the printk message. Since normal consoles are
> now using an output buffer that is much larger than previously,
> the "dropped message" could be prepended to the printk message
> and then output everything in a single write() call.
>
> Introduce a helper function console_prepend_dropped() to prepend
> an existing message with a "dropped message". This simplifies
> the code by allowing all message formatting to be handled
> together and then only requires a single write() call to output
> the full message. And since this helper does not require any
> locking, it can be used in the future for other console printing
> contexts as well.
>
> Note that console_prepend_dropped() is defined as a NOP for
> !CONFIG_PRINTK. Although the function will never be called for
> !CONFIG_PRINTK, compiling the function can lead to warnings of
> "always true" conditionals due to the size macro values used
> in !CONFIG_PRINTK.
>
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr