introduce printk cpu lock
From: | John Ogness <john.ogness-AT-linutronix.de> | |
To: | Petr Mladek <pmladek-AT-suse.com> | |
Subject: | [PATCH next v2 0/2] introduce printk cpu lock | |
Date: | Mon, 07 Jun 2021 22:02:30 +0200 | |
Message-ID: | <20210607200232.22211-1-john.ogness@linutronix.de> | |
Cc: | Sergey Senozhatsky <senozhatsky-AT-chromium.org>, Steven Rostedt <rostedt-AT-goodmis.org>, Thomas Gleixner <tglx-AT-linutronix.de>, linux-kernel-AT-vger.kernel.org, Andrew Morton <akpm-AT-linux-foundation.org>, Dmitry Safonov <0x7f454c46-AT-gmail.com>, Stephen Rothwell <sfr-AT-canb.auug.org.au>, Peter Zijlstra <peterz-AT-infradead.org>, Marco Elver <elver-AT-google.com>, Alexander Potapenko <glider-AT-google.com>, Stephen Boyd <swboyd-AT-chromium.org>, "Paul E. McKenney" <paulmck-AT-kernel.org> | |
Archive-link: | Article |
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.o... 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