From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [RFC][PATCH 1/2] printk: lock console_sem before we unregister boot consoles
Date: Thu, 25 Apr 2019 12:52:33 +0900 [thread overview]
Message-ID: <20190425035233.GA8532@jagdpanzerIV> (raw)
In-Reply-To: <20190424144924.lw5sgl7qa2yrpxsj@pathway.suse.cz>
On (04/24/19 16:49), Petr Mladek wrote:
> > + if (bcon && (newcon->flags & (CON_CONSDEV|CON_BOOT)) == CON_CONSDEV) {
> > + console_lock();
> > + /*
> > + * We need to iterate through all boot consoles, to make
> > * sure we print everything out, before we unregister them.
> > */
>
> I wondered if moving the console locking could break the above
> statement.
>
> It seems that the comment has been invalid since the commit
> 8259cf4342029aad37660e ("printk: Ensure that "console
> enabled" messages are printed on the console").
That's very interesting. Yes, you are right, the comment is a
leftover. printk used to iterate consoles twice before
8259cf4342029aad37660e
/* we need to iterate through twice, to make sure we print
* everything out, before we unregister the console(s)
*/
printk(KERN_INFO "console handover:");
for_each_console(bcon)
printk("boot [%s%d] ", bcon->name, bcon->index);
printk(" -> real [%s%d]\n", newcon->name, newcon->index);
for_each_console(bcon)
unregister_console(bcon);
But 8259cf4342029aad37660e has changed that and has made comment
invalid.
> Could we remove it in this patch? It touches it indirectly anyway.
Sure we can.
We also can take extra care of pr_info("%sconsole [%s%d] enabled\n".
Right now we do
...
console_unlock();
console_sysfs_notify();
pr_info("%sconsole [%s%d] enabled\n",....
But we can simply move that pr_info() a bit up:
pr_info("%sconsole [%s%d] enabled\n",
console_unlock();
console_sysfs_notify();
So the message will be printed on all consoles.
---
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index c2bccf58d03e..981eb6c27cdb 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2813,8 +2813,6 @@ void register_console(struct console *newcon)
exclusive_console_stop_seq = console_seq;
logbuf_unlock_irqrestore(flags);
}
- console_unlock();
- console_sysfs_notify();
/*
* By unregistering the bootconsoles after we enable the real console
@@ -2827,6 +2825,9 @@ void register_console(struct console *newcon)
(newcon->flags & CON_BOOT) ? "boot" : "" ,
newcon->name, newcon->index);
+ console_unlock();
+ console_sysfs_notify();
+
if (keep_bootcon)
return;
---
> Otherwise, the patch looks fine to me:
>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
Thanks!
-ss
next prev parent reply other threads:[~2019-04-25 3:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 6:25 [RFC][PATCH 0/2] Access console drivers list under console_sem Sergey Senozhatsky
2019-04-23 6:25 ` [RFC][PATCH 1/2] printk: lock console_sem before we unregister boot consoles Sergey Senozhatsky
2019-04-24 14:49 ` Petr Mladek
2019-04-25 3:52 ` Sergey Senozhatsky [this message]
2019-04-25 6:43 ` Sergey Senozhatsky
2019-04-25 9:20 ` Petr Mladek
2019-04-25 16:05 ` Steven Rostedt
2019-04-25 7:50 ` Petr Mladek
2019-04-25 7:56 ` Sergey Senozhatsky
2019-04-25 9:37 ` Sergey Senozhatsky
2019-04-23 6:25 ` [RFC][PATCH 2/2] printk: take console_sem when accessing console drivers list Sergey Senozhatsky
2019-04-24 15:13 ` Petr Mladek
2019-04-25 5:19 ` Sergey Senozhatsky
2019-04-25 6:47 ` Sergey Senozhatsky
2019-04-25 8:53 ` Petr Mladek
2019-04-23 13:48 ` [RFC][PATCH 0/2] Access console drivers list under console_sem Steven Rostedt
2019-04-24 5:43 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190425035233.GA8532@jagdpanzerIV \
--to=sergey.senozhatsky.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.