[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea6c6a2b5482d62038d7d0a1d46b87665051222f.camel@perches.com>
Date: Tue, 20 Jul 2021 04:55:29 -0700
From: Joe Perches <joe@...ches.com>
To: chao.qin@...el.com, linux-kernel@...r.kernel.org,
linux-rt-users@...r.kernel.org, bigeasy@...utronix.de,
tglx@...utronix.de, john.ogness@...utronix.de, rostedt@...dmis.org
Cc: mgross@...ux.intel.com, paul.mei@...el.com, lili.li@...el.com
Subject: Re: [PREEMPT_RT][PATCH] printk: Enhance the condition check of
msleep in pr_flush()
On Mon, 2021-07-19 at 10:26 +0800, chao.qin@...el.com wrote:
> From: Chao Qin <chao.qin@...el.com>
>
> There is msleep in pr_flush(). If call WARN() in the early boot
> stage such as in early_initcall, pr_flush() will run into msleep
> when process scheduler is not ready yet. And then the system will
> sleep forever.
>
> Before the system_state is SYSTEM_RUNNING, make sure DO NOT sleep
> in pr_flush().
Makes sense, thanks.
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
[]
> @@ -3620,7 +3620,8 @@ bool pr_flush(int timeout_ms, bool reset_on_progress)
> u64 diff;
> u64 seq;
>
> - may_sleep = (preemptible() && !in_softirq());
> + may_sleep = (preemptible() && !in_softirq()
> + && (system_state >= SYSTEM_RUNNING));
trivial style note:
Logic continuations are typically at the end of the previous line.
And there are few too many parentheses for my taste.
Maybe exceed 80 columns in a single line
may_sleep = preemptible() && !in_softirq() && system_state >= SYSTEM_RUNNING;
or align the continuation
may_sleep = (preemptible() && !in_softirq() &&
system_state >= SYSTEM_RUNNING);
or use individual lines
may_sleep = (preemptible() &&
!in_softirq() &&
system_state >= SYSTEM_RUNNING);
Powered by blists - more mailing lists