Messages in this thread | | | From | John Ogness <> | Subject | [PATCH printk v2 0/7] printk: cleanup buffer handling | Date | Thu, 24 Nov 2022 00:19:53 +0106 |
| |
Hi,
This is v2 of a series to cleanup buffer handling and prepare for code sharing with the upcoming threaded/atomic consoles. v1 is patches 13-18 of [0].
Changes since v1:
- Explain why console.h was chosen for buffer size defines.
- Keep DROPPED_TEXT_MAX define in printk.c.
- Put new BIT()-macro usage for console flags into its own commit.
- Modify descriptions for console flags as suggested.
- Add argument names and types to console callback definitions to satisfy checkpatch.pl complaints.
- Avoid temporary usage of an ext_text/dropped_text union mid-series.
- Rename various structures, fields, and functions:
struct cons_text_buf -> struct console_buffers
struct cons_outbuf_desc -> struct console_message
cons_outbuf_desc.txtbuf -> console_message.cbufs
cons_outbuf_desc.len -> console_message.outbuf_len
cons_outbuf_desc.extmsg -> console_message.is_extmsg
cons_fill_outbuf() -> console_get_next_message()
cons_print_dropped() -> msg_print_dropped()
- Remove cons_outbuf_desc->dropped and make @dropped an argument of msg_print_dropped() instead.
- Use "ext_text" and "ext_text_size" names for stack variables when they refer to console_buffers->ext_text.
- Add a compile-time verification that DROPPED_TEXT_MAX is less than CONSOLE_EXT_LOG_MAX - CONSOLE_LOG_MAX since the code expects that a dropped+regular message will fit in console_buffers->ext_text.
- Replace hard-coded CONSOLE_LOG_MAX and CONSOLE_EXT_LOG_MAX usage with sizeof() usage.
- For dropped messages, copy the regular message to append the dropped message, instead of copying the dropped message to prepend the regular message. Now it is not a hack and there is no need for the __no_randomize_layout annotation.
- Reset console->dropped explicitly instead of relying on msg_print_dropped() side-effects.
- Rework and expand comments and commit messages as requested.
John Ogness
[0] https://lore.kernel.org/lkml/20220924000454.3319186-1-john.ogness@linutronix.de
Thomas Gleixner (7): printk: Move buffer size defines console: Use BIT() macros for @flags values console: Document struct console printk: Add struct console_buffers printk: Use struct console_buffers printk: Use an output buffer descriptor struct for emit printk: Handle dropped message smarter
include/linux/console.h | 139 ++++++++++++++++++----- include/linux/printk.h | 2 - kernel/printk/printk.c | 240 ++++++++++++++++++++++++++-------------- 3 files changed, 269 insertions(+), 112 deletions(-)
base-commit: 11f1e536902b38bffab9913f8908309daf7e53e1 -- 2.30.2
| |