From: Petr Mladek <pmladek@suse.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] printk: Correctly handle preemption in console_unlock()
Date: Thu, 02 Feb 2017 16:40:12 +0000 [thread overview]
Message-ID: <20170202164012.GI23754@pathway.suse.cz> (raw)
In-Reply-To: <20170202093011.1e067ea7@gandalf.local.home>
On Thu 2017-02-02 09:30:11, Steven Rostedt wrote:
> On Wed, 25 Jan 2017 15:08:45 +0100
> Petr Mladek <pmladek@suse.com> wrote:
>
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index 7180088cbb23..cc90c0a5ae21 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -2158,19 +2158,18 @@ void console_unlock(void)
> > }
> >
> > /*
> > - * Console drivers are called under logbuf_lock, so
> > - * @console_may_schedule should be cleared before; however, we may
> > - * end up dumping a lot of lines, for example, if called from
> > - * console registration path, and should invoke cond_resched()
> > - * between lines if allowable. Not doing so can cause a very long
> > - * scheduling stall on a slow console leading to RCU stall and
> > - * softlockup warnings which exacerbate the issue with more
> > - * messages practically incapacitating the system.
>
> Why did you remove the comment about invoking cond_resched()? It's
> still pertinent to the code, as there still exists a:
>
> if (do_cond_resched)
> cond_resched();
>
> And the rational in the comment is still correct.
The comment was above an assignment to a variable called
"do_cond_resched". The variable was later used only on one place.
I hoped that the purpose of cond_resched() was a common knowledge.
The new comment still mentions scheduling between lines. But it
newly explains why it has to be done here and the relation to
the "again" label.
Would you prefer to keep the original text as is (modulo the context
in which the drivers are called) and just add the second paragraph?
Anyway, thank a lot for review.
Best Regards,
Petr
> -- Steve
>
> > + * Console drivers are called with interrupts disabled, so
> > + * @console_may_schedule must be cleared before. The original
> > + * value must be stored so that we could schedule between lines.
> > + *
> > + * console_trylock() is not able to detect the preemtible
> > + * context reliably. Therefore the value must be stored before
> > + * and cleared after the the "again" goto label.
> > */
> > do_cond_resched = console_may_schedule;
> > +again:
> > console_may_schedule = 0;
> >
> > -again:
> > /*
> > * We released the console_sem lock, so we need to recheck if
> > * cpu is online and (if not) is there at least one CON_ANYTIME
>
next prev parent reply other threads:[~2017-02-02 16:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 14:08 [PATCH v2] printk: Correctly handle preemption in console_unlock() Petr Mladek
2017-02-02 13:31 ` Sergey Senozhatsky
2017-02-02 14:30 ` Steven Rostedt
2017-02-02 16:40 ` Petr Mladek [this message]
2017-03-24 16:14 ` [PATCH v3] " Petr Mladek
2017-03-24 23:57 ` 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=20170202164012.GI23754@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=peterz@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).