From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Tejun Heo <tj@kernel.org>,
lkp@01.org, LKML <linux-kernel@vger.kernel.org>,
Kyle McMartin <kyle@kernel.org>,
Dave Jones <davej@codemonkey.org.uk>, Jan Kara <jack@suse.com>,
Calvin Owens <calvinowens@fb.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
kernel test robot <ying.huang@linux.intel.com>,
kernel-team@fb.com,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCH] printk: clear console_may_schedule on panic flushing
Date: Tue, 12 Jan 2016 22:50:59 +0900 [thread overview]
Message-ID: <20160112135059.GA670@swordfish> (raw)
In-Reply-To: <20160111135951.b5f81c02c6d2054164f618af@linux-foundation.org>
On (01/11/16 13:59), Andrew Morton wrote:
> > Commit "printk: do cond_resched() between lines while outputting to
> > consoles" made console flushing perform cond_resched() after each line
> > if the context allows as determined by whether the console lock was
> > acquired with console_lock(). The condition is carried in
> > console_may_schedule.
> >
> > During panic, console lock status is ignored and the messages are
> > forcifully flushed which is implemented by performing
> > console_trylock(); console_unlock(); sequence ignoring whether trylock
> > succeeds or fails. This means that the emergency flushing, after
> > trylock failure, may enter flushing path with console_may_schedule set
> > from the actual holder.
> >
> > As a system may panic from any context, this can lead to
> > cond_resched() being invoked from a non-sleepable context triggering
> > an extra warning dump while panicking which is noisy and can be
> > confusing. Besides, even when panicking from a sleepable context, we
> > don't want to be yielding during emergency message dumping.
> >
> > Currently, the emergency dumping is opencoded in panic(). This patch
> > replaces the open coded implementation with a new function,
> > console_flush_on_panic() and makes it explicitly clear
> > console_may_schedule before starting the emergency flushing.
> >
>
> Got that, thanks. Because the patch has significant information
> content I'd normally make it a standalone thing, but as it's destined
> for -stable I think I'll scrunch it into
> printk-do-cond_resched-between-lines-while-outputting-to-consoles.patch
> and merge the changelogs.
>
> You didn't comment on Sergey's observations
> (https://lkml.org/lkml/2015/12/2/1192), but I'm believing this is
> a separate issue and that this patch is still good.
Thanks for Cc-ing.
Yes, this problem is different.
FWIW,
what I ended up implementing in my private builds is a bit different
thing -- I added a new console_panic_mode() function which basically
calls zap_locks(). The reason I did it this way was that console_unlock()
can potentially have other locks in it some day, not just `console_sem'.
For example, like in one of Jan's deferred printk implementations. Sort
of a defensive move to avoid possible problems.
-ss
prev parent reply other threads:[~2016-01-12 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 3:08 [lkp] [printk] db43e77a44: BUG: sleeping function called from invalid context at kernel/printk/printk.c:2328 kernel test robot
2016-01-11 18:43 ` [PATCH] printk: clear console_may_schedule on panic flushing Tejun Heo
2016-01-11 21:59 ` Andrew Morton
2016-01-11 22:09 ` Tejun Heo
2016-01-11 22:25 ` Tejun Heo
2016-01-12 13:50 ` Sergey Senozhatsky [this message]
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=20160112135059.GA670@swordfish \
--to=sergey.senozhatsky@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=calvinowens@fb.com \
--cc=davej@codemonkey.org.uk \
--cc=jack@suse.com \
--cc=kernel-team@fb.com \
--cc=kyle@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@01.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sfr@canb.auug.org.au \
--cc=tj@kernel.org \
--cc=ying.huang@linux.intel.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