Commit 8e9bf8b
printk, vt, fbcon: Remove console_conditional_schedule()
do_con_write(), fbcon_redraw.*() invoke console_conditional_schedule()
which is a conditional scheduling point based on printk's internal
variables console_may_schedule. It may only be used if the console lock
is acquired for instance via console_lock() or console_trylock().
Prinkt sets the internal variable to 1 (and allows to schedule)
if the console lock has been acquired via console_lock(). The trylock
does not allow it.
The console_conditional_schedule() invocation in do_con_write() is
invoked shortly before console_unlock().
The console_conditional_schedule() invocation in fbcon_redraw.*()
original from fbcon_scroll() / vt's con_scroll() which originate from a
line feed.
In console_unlock() the variable is set to 0 (forbids to schedule) and
it tries to schedule while making progress printing. This is brand new
compared to when console_conditional_schedule() was added in v2.4.9.11.
In v2.6.38-rc3, console_unlock() (started its existence) iterated over
all consoles and flushed them with disabled interrupts. A scheduling
attempt here was not possible, it relied that a long print scheduled
before console_unlock().
Since commit 8d91f8b ("printk: do cond_resched() between lines
while outputting to consoles"), which appeared in v4.5-rc1,
console_unlock() attempts to schedule if it was allowed to schedule
while during console_lock(). Each record is idealy one line so after
every line feed.
This console_conditional_schedule() is also only relevant on
PREEMPT_NONE and PREEMPT_VOLUNTARY builds. In other configurations
cond_resched() becomes a nop and has no impact.
I'm bringing this all up just proof that it is not required anymore. It
becomes a problem on a PREEMPT_RT build with debug code enabled because
that might_sleep() in cond_resched() remains and triggers a warnings.
This is due to
legacy_kthread_func-> console_flush_one_record -> vt_console_print-> lf
-> con_scroll -> fbcon_scroll
and vt_console_print() acquires a spinlock_t which does not allow a
voluntary schedule. There is no need to fb_scroll() to schedule since
console_flush_one_record() attempts to schedule after each line.
!PREEMPT_RT is not affected because the legacy printing thread is only
enabled on PREEMPT_RT builds.
Therefore I suggest to remove console_conditional_schedule().
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Fixes: 5f53ca3 ("printk: Implement legacy printer kthread for PREEMPT_RT")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Petr Mladek <pmladek@suse.com> # from printk() POV
Signed-off-by: Helge Deller <deller@gmx.de>1 parent 4a16b38 commit 8e9bf8b
4 files changed
Lines changed: 0 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3230 | 3230 | | |
3231 | 3231 | | |
3232 | 3232 | | |
3233 | | - | |
3234 | 3233 | | |
3235 | 3234 | | |
3236 | 3235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1608 | 1608 | | |
1609 | 1609 | | |
1610 | 1610 | | |
1611 | | - | |
1612 | 1611 | | |
1613 | 1612 | | |
1614 | 1613 | | |
1615 | 1614 | | |
1616 | | - | |
1617 | 1615 | | |
1618 | 1616 | | |
1619 | 1617 | | |
| |||
1649 | 1647 | | |
1650 | 1648 | | |
1651 | 1649 | | |
1652 | | - | |
1653 | 1650 | | |
1654 | 1651 | | |
1655 | 1652 | | |
1656 | 1653 | | |
1657 | 1654 | | |
1658 | 1655 | | |
1659 | | - | |
1660 | 1656 | | |
1661 | 1657 | | |
1662 | 1658 | | |
| |||
1704 | 1700 | | |
1705 | 1701 | | |
1706 | 1702 | | |
1707 | | - | |
1708 | 1703 | | |
1709 | 1704 | | |
1710 | 1705 | | |
1711 | 1706 | | |
1712 | 1707 | | |
1713 | | - | |
1714 | 1708 | | |
1715 | 1709 | | |
1716 | 1710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
701 | 700 | | |
702 | 701 | | |
703 | 702 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3416 | 3416 | | |
3417 | 3417 | | |
3418 | 3418 | | |
3419 | | - | |
3420 | | - | |
3421 | | - | |
3422 | | - | |
3423 | | - | |
3424 | | - | |
3425 | | - | |
3426 | | - | |
3427 | | - | |
3428 | | - | |
3429 | | - | |
3430 | | - | |
3431 | | - | |
3432 | | - | |
3433 | | - | |
3434 | | - | |
3435 | 3419 | | |
3436 | 3420 | | |
3437 | 3421 | | |
| |||
0 commit comments