public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH printk v3 00/19] add threaded printing + the rest
@ 2024-07-22 17:19 John Ogness
  2024-07-22 17:19 ` [PATCH printk v3 01/19] printk: nbcon: Clarify nbcon_get_default_prio() context John Ogness
                   ` (18 more replies)
  0 siblings, 19 replies; 57+ messages in thread
From: John Ogness @ 2024-07-22 17:19 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Sergey Senozhatsky, Steven Rostedt, Thomas Gleixner, linux-kernel,
	Greg Kroah-Hartman, linux-fsdevel, Jiri Slaby, linux-serial

Hi,

This is v3 of a series to implement threaded console printing as
well as some other minor pieces (such as proc and sysfs support). v2
is here [0].

For information about the motivation of the nbcon consoles, please
read the cover letter of the original v1 [1].

This series provides the remaining pieces of the printk rework. All
other components are either already mainline or are currently in
linux-next. In particular this series does:

- Implement dedicated printing threads per nbcon console.

- Implement forced threading of legacy consoles for PREEMPT_RT.

- Implement nbcon support for proc and sysfs console-related files.

- Provide a new helper function nbcon_reacquire_nobuf() to allow
  nbcon console drivers to reacquire ownership.

Note that this series does *not* provide an nbcon console driver.
That will come in a follow-up series.

Here are the main changes since v2:

- Drop the patch for "threadprintk" boot arg for !PREEMPT_RT.

- Rename variables and functions:

force_printkthreads()		-> force_legacy_kthread()
nbcon_reacquire()		-> nbcon_reacquire_nobuf()
nbcon_wake_threads()		-> nbcon_wake_kthreads()
nbcon_legacy_kthread_func()	-> legacy_kthread_func()
wake_up_legacy_kthread()	-> legacy_kthread_wake()
@printk_threads_enabled		-> @printk_kthreads_running
@nbcon_legacy_kthread		-> @printk_legacy_kthread

- Introduce @printk_kthreads_ready to flag when it is allowed to
  create kthreads.

- Rename lockdep map functions with updated comments to hopefully
  better clarify their purpose.

- The write_thread() callback is now mandatory. write_atomic()
  remains optional. (This also simplifies the changes to
  drivers/tty/tty_io.c and fs/proc/consoles.c.)

- Merge nbcon_init() into nbcon_alloc(). This simplifies the rules
  and more closely resembles the legacy registration.

- Introduce struct console_flush_type to inform which flushing type
  to use.

- Introduce flushing type macro printk_get_console_flush_type() for
  non-emergency CPU states.

- Introduce flushing type macro
  printk_get_emergency_console_flush_type() for emergency CPU
  states.

- Remove @printing_via_unlock macro since there is now the flushing
  type macros.

- Replace _all_ flushing decisions with calls to new flushing type
  macros.

- Introduce helper function nbcon_write_context_set_buf() for
  setting up the write context for nbcon printers.

- In nbcon and legacy kthread functions, do not check for spurious
  signals.

- In nbcon_kthread_func(), check for kthread_should_stop() inside
  the printing loop.

- In nbcon_kthread_func(), add cond_resched() inside the printing
  loop.

- In rcuwait_has_sleeper(), avoid unnecessary RCU dereference.

- In nbcon_wake_kthreads(), do not try to wake if kthreads are not
  fully available.

- In nbcon_legacy_emit_next_record(), split the atomic/thread cases
  before and after printing.

- Use suggested alternative implementation for
  console_prepend_message().

- Move all functions to start/stop kthreads into printk.c.

- Introduce printk_kthreads_check_locked() to start/stop kthreads if
  needed when the console list has changed.

- Unregister nbcon console if the related kthread printer cannot be
  created.

- On failure to start the legacy kthread, unregister all legacy
  consoles.

- If all legacy consoles unregister, stop legacy kthread.

- If all nbcon consoles unregister, clear @nbcon_kthreads_running.

- On shutdown, clear @nbcon_kthreads_running.

- In unregister_console_locked(), flush the console before
  unregistering.

- Let pr_flush() fail if called _very_ early.

- Do not wake nbcon kthreads in printk_trigger_flush().

- In console_try_replay_all(), add support for the legacy kthread.

- Refactor the series to hopefully provide a cleaner transition to
  the final desired stand.

- Split -20 nice for kthreads into a separate patch.

- Rewrite many comments and commit messages as requested.

John Ogness

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

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

John Ogness (18):
  printk: nbcon: Clarify nbcon_get_default_prio() context
  printk: nbcon: Consolidate alloc() and init()
  printk: nbcon: Add function for printers to reacquire ownership
  printk: nbcon: Clarify rules of the owner/waiter matching
  printk: Fail pr_flush() if before SYSTEM_SCHEDULING
  printk: Flush console on unregister_console()
  printk: Add helpers for flush type logic
  printk: nbcon: Add context to usable() and emit()
  printk: nbcon: Use thread callback if in task context for legacy
  printk: nbcon: Rely on kthreads for normal operation
  printk: Provide helper for message prepending
  printk: nbcon: Show replay message on takeover
  proc: consoles: Add notation to c_start/c_stop
  proc: Add nbcon support for /proc/consoles
  tty: sysfs: Add nbcon support for 'active'
  printk: Implement legacy printer kthread for PREEMPT_RT
  printk: nbcon: Assign nice -20 for printing threads
  printk: Avoid false positive lockdep report for legacy printing

Thomas Gleixner (1):
  printk: nbcon: Introduce printer kthreads

 drivers/tty/tty_io.c     |   2 +-
 fs/proc/consoles.c       |   7 +-
 include/linux/console.h  |  50 +++-
 kernel/printk/internal.h | 159 ++++++++++-
 kernel/printk/nbcon.c    | 530 ++++++++++++++++++++++++++++++-----
 kernel/printk/printk.c   | 588 +++++++++++++++++++++++++++++++--------
 6 files changed, 1137 insertions(+), 199 deletions(-)


base-commit: b18703ea7157f62f02eb0ceb11f6fa0138e90adc
-- 
2.39.2


^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2024-08-27  1:32 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 17:19 [PATCH printk v3 00/19] add threaded printing + the rest John Ogness
2024-07-22 17:19 ` [PATCH printk v3 01/19] printk: nbcon: Clarify nbcon_get_default_prio() context John Ogness
2024-07-26  8:57   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 02/19] printk: nbcon: Consolidate alloc() and init() John Ogness
2024-07-26 11:58   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 03/19] printk: nbcon: Add function for printers to reacquire ownership John Ogness
2024-07-26 12:25   ` Petr Mladek
2024-07-29  8:36     ` John Ogness
2024-07-30  9:24       ` Petr Mladek
2024-08-27  1:32         ` John Ogness
2024-07-22 17:19 ` [PATCH printk v3 04/19] printk: nbcon: Clarify rules of the owner/waiter matching John Ogness
2024-07-26 12:55   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 05/19] printk: Fail pr_flush() if before SYSTEM_SCHEDULING John Ogness
2024-07-26 13:14   ` Petr Mladek
2024-07-26 14:45     ` John Ogness
2024-07-30  9:50       ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 06/19] printk: Flush console on unregister_console() John Ogness
2024-07-26 13:23   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 07/19] printk: Add helpers for flush type logic John Ogness
2024-07-23  2:01   ` kernel test robot
2024-07-23  8:39     ` John Ogness
2024-07-23  3:29   ` kernel test robot
2024-07-26 15:51   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 08/19] printk: nbcon: Add context to usable() and emit() John Ogness
2024-07-30 12:30   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 09/19] printk: nbcon: Introduce printer kthreads John Ogness
2024-07-30 14:44   ` John Ogness
2024-07-31  9:59     ` Petr Mladek
2024-07-30 15:16   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 10/19] printk: nbcon: Use thread callback if in task context for legacy John Ogness
2024-07-30 15:35   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 11/19] printk: nbcon: Rely on kthreads for normal operation John Ogness
2024-07-23  3:18   ` kernel test robot
2024-07-23  8:51     ` John Ogness
2024-07-31 13:46   ` preffer_ofload param: was: " Petr Mladek
2024-08-01 14:22     ` John Ogness
2024-08-01 15:40       ` Petr Mladek
2024-08-02  7:29         ` John Ogness
2024-08-02 10:19           ` Petr Mladek
2024-07-31 14:06   ` Petr Mladek
2024-07-31 15:25     ` John Ogness
2024-08-01  9:36       ` Petr Mladek
2024-08-01  9:52         ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 12/19] printk: Provide helper for message prepending John Ogness
2024-07-22 17:19 ` [PATCH printk v3 13/19] printk: nbcon: Show replay message on takeover John Ogness
2024-07-31 14:59   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 14/19] proc: consoles: Add notation to c_start/c_stop John Ogness
2024-07-22 17:19 ` [PATCH printk v3 15/19] proc: Add nbcon support for /proc/consoles John Ogness
2024-07-31 15:07   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 16/19] tty: sysfs: Add nbcon support for 'active' John Ogness
2024-07-31 15:09   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 17/19] printk: Implement legacy printer kthread for PREEMPT_RT John Ogness
2024-08-02 11:45   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 18/19] printk: nbcon: Assign nice -20 for printing threads John Ogness
2024-08-02 11:47   ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 19/19] printk: Avoid false positive lockdep report for legacy printing John Ogness
2024-08-02 12:34   ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox