From: John Ogness <[email protected]>

[ Upstream commit 66e7c1e0ee08cfb6db64f8f3f6e5a3cc930145c8 ]

With commit ("printk: Avoid scheduling irq_work on suspend") the
implementation of printk_get_console_flush_type() was modified to
avoid offloading when irq_work should be blocked during suspend.
Since printk uses the returned flush type to determine what
flushing methods are used, this was thought to be sufficient for
avoiding irq_work usage during the suspend phase.

However, vprintk_emit() implements a hack to support
printk_deferred(). In this hack, the returned flush type is
adjusted to make sure no legacy direct printing occurs when
printk_deferred() was used.

Because of this hack, the legacy offloading flushing method can
still be used, causing irq_work to be queued when it should not
be.

Adjust the vprintk_emit() hack to also consider
@console_irqwork_blocked so that legacy offloading will not be
chosen when irq_work should be blocked.

Link: https://lore.kernel.org/lkml/[email protected]
Signed-off-by: John Ogness <[email protected]>
Fixes: 26873e3e7f0c ("printk: Avoid scheduling irq_work on suspend")
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
---
 kernel/printk/printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 9d46876b8817..5a2d1035626b 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2377,7 +2377,7 @@ asmlinkage int vprintk_emit(int facility, int level,
        /* If called from the scheduler, we can not call up(). */
        if (level == LOGLEVEL_SCHED) {
                level = LOGLEVEL_DEFAULT;
-               ft.legacy_offload |= ft.legacy_direct;
+               ft.legacy_offload |= ft.legacy_direct && 
!console_irqwork_blocked;
                ft.legacy_direct = false;
        }
 
-- 
2.49.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16263): 
https://lists.yoctoproject.org/g/linux-yocto/message/16263
Mute This Topic: https://lists.yoctoproject.org/mt/117611995/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to