public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH  5.10-rt] printk: ignore that console preempted by irq/softirq
@ 2024-05-23 15:55 xu.xin16
  2024-05-26 17:46 ` John Ogness
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: xu.xin16 @ 2024-05-23 15:55 UTC (permalink / raw)
  To: bigeasy, john.ogness, rostedt
  Cc: zhang.yunkai, yang.yang29, liu.chun2, si.hao, linux-kernel,
	linux-rt-users, rostedt, xu.xin16

From: xu xin <xu.xin16@zte.com.cn>

When we're in the unpreemptible context on the same cpu with which the
thread of console locates on, we should ignore this console for
pr_flush, because it's a vain and always lead to timeout until the console
thread get cpu resource.

Fixes: e65be5f4dc3ed("printk: Update John Ogness' printk series")
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Cc: Zhang Yunkai <zhang.yunkai@zte.com.cn>
---
kernel/printk/printk.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 7f27cfee283e..faab85dd4439 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3735,6 +3735,14 @@ bool pr_flush(int timeout_ms, bool reset_on_progress)
diff = 0;

for_each_console(con) {
+ /*
+ * When we're in the unpreemptible context on the same cpu
+ * with which the thread of console locates on, we should
+ * ignore this console, because it's a vain.
+ */
+ if (!preemptible() && con->thread &&
+ task_cpu(con->thread) == smp_processor_id())
+ continue;
if (!(con->flags & CON_ENABLED))
continue;
printk_seq = read_console_seq(con);
--
2.15.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-12 14:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 15:55 [PATCH 5.10-rt] printk: ignore that console preempted by irq/softirq xu.xin16
2024-05-26 17:46 ` John Ogness
2024-05-27  9:24 ` Sebastian Andrzej Siewior
2024-05-28  6:40 ` xu xin
2024-05-28 15:29   ` Sebastian Andrzej Siewior
2024-06-03 20:11     ` John Ogness
2024-06-12 14:33       ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox