linux/include
Tejun Heo 8d91f8b153 printk: do cond_resched() between lines while outputting to consoles
@console_may_schedule tracks whether console_sem was acquired through
lock or trylock.  If the former, we're inside a sleepable context and
console_conditional_schedule() performs cond_resched().  This allows
console drivers which use console_lock for synchronization to yield
while performing time-consuming operations such as scrolling.

However, the actual console outputting is performed while holding
irq-safe logbuf_lock, so console_unlock() clears @console_may_schedule
before starting outputting lines.  Also, only a few drivers call
console_conditional_schedule() to begin with.  This means that when a
lot of lines need to be output by console_unlock(), for example on a
console registration, the task doing console_unlock() may not yield for
a long time on a non-preemptible kernel.

If this happens with a slow console devices, for example a serial
console, the outputting task may occupy the cpu for a very long time.
Long enough to trigger softlockup and/or RCU stall warnings, which in
turn pile more messages, sometimes enough to trigger the next cycle of
warnings incapacitating the system.

Fix it by making console_unlock() insert cond_resched() between lines if
@console_may_schedule.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Calvin Owens <calvinowens@fb.com>
Acked-by: Jan Kara <jack@suse.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Kyle McMartin <kyle@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-16 11:17:25 -08:00
..
acpi Merge branches 'acpi-scan', 'acpi-bus', 'acpi-osl' and 'acpi-pm' 2016-01-12 01:10:03 +01:00
asm-generic asm/sections: add helpers to check for section data 2016-01-16 11:17:24 -08:00
clocksource arm64: KVM: Implement timer save/restore 2015-12-14 11:30:39 +00:00
crypto crypto: hash - add zero length message hash for shax and md5 2015-12-22 20:43:35 +08:00
drm drm/nouveau: Fix pre-nv50 pageflip events (v4) 2015-12-04 13:49:38 +10:00
dt-bindings Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2016-01-14 17:04:19 -08:00
keys
kvm KVM: arm/arm64: vgic-v3: Make the LR indexing macro public 2015-12-14 11:30:38 +00:00
linux printk: do cond_resched() between lines while outputting to consoles 2016-01-16 11:17:25 -08:00
math-emu
media [media] media-entitiy: add a function to create multiple links 2016-01-11 12:19:26 -02:00
memory
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-01-15 13:33:12 -08:00
pcmcia
ras
rdma IB/mad: Require CM send method for everything except ClassPortInfo 2015-12-08 12:19:11 -05:00
rxrpc
scsi Merge branch 'jejb-scsi' into misc 2016-01-07 15:51:13 -08:00
soc QE: Move QE from arch/powerpc to drivers/soc 2015-12-22 17:12:56 -06:00
sound Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus 2016-01-05 23:07:32 +00:00
target target: Fix race for SCF_COMPARE_AND_WRITE_POST checking 2015-11-28 19:33:15 -08:00
trace khugepaged: ignore pmd tables with THP mapped with ptes 2016-01-15 17:56:32 -08:00
uapi arch/*/include/uapi/asm/mman.h: : let MADV_FREE have same value for all architectures 2016-01-15 17:56:32 -08:00
video gpu: ipu-v3: drop unused dmfc field from client platform data 2015-11-24 11:30:15 +01:00
xen xen: introduce XENPF_settime64 2015-12-21 14:40:57 +00:00
Kbuild