[printk,v5,0/8] printk: cleanup buffer handling

Message ID 20230109100800.1085541-1-john.ogness@linutronix.de
Headers
Series printk: cleanup buffer handling |

Message

John Ogness Jan. 9, 2023, 10:07 a.m. UTC
  Hi,

This is v5 of a series to cleanup console buffer handling and
prepare for code sharing with the upcoming threaded/atomic
consoles. v4 is here [0].

The main purpose of the series is to introduce two new lockless
functions to handle reading and formatting of printk messages. These
functions can then be used from any context, which is important for
the upcoming threaded/atomic consoles. The series also helps to
cleanup some of the internal printk interfaces and cleanly separate
formatting code from outputting code.

Changes since v4:

- Make console_prepend_dropped() a NOP for !CONFIG_PRINTK to
  workaround compiler warnings.

- In devkmsg_read() use printk_get_next_message() for the wait
  condition instead of looping to retry the actual read.

- Add an argument @may_suppress to printk_get_next_message() so
  devkmsg_read() can specify that records should not be skipped
  based on loglevel.

John Ogness

[0] https://lore.kernel.org/lkml/20230105103735.880956-1-john.ogness@linutronix.de

John Ogness (6):
  printk: move size limit macros into internal.h
  printk: introduce struct printk_buffers
  printk: introduce printk_get_next_message() and printk_message
  printk: introduce console_prepend_dropped() for dropped messages
  printk: use printk_buffers for devkmsg
  printk: adjust string limit macros

Thomas Gleixner (2):
  console: Use BIT() macros for @flags values
  console: Document struct console

 include/linux/console.h  | 100 +++++++++----
 include/linux/printk.h   |   2 -
 kernel/printk/internal.h |  45 ++++++
 kernel/printk/printk.c   | 308 +++++++++++++++++++++++----------------
 4 files changed, 297 insertions(+), 158 deletions(-)


base-commit: 6b2b0d839acaa84f05a77184370f793752e786e9
  

Comments

Petr Mladek Jan. 9, 2023, 3:10 p.m. UTC | #1
On Mon 2023-01-09 11:13:52, John Ogness wrote:
> Hi,
> 
> This is v5 of a series to cleanup console buffer handling and
> prepare for code sharing with the upcoming threaded/atomic
> consoles. v4 is here [0].
> 
> The main purpose of the series is to introduce two new lockless
> functions to handle reading and formatting of printk messages. These
> functions can then be used from any context, which is important for
> the upcoming threaded/atomic consoles. The series also helps to
> cleanup some of the internal printk interfaces and cleanly separate
> formatting code from outputting code.
> 
> Changes since v4:
> 
> - Make console_prepend_dropped() a NOP for !CONFIG_PRINTK to
>   workaround compiler warnings.
> 
> - In devkmsg_read() use printk_get_next_message() for the wait
>   condition instead of looping to retry the actual read.
> 
> - Add an argument @may_suppress to printk_get_next_message() so
>   devkmsg_read() can specify that records should not be skipped
>   based on loglevel.
> 
> John Ogness
> 
> [0] https://lore.kernel.org/lkml/20230105103735.880956-1-john.ogness@linutronix.de
> 
> John Ogness (6):
>   printk: move size limit macros into internal.h
>   printk: introduce struct printk_buffers
>   printk: introduce printk_get_next_message() and printk_message
>   printk: introduce console_prepend_dropped() for dropped messages
>   printk: use printk_buffers for devkmsg
>   printk: adjust string limit macros
> 
> Thomas Gleixner (2):
>   console: Use BIT() macros for @flags values
>   console: Document struct console

The series looks ready for linux-next from my POV.

I am going to push it into a new branch rework/buffers-cleanup within
two days or so unless anyone speak against it.

Best Regards,
Petr
  
Petr Mladek Jan. 11, 2023, 3:36 p.m. UTC | #2
On Mon 2023-01-09 16:10:52, Petr Mladek wrote:
> On Mon 2023-01-09 11:13:52, John Ogness wrote:
> > Hi,
> > 
> > This is v5 of a series to cleanup console buffer handling and
> > prepare for code sharing with the upcoming threaded/atomic
> > consoles. v4 is here [0].
> > 
> > The main purpose of the series is to introduce two new lockless
> > functions to handle reading and formatting of printk messages. These
> > functions can then be used from any context, which is important for
> > the upcoming threaded/atomic consoles. The series also helps to
> > cleanup some of the internal printk interfaces and cleanly separate
> > formatting code from outputting code.
> > 
> > Changes since v4:
> > 
> > - Make console_prepend_dropped() a NOP for !CONFIG_PRINTK to
> >   workaround compiler warnings.
> > 
> > - In devkmsg_read() use printk_get_next_message() for the wait
> >   condition instead of looping to retry the actual read.
> > 
> > - Add an argument @may_suppress to printk_get_next_message() so
> >   devkmsg_read() can specify that records should not be skipped
> >   based on loglevel.
> > 
> > John Ogness
> > 
> > [0] https://lore.kernel.org/lkml/20230105103735.880956-1-john.ogness@linutronix.de
> > 
> > John Ogness (6):
> >   printk: move size limit macros into internal.h
> >   printk: introduce struct printk_buffers
> >   printk: introduce printk_get_next_message() and printk_message
> >   printk: introduce console_prepend_dropped() for dropped messages
> >   printk: use printk_buffers for devkmsg
> >   printk: adjust string limit macros
> > 
> > Thomas Gleixner (2):
> >   console: Use BIT() macros for @flags values
> >   console: Document struct console
> 
> The series looks ready for linux-next from my POV.
> 
> I am going to push it into a new branch rework/buffers-cleanup within
> two days or so unless anyone speak against it.

JFYI, the patchset has been committed into printk/linux.git,
branch rework/buffers-cleanup.

It it intended for the next 6.3 merge window.

Best Regards,
Petr