diff options
author | John Ogness <john.ogness@linutronix.de> | 2022-11-16 19:21:22 +0300 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2022-12-02 13:25:00 +0300 |
commit | 8b5dd40088f7a3d85e6072f027ec50f309f64876 (patch) | |
tree | 91dc7785c11e00f57197aedd4f0ec46b6d995a45 /fs/proc | |
parent | d25a2e748ae159e43d40f4bc0a9e89cc443e325f (diff) | |
download | linux-8b5dd40088f7a3d85e6072f027ec50f309f64876.tar.xz |
proc: consoles: document console_lock usage
The console_lock is held throughout the start/show/stop procedure
to print out device/driver information about all registered
consoles. Since the console_lock is being used for multiple reasons,
explicitly document these reasons. This will be useful when the
console_lock is split into fine-grained locking.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20221116162152.193147-11-john.ogness@linutronix.de
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/consoles.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c index cf2e0788f9c7..46b305fa04ed 100644 --- a/fs/proc/consoles.c +++ b/fs/proc/consoles.c @@ -63,6 +63,15 @@ static void *c_start(struct seq_file *m, loff_t *pos) struct console *con; loff_t off = 0; + /* + * Take console_lock to serialize device() callback with + * other console operations. For example, fg_console is + * modified under console_lock when switching vt. + * + * Hold the console_lock to guarantee safe traversal of the + * console list. SRCU cannot be used because there is no + * place to store the SRCU cookie. + */ console_lock(); for_each_console(con) if (off++ == *pos) |