From: Petr Mladek <pmladek@suse.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: sergey.senozhatsky@gmail.com, linux-kernel@vger.kernel.org,
rostedt@goodmis.org, mingo@kernel.org, tglx@linutronix.de
Subject: Re: [PATCH 2/3] early_printk: Add force_early_printk kernel parameter
Date: Thu, 12 Oct 2017 12:24:19 +0200 [thread overview]
Message-ID: <20171012102419.GE2882@pathway.suse.cz> (raw)
In-Reply-To: <20170928122513.376168124@infradead.org>
On Thu 2017-09-28 14:18:25, Peter Zijlstra wrote:
> Add add the 'force_early_printk' kernel parameter to override printk()
> and force it into early_printk(). This bypasses all the cruft and fail
> from printk() and makes things work again.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> kernel/printk/printk.c | 68 +++++++++++++++++++++++++++++++++----------------
> 1 file changed, 47 insertions(+), 21 deletions(-)
>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -365,6 +365,42 @@ __packed __aligned(4)
> #endif
> ;
>
> +#ifdef CONFIG_EARLY_PRINTK
> +struct console *early_console;
> +
> +static bool __read_mostly force_early_printk;
> +
> +static int __init force_early_printk_setup(char *str)
> +{
> + force_early_printk = true;
> + return 0;
> +}
> +early_param("force_early_printk", force_early_printk_setup);
The parameter is currently used only when CONFIG_PRINTK is enabled.
But CONFIG_EARLY_PRINTK is independent. What would be your preferred
behavior when CONFIG_PRINTK is disabled, please?
> @@ -1816,6 +1852,11 @@ asmlinkage int vprintk_emit(int facility
> return vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
> #endif
>
> +#ifdef CONFIG_EARLY_PRINTK
> + if (force_early_printk && early_console)
> + return early_vprintk(fmt, args);
> +#endif
> +
> if (level == LOGLEVEL_SCHED) {
> level = LOGLEVEL_DEFAULT;
> in_sched = true;
> @@ -1939,7 +1980,12 @@ asmlinkage __visible int printk(const ch
> int r;
>
> va_start(args, fmt);
> - r = vprintk_func(fmt, args);
> +#ifdef CONFIG_EARLY_PRINTK
> + if (force_early_printk && early_console)
> + r = vprintk_default(fmt, args);
> + else
> +#endif
> + r = vprintk_func(fmt, args);
There is rather theoretical race. We skip vprintk_func() because
we believe that vprintk_default()/vprintk_emit() would choose
handle this by early_printk().
A solution would be the clean up of the exported printk() interfaces
that I suggested in the other mail. Then we could choose the right
implementation on a single place: printk_func().
PeterZ, I guess that you do not want to spend much time on this.
But if you basically agree with my proposal, I could start
working on it and rebase this patchset on top of it.
Best Regards,
Petr
PS: I am sorry that I am complicating this rather simple patchset.
I only want to be careful. You know that the current printk code
is a mess and I would like to improve it.
next prev parent reply other threads:[~2017-10-12 10:24 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 12:18 [PATCH 0/3] printk: Add force_early_printk boot param Peter Zijlstra
2017-09-28 12:18 ` [PATCH 1/3] printk: Fix kdb_trap_printk placement Peter Zijlstra
2017-10-03 22:10 ` Steven Rostedt
2017-10-05 13:38 ` Petr Mladek
2017-10-05 13:42 ` Peter Zijlstra
2017-10-09 15:05 ` Petr Mladek
2017-10-12 9:45 ` Petr Mladek
2017-10-12 10:03 ` Petr Mladek
2017-10-12 11:34 ` Peter Zijlstra
2017-10-12 11:52 ` Greg Kroah-Hartman
2017-10-12 12:08 ` Greg Kroah-Hartman
2017-10-12 18:11 ` Joe Perches
2017-10-13 14:23 ` Petr Mladek
2017-10-12 11:30 ` Peter Zijlstra
2017-09-28 12:18 ` [PATCH 2/3] early_printk: Add force_early_printk kernel parameter Peter Zijlstra
2017-09-28 15:41 ` Randy Dunlap
2017-09-28 16:07 ` Peter Zijlstra
2017-09-28 17:05 ` Randy Dunlap
2017-10-03 22:18 ` Steven Rostedt
2017-10-12 10:24 ` Petr Mladek [this message]
2017-10-12 11:39 ` Peter Zijlstra
2017-10-13 13:06 ` Petr Mladek
2017-10-13 13:20 ` Peter Zijlstra
2017-10-13 13:30 ` Steven Rostedt
2017-09-28 12:18 ` [PATCH 3/3] early_printk: Add simple serialization to early_vprintk() Peter Zijlstra
2017-10-03 22:24 ` Steven Rostedt
2017-10-04 9:08 ` Peter Zijlstra
2017-10-04 13:04 ` Steven Rostedt
2017-10-04 13:08 ` Peter Zijlstra
2017-10-04 14:17 ` Paul E. McKenney
2017-10-04 14:43 ` Steven Rostedt
2017-10-04 14:52 ` Peter Zijlstra
2017-10-04 15:02 ` Steven Rostedt
2017-10-04 15:14 ` Paul E. McKenney
2017-10-04 15:24 ` Peter Zijlstra
2017-10-04 15:38 ` Paul E. McKenney
2017-09-28 16:02 ` [PATCH 0/3] printk: Add force_early_printk boot param Sergey Senozhatsky
2017-09-28 16:17 ` Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2016-10-18 17:08 [PATCH 0/3] make printk work again Peter Zijlstra
2016-10-18 17:08 ` [PATCH 2/3] early_printk: Add force_early_printk kernel parameter Peter Zijlstra
2016-11-29 14:02 ` Petr Mladek
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=20171012102419.GE2882@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=tglx@linutronix.de \
/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.