Skip to contentSkip to conversation

Rework async printk conditions

RFC PATCH In review Jan Kiszka 2 participants 2 messages Oct 1, 2008 – Oct 19, 2008

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

RFC PATCH 1/1 Rework async printk conditions

Some ad-hoc instrumentation of Xenomai code running over the root domain but with the head domain stalled (nklock held) triggered the new topmost-stalled warning for me.

So I reworked the condition for doing async (ipipe-buffered) printk as follows:
no oops in progress AND
domain did not request sync printk AND
(domain != root OR
(domain == root AND some higher domain stalled))

Makes sense?

Jan

---
 kernel/printk.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
kernel/printk.c +20 -4
Index: b/kernel/printk.c
===================================================================
@@ -641,17 +641,33 @@ void __ipipe_flush_printk (unsigned virq
 
 asmlinkage int printk(const char *fmt, ...)
 {
-  	int r, fbytes, oldcount, cs = -1;
-    	unsigned long flags;
+	int r, fbytes, oldcount;
+	int sprintk = 1;
+	int cs = -1;
+	unsigned long flags;
 	va_list args;
 
 	va_start(args, fmt);
 
-	if (test_bit(IPIPE_SPRINTK_FLAG,&ipipe_current_domain->flags) ||
+	if (test_bit(IPIPE_SPRINTK_FLAG, &ipipe_current_domain->flags) ||
 	    oops_in_progress)
 		cs = ipipe_disable_context_check(ipipe_processor_id());
+	else if (ipipe_current_domain == ipipe_root_domain) {
+		struct ipipe_domain *dom;
 
-	if (ipipe_current_domain == ipipe_root_domain || cs != -1) {
+		local_irq_save_hw(flags);
+		list_for_each_entry(dom, &__ipipe_pipeline, p_link) {
+			if (dom == ipipe_root_domain)
+				break;
+			if (test_bit(IPIPE_STALL_FLAG,
+				     &ipipe_cpudom_var(dom, status)))
+				sprintk = 0;
+		}
+		local_irq_restore_hw(flags);
+	} else
+		sprintk = 0;
+
+	if (sprintk) {
 		r = vprintk(fmt, args);
 		if (cs != -1)
 			ipipe_restore_context_check(ipipe_processor_id(), cs);
#1 lore raw
Quoted 4 lines · Jan Kiszka

Some ad-hoc instrumentation of Xenomai code running over the root domain but with the head domain stalled (nklock held) triggered the new topmost-stalled warning for me.

Quoted 9 lines

So I reworked the condition for doing async (ipipe-buffered) printk as follows:
no oops in progress AND
domain did not request sync printk AND
(domain != root OR
(domain == root AND some higher domain stalled))

Makes sense?

Yes it does. Merged, thanks.

Quoted 54 lines

Jan

---
 kernel/printk.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

Index: b/kernel/printk.c
===================================================================

kernel/printk.c +20 -4
@@ -641,17 +641,33 @@ void __ipipe_flush_printk (unsigned virq
 
 asmlinkage int printk(const char *fmt, ...)
 {
-  	int r, fbytes, oldcount, cs = -1;
-    	unsigned long flags;
+	int r, fbytes, oldcount;
+	int sprintk = 1;
+	int cs = -1;
+	unsigned long flags;
 	va_list args;
 
 	va_start(args, fmt);
 
-	if (test_bit(IPIPE_SPRINTK_FLAG,&ipipe_current_domain->flags) ||
+	if (test_bit(IPIPE_SPRINTK_FLAG, &ipipe_current_domain->flags) ||
 	    oops_in_progress)
 		cs = ipipe_disable_context_check(ipipe_processor_id());
+	else if (ipipe_current_domain == ipipe_root_domain) {
+		struct ipipe_domain *dom;
 
-	if (ipipe_current_domain == ipipe_root_domain || cs != -1) {
+		local_irq_save_hw(flags);
+		list_for_each_entry(dom, &__ipipe_pipeline, p_link) {
+			if (dom == ipipe_root_domain)
+				break;
+			if (test_bit(IPIPE_STALL_FLAG,
+				     &ipipe_cpudom_var(dom, status)))
+				sprintk = 0;
+		}
+		local_irq_restore_hw(flags);
+	} else
+		sprintk = 0;
+
+	if (sprintk) {
 		r = vprintk(fmt, args);
 		if (cs != -1)
 			ipipe_restore_context_check(ipipe_processor_id(), cs);

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Signature · 1 line
Philippe.