All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next v2 0/2] introduce printk cpu lock
@ 2021-06-07 20:02 John Ogness
  2021-06-07 20:02 ` [PATCH next v2 1/2] dump_stack: move cpu lock to printk.c John Ogness
  2021-06-07 20:02 ` [PATCH next v2 2/2] printk: fix cpu lock ordering John Ogness
  0 siblings, 2 replies; 18+ messages in thread
From: John Ogness @ 2021-06-07 20:02 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Sergey Senozhatsky, Steven Rostedt, Thomas Gleixner,
	linux-kernel, Andrew Morton, Dmitry Safonov, Stephen Rothwell,
	Peter Zijlstra, Marco Elver, Alexander Potapenko, Stephen Boyd,
	Paul E. McKenney

Hello,

While working on removing the safe buffers for printk [0] we
stumbled on a cpu-reentrant spinning lock used by dump_stack(). This
type of lock (dubbed a cpu lock) will cause deadlock risks once we
introduce atomic consoles because atomic consoles also need such a
lock.

Although we are not yet ready to introduce atomic consoles, this is
an appropriate time to provide an official cpu lock to be used for
all things relating to printk (including the atomic consoles, once
they are introduced).

This series is against next-20210607.

v1 can be found here [1].

Changes since v1:

- Keep cpu lock functionality even if !CONFIG_PRINTK. Only make it a
  NOP for !CONFIG_SMP.

- Rename the lock/unlock functions to reflect irq disabling/enabling.

- Change first argument of lock/unlock functions to bool. There is
  no need to track the previous @printk_cpulock_owner value.

- Change the series to first move over the cpu lock implementation,
  then fix ordering in a separate patch.

- Preserve the style from the dump_stack() cpu lock (i.e. goto-retry
  instead of for-loop and cmpxchg() instead of try_cmpxchg()).

- Drop the patch that adds serialization to show_regs().

- Fix various typos in comments.

John Ogness

[0] https://lore.kernel.org/lkml/YGW63%2FelFr%2FgYW1u@alley
[1] https://lore.kernel.org/lkml/20210531162051.2325-1-john.ogness@linutronix.de

John Ogness (2):
  dump_stack: move cpu lock to printk.c
  printk: fix cpu lock ordering

 include/linux/printk.h |  13 ++++++
 kernel/printk/printk.c | 101 +++++++++++++++++++++++++++++++++++++++++
 lib/dump_stack.c       |  41 ++---------------
 3 files changed, 118 insertions(+), 37 deletions(-)

-- 
2.20.1


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

end of thread, other threads:[~2021-06-11  7:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 20:02 [PATCH next v2 0/2] introduce printk cpu lock John Ogness
2021-06-07 20:02 ` [PATCH next v2 1/2] dump_stack: move cpu lock to printk.c John Ogness
2021-06-08  2:43   ` kernel test robot
2021-06-08  2:43     ` kernel test robot
2021-06-08 13:48     ` Petr Mladek
2021-06-08 13:48       ` Petr Mladek
2021-06-10 13:26       ` John Ogness
2021-06-10 13:26         ` John Ogness
2021-06-11  7:00         ` Petr Mladek
2021-06-11  7:00           ` Petr Mladek
2021-06-08 11:40   ` Petr Mladek
2021-06-08 13:55     ` John Ogness
2021-06-08 14:54       ` Petr Mladek
2021-06-07 20:02 ` [PATCH next v2 2/2] printk: fix cpu lock ordering John Ogness
2021-06-08 12:55   ` Petr Mladek
2021-06-08 14:18     ` John Ogness
2021-06-08 14:49       ` Petr Mladek
2021-06-10 14:44         ` John Ogness

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.