Skip to contentSkip to conversation

Fixed: line break of pr_cont not take effect in linux-rt

PATCH In review root 2 participants 2 messages May 21, 2020 – May 22, 2020 Printk

lore
Share & tools
lore

root

author
#0 lore raw

PATCH 1/1 Fixed: line break of pr_cont not take effect in linux-rt

From: 汪勇10269566 <[email protected]>

Line break of pr_cont not take effect.
Use several pr_cont to print continuous paragraph, it is expected to have line break when line ends up with '\n', however the paragraph does not have line break
-printk_kthread_func will not print info before log_store insert msg
into printk_rb, and pr_cont calls cont_add to keep data in buffer. cont_add only when the following conditions are met insert msg to printk_rb
1.cpu != c->cpu_owner || !(flags & LOG_CONT)
2.c->len + len > sizeof(c->buf)

---
 kernel/printk/printk.c | 1 +
 1 file changed, 1 insertion(+)
kernel/printk/printk.c +1 -0
index 0605a74..d898f50 100644
@@ -1871,6 +1871,7 @@ static void cont_add(int ctx, int cpu, u32 caller_id, int facility, int level,
 	// but later continuations can add a newline.
 	if (flags & LOG_NEWLINE) {
 		c->flags |= LOG_NEWLINE;
+		cont_flush(ctx);
 	}
 }
 
Signature · 1 line
2.15.2
maintainer
#1 lore raw
Quoted 23 lines · root

From: 汪勇10269566 <[email protected]>

Line break of pr_cont not take effect.
Use several pr_cont to print continuous paragraph, it is expected to have line break when line ends up with '\n', however the paragraph does not have line break
-printk_kthread_func will not print info before log_store insert msg
into printk_rb, and pr_cont calls cont_add to keep data in buffer. cont_add only when the following conditions are met insert msg to printk_rb
1.cpu != c->cpu_owner || !(flags & LOG_CONT)
2.c->len + len > sizeof(c->buf)

---
 kernel/printk/printk.c | 1 +
 1 file changed, 1 insertion(+)
kernel/printk/printk.c +0 -0
index 0605a74..d898f50 100644

kernel/printk/printk.c static void cont_add(int ctx, int cpu, u32 caller_id, int facility, int level, · line 1874

Quoted 4 lines
kernel/printk/printk.c +1 -0
@@ -1871,6 +1871,7 @@ static void cont_add(int ctx, int cpu, u32 caller_id, int facility, int level,
 	// but later continuations can add a newline.
 	if (flags & LOG_NEWLINE) {
 		c->flags |= LOG_NEWLINE;
+		cont_flush(ctx);

What kernel sources is this patch against, please?

The console_flush() call is in the current Linus' tree. It does not have any parameter there. And there is no printk_kthread_func.

Is this against RT patchset?

Best Regards,
Petr