* [PATCH printk v1] printk: Avoid irq_work for printk_deferred() on suspend
@ 2025-11-21 10:20 John Ogness
2025-11-21 15:55 ` Petr Mladek
2025-11-21 16:07 ` Petr Mladek
0 siblings, 2 replies; 3+ messages in thread
From: John Ogness @ 2025-11-21 10:20 UTC (permalink / raw)
To: Petr Mladek
Cc: Sergey Senozhatsky, Steven Rostedt, Sherry Sun, Jacky Bai,
Jon Hunter, Thierry Reding, Derek Barbosa, linux-kernel
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/87fra90xv4.fsf@jogness.linutronix.de
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
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 b1c0d35cf3caa..c27fc7fc64eb5 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2393,7 +2393,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;
}
base-commit: 26873e3e7f0cb26c45e6ad63656f9fe36b2aa31b
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH printk v1] printk: Avoid irq_work for printk_deferred() on suspend
2025-11-21 10:20 [PATCH printk v1] printk: Avoid irq_work for printk_deferred() on suspend John Ogness
@ 2025-11-21 15:55 ` Petr Mladek
2025-11-21 16:07 ` Petr Mladek
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2025-11-21 15:55 UTC (permalink / raw)
To: John Ogness
Cc: Sergey Senozhatsky, Steven Rostedt, Sherry Sun, Jacky Bai,
Jon Hunter, Thierry Reding, Derek Barbosa, linux-kernel
On Fri 2025-11-21 11:26:00, John Ogness wrote:
> 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/87fra90xv4.fsf@jogness.linutronix.de
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
Thanks for catching and fixing the problem:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH printk v1] printk: Avoid irq_work for printk_deferred() on suspend
2025-11-21 10:20 [PATCH printk v1] printk: Avoid irq_work for printk_deferred() on suspend John Ogness
2025-11-21 15:55 ` Petr Mladek
@ 2025-11-21 16:07 ` Petr Mladek
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2025-11-21 16:07 UTC (permalink / raw)
To: John Ogness
Cc: Sergey Senozhatsky, Steven Rostedt, Sherry Sun, Jacky Bai,
Jon Hunter, Thierry Reding, Derek Barbosa, linux-kernel
On Fri 2025-11-21 11:26:00, John Ogness wrote:
> 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/87fra90xv4.fsf@jogness.linutronix.de
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
JFYI, the patch has been committed into printk/linux.git,
branch rework/suspend-fixes.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-21 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 10:20 [PATCH printk v1] printk: Avoid irq_work for printk_deferred() on suspend John Ogness
2025-11-21 15:55 ` Petr Mladek
2025-11-21 16:07 ` Petr Mladek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox