The Linux Kernel Mailing List
 help / color / mirror / Atom feed
*  [PATCH  5.15-rt] printk: ignore that console preempted by irq/softirq.
@ 2024-05-23 15:54 xu.xin16
  2024-05-23 16:04 ` xu xin
  2024-05-26 17:50 ` [PATCH " John Ogness
  0 siblings, 2 replies; 3+ messages in thread
From: xu.xin16 @ 2024-05-23 15:54 UTC (permalink / raw)
  To: bigeasy, john.ogness, rostedt
  Cc: zhang.yunkai, yang.yang29, liu.chun2, si.hao, linux-kernel,
	linux-rt-users, rostedt

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] 3+ messages in thread

* Re:[PATCH  5.15-rt] printk: ignore that console preempted by irq/softirq.
  2024-05-23 15:54 [PATCH 5.15-rt] printk: ignore that console preempted by irq/softirq xu.xin16
@ 2024-05-23 16:04 ` xu xin
  2024-05-26 17:50 ` [PATCH " John Ogness
  1 sibling, 0 replies; 3+ messages in thread
From: xu xin @ 2024-05-23 16:04 UTC (permalink / raw)
  To: xu.xin16
  Cc: bigeasy, john.ogness, linux-kernel, linux-rt-users, liu.chun2,
	rostedt, si.hao, yang.yang29, zhang.yunkai

Sorry, this is wrong subject. ignore this, it should have been to 5.10-rt

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

* Re:  [PATCH  5.15-rt] printk: ignore that console preempted by irq/softirq.
  2024-05-23 15:54 [PATCH 5.15-rt] printk: ignore that console preempted by irq/softirq xu.xin16
  2024-05-23 16:04 ` xu xin
@ 2024-05-26 17:50 ` John Ogness
  1 sibling, 0 replies; 3+ messages in thread
From: John Ogness @ 2024-05-26 17:50 UTC (permalink / raw)
  To: xu.xin16, bigeasy, rostedt
  Cc: zhang.yunkai, yang.yang29, liu.chun2, si.hao, linux-kernel,
	linux-rt-users, rostedt

On 2024-05-23, <xu.xin16@zte.com.cn> wrote:
> 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>

Reviewed-by: John Ogness <john.ogness@linutronix.de>

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

end of thread, other threads:[~2024-05-26 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 15:54 [PATCH 5.15-rt] printk: ignore that console preempted by irq/softirq xu.xin16
2024-05-23 16:04 ` xu xin
2024-05-26 17:50 ` [PATCH " John Ogness

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