public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH printk v6 00/30] wire up write_atomic() printing
@ 2024-05-27  6:37 John Ogness
  2024-05-27  6:37 ` [PATCH printk v6 01/30] printk: Add notation to console_srcu locking John Ogness
                   ` (30 more replies)
  0 siblings, 31 replies; 36+ messages in thread
From: John Ogness @ 2024-05-27  6:37 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Sergey Senozhatsky, Steven Rostedt, Thomas Gleixner, linux-kernel,
	Paul E. McKenney, Miguel Ojeda, Greg Kroah-Hartman, Jiri Slaby,
	linux-serial, Russell King, Tony Lindgren, Andy Shevchenko,
	Florian Fainelli, Uwe Kleine-König, Théo Lebrun,
	Linus Walleij, Ilpo Järvinen, Fabio Estevam, Lino Sanfilippo,
	Christophe JAILLET, Arnd Bergmann, Andrew Morton, Uros Bizjak,
	Lukas Wunner, Kefeng Wang, Ingo Molnar, Frederic Weisbecker,
	Neeraj Upadhyay, Joel Fernandes, Josh Triplett, Boqun Feng,
	Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu, Peter Zijlstra,
	Ingo Molnar, Will Deacon, Waiman Long

Hi,

This is v6 of a series to wire up the nbcon consoles so that
they actually perform printing using their write_atomic()
callback. v5 is here [0]. For information about the motivation
of the atomic consoles, please read the cover letter of v1 [1].

The main focus of this series:

- For nbcon consoles, always call write_atomic() directly from
  printk() caller context for the panic CPU.

- For nbcon consoles, call write_atomic() when unlocking the
  console lock.

- Only perform the console lock/unlock dance if legacy or boot
  consoles are registered.

- For legacy consoles, if nbcon consoles are registered, do not
  attempt to print from printk() caller context for the panic
  CPU until nbcon consoles have had a chance to print the most
  significant messages.

- Mark emergency sections. In these sections printk() calls
  will only store the messages. Upon exiting the emergency
  section, nbcon consoles are flushed directly. If legacy
  consoles cannot be flushed safely, an irq_work is triggered
  to do the legacy console flushing.

This series does _not_ include threaded printing or nbcon
drivers. Those features will be added in separate follow-up
series.

Note: With this series, a system with _only_ nbcon consoles
      registered will not perform console printing unless the
      console lock or nbcon port lock are used or on panic.
      This is on purpose. When nbcon kthreads are introduced,
      they will fill the gaps.

The changes since v5:

- In struct console, rename @nbcon_driver_ctxt to
  @nbcon_device_ctxt.

- Rename nbcon_driver_try_acquire() to
  nbcon_device_try_acquire().

- Rename nbcon_driver_release() to nbcon_device_release().

- Implement a helper function is_printk_deferred() for use in
  nbcon_cpu_emergency_exit(), nbcon_cpu_emergency_flush(),
  vprintk().

- In nbcon_cpu_emergency_exit(), for legacy consoles, try to
  flush directly if safe. If legacy flushing directly was
  successful, do not trigger the irq_work.

- In nbcon_cpu_emergency_exit(), do not decrement
  @cpu_emergency_nesting if it is zero (and WARN_ON_ONCE in
  this case).

- For register_console() and unregister_console_locked(), use a
  local variable @use_device_lock to track if locking is used
  so that the compiler knows that the lock and unlock match.

- For synchronize_rcu_expedited_wait(), move the
  nbcon_cpu_emergency_flush() after dump_cpu_task().

- Refactor nbcon_atomic_flush_pending_con() as suggested by
  pmladek. No functional change.

- Update various comments as suggested by pmladek.

- In nbcon_device_try_acquire(), add missing kerneldoc for the
  return value.

John Ogness

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

John Ogness (25):
  printk: Add notation to console_srcu locking
  printk: nbcon: Remove return value for write_atomic()
  printk: nbcon: Add detailed doc for write_atomic()
  printk: nbcon: Add callbacks to synchronize with driver
  printk: nbcon: Use driver synchronization while (un)registering
  serial: core: Provide low-level functions to lock port
  serial: core: Introduce wrapper to set @uart_port->cons
  console: Improve console_srcu_read_flags() comments
  nbcon: Add API to acquire context for non-printing operations
  serial: core: Implement processing in port->lock wrapper
  printk: nbcon: Do not rely on proxy headers
  printk: nbcon: Fix kerneldoc for enums
  printk: Make console_is_usable() available to nbcon
  printk: Let console_is_usable() handle nbcon
  printk: Add @flags argument for console_is_usable()
  printk: nbcon: Add helper to assign priority based on CPU state
  printk: Track registered boot consoles
  printk: nbcon: Use nbcon consoles in console_flush_all()
  printk: nbcon: Add unsafe flushing on panic
  printk: Avoid console_lock dance if no legacy or boot consoles
  printk: Track nbcon consoles
  printk: Coordinate direct printing in panic
  panic: Mark emergency section in oops
  rcu: Mark emergency sections in rcu stalls
  lockdep: Mark emergency sections in lockdep splats

Petr Mladek (1):
  printk: Properly deal with nbcon consoles on seq init

Sebastian Andrzej Siewior (1):
  printk: Check printk_deferred_enter()/_exit() usage

Thomas Gleixner (3):
  printk: nbcon: Provide function to flush using write_atomic()
  printk: nbcon: Implement emergency sections
  panic: Mark emergency section in warn

 drivers/tty/serial/8250/8250_core.c |   6 +-
 drivers/tty/serial/amba-pl011.c     |   2 +-
 drivers/tty/serial/serial_core.c    |  16 +-
 include/linux/console.h             | 116 ++++++-
 include/linux/printk.h              |  33 +-
 include/linux/serial_core.h         | 117 ++++++-
 kernel/locking/lockdep.c            |  84 ++++-
 kernel/panic.c                      |   9 +
 kernel/printk/internal.h            |  73 +++-
 kernel/printk/nbcon.c               | 506 +++++++++++++++++++++++++++-
 kernel/printk/printk.c              | 307 +++++++++++++----
 kernel/printk/printk_ringbuffer.h   |   2 +
 kernel/printk/printk_safe.c         |  23 +-
 kernel/rcu/tree_exp.h               |   9 +
 kernel/rcu/tree_stall.h             |  11 +
 15 files changed, 1181 insertions(+), 133 deletions(-)


base-commit: 596ffa476e201ecbf7ea024f1b59d4f28e91060c
-- 
2.39.2


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

end of thread, other threads:[~2024-05-28 13:36 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27  6:37 [PATCH printk v6 00/30] wire up write_atomic() printing John Ogness
2024-05-27  6:37 ` [PATCH printk v6 01/30] printk: Add notation to console_srcu locking John Ogness
2024-05-27  6:37 ` [PATCH printk v6 02/30] printk: Properly deal with nbcon consoles on seq init John Ogness
2024-05-27  6:37 ` [PATCH printk v6 03/30] printk: nbcon: Remove return value for write_atomic() John Ogness
2024-05-27  6:37 ` [PATCH printk v6 04/30] printk: Check printk_deferred_enter()/_exit() usage John Ogness
2024-05-27  6:37 ` [PATCH printk v6 05/30] printk: nbcon: Add detailed doc for write_atomic() John Ogness
2024-05-27  6:37 ` [PATCH printk v6 06/30] printk: nbcon: Add callbacks to synchronize with driver John Ogness
2024-05-27  6:37 ` [PATCH printk v6 07/30] printk: nbcon: Use driver synchronization while (un)registering John Ogness
2024-05-27  6:37 ` [PATCH printk v6 08/30] serial: core: Provide low-level functions to lock port John Ogness
2024-05-27  6:37 ` [PATCH printk v6 09/30] serial: core: Introduce wrapper to set @uart_port->cons John Ogness
2024-05-27  6:37 ` [PATCH printk v6 10/30] console: Improve console_srcu_read_flags() comments John Ogness
2024-05-27  6:37 ` [PATCH printk v6 11/30] nbcon: Add API to acquire context for non-printing operations John Ogness
2024-05-27  6:37 ` [PATCH printk v6 12/30] serial: core: Implement processing in port->lock wrapper John Ogness
2024-05-27  6:37 ` [PATCH printk v6 13/30] printk: nbcon: Do not rely on proxy headers John Ogness
2024-05-27  6:37 ` [PATCH printk v6 14/30] printk: nbcon: Fix kerneldoc for enums John Ogness
2024-05-27  6:37 ` [PATCH printk v6 15/30] printk: Make console_is_usable() available to nbcon John Ogness
2024-05-27  6:37 ` [PATCH printk v6 16/30] printk: Let console_is_usable() handle nbcon John Ogness
2024-05-27  6:37 ` [PATCH printk v6 17/30] printk: Add @flags argument for console_is_usable() John Ogness
2024-05-27  6:37 ` [PATCH printk v6 18/30] printk: nbcon: Add helper to assign priority based on CPU state John Ogness
2024-05-27  6:37 ` [PATCH printk v6 19/30] printk: nbcon: Provide function to flush using write_atomic() John Ogness
2024-05-28  9:30   ` Petr Mladek
2024-05-27  6:37 ` [PATCH printk v6 20/30] printk: Track registered boot consoles John Ogness
2024-05-27  6:37 ` [PATCH printk v6 21/30] printk: nbcon: Use nbcon consoles in console_flush_all() John Ogness
2024-05-27  6:37 ` [PATCH printk v6 22/30] printk: nbcon: Add unsafe flushing on panic John Ogness
2024-05-27  6:37 ` [PATCH printk v6 23/30] printk: Avoid console_lock dance if no legacy or boot consoles John Ogness
2024-05-27  6:37 ` [PATCH printk v6 24/30] printk: Track nbcon consoles John Ogness
2024-05-27  6:37 ` [PATCH printk v6 25/30] printk: Coordinate direct printing in panic John Ogness
2024-05-27  6:37 ` [PATCH printk v6 26/30] printk: nbcon: Implement emergency sections John Ogness
2024-05-28  9:57   ` Petr Mladek
2024-05-27  6:37 ` [PATCH printk v6 27/30] panic: Mark emergency section in warn John Ogness
2024-05-27  6:37 ` [PATCH printk v6 28/30] panic: Mark emergency section in oops John Ogness
2024-05-27  6:37 ` [PATCH printk v6 29/30] rcu: Mark emergency sections in rcu stalls John Ogness
2024-05-28 10:04   ` Petr Mladek
2024-05-27  6:37 ` [PATCH printk v6 30/30] lockdep: Mark emergency sections in lockdep splats John Ogness
2024-05-28 10:10 ` [PATCH printk v6 00/30] wire up write_atomic() printing Petr Mladek
2024-05-28 13:35   ` Petr Mladek

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