Skip to contentSkip to conversation

2.6.33.6-rt26: consoles not working properly

DISCUSSION Mike Galbraith 2 participants 4 messages Jul 23, 2010 – Jul 28, 2010

lore
Share & tools
lore
#0 lore raw

Greetings,

Consoles (serial and vt) are going silent after.

[    1.100178] Freeing initrd memory: 9348k freed
[    1.453009] Freeing unused kernel memory: 1000k freed
[    1.464463] Freeing unused kernel memory: 512k freed
[    1.469724] Freeing unused kernel memory: 360k freed

If the kernel is configured PREEMPT_VOLUNTARY, consoles work fine again. So far, I've only eyeballed the rt patch, and noticed nothing. I'll be poking around in (shudder) console code soon I suppose, but before I start that.. adventure, is this a known issue?

-Mike

#1 lore raw
Quoted 9 lines · Mike Galbraith

Greetings,

Consoles (serial and vt) are going silent after.

[    1.100178] Freeing initrd memory: 9348k freed
[    1.453009] Freeing unused kernel memory: 1000k freed
[    1.464463] Freeing unused kernel memory: 512k freed
[    1.469724] Freeing unused kernel memory: 360k freed
Quoted 4 lines

If the kernel is configured PREEMPT_VOLUNTARY, consoles work fine again. So far, I've only eyeballed the rt patch, and noticed nothing. I'll be poking around in (shudder) console code soon I suppose, but before I start that.. adventure, is this a known issue?

Hm, that was suspiciously easy.

console: really enable interrupts in release_console_mutex()

vprintk()
raw_local_irq_save()
acquire_console_mutex_for_printk()
release_console_mutex()
raw_spin_unlock_save()
raw_spin_unlock_irqrestore()
call_console_drivers()
_call_console_drivers()
__call_console_drivers()
console_atomic_safe() "nope".

---
 kernel/printk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk.c +1 -1
Index: tip-rt/kernel/printk.c
===================================================================
@@ -1072,7 +1072,7 @@ void release_console_mutex(void)
 		 * with interrupts disabled):
 		 */
 #ifdef CONFIG_PREEMPT_RT
-		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+		raw_spin_unlock_irq(&logbuf_lock);
 #else
 		raw_spin_unlock(&logbuf_lock);
 		stop_critical_timings();	/* don't trace print latency */
#2 lore raw
Quoted 41 lines · Mike Galbraith
Quoted 9 lines · Mike Galbraith

Greetings,

Consoles (serial and vt) are going silent after.

[    1.100178] Freeing initrd memory: 9348k freed
[    1.453009] Freeing unused kernel memory: 1000k freed
[    1.464463] Freeing unused kernel memory: 512k freed
[    1.469724] Freeing unused kernel memory: 360k freed
Quoted 4 lines

If the kernel is configured PREEMPT_VOLUNTARY, consoles work fine again. So far, I've only eyeballed the rt patch, and noticed nothing. I'll be poking around in (shudder) console code soon I suppose, but before I start that.. adventure, is this a known issue?

Hm, that was suspiciously easy.

console: really enable interrupts in release_console_mutex()

vprintk()
raw_local_irq_save()
acquire_console_mutex_for_printk()
release_console_mutex()
raw_spin_unlock_save()
raw_spin_unlock_irqrestore()
call_console_drivers()
_call_console_drivers()
__call_console_drivers()
console_atomic_safe() "nope".

---
 kernel/printk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: tip-rt/kernel/printk.c
===================================================================

kernel/printk.c void release_console_mutex(void) · line 1075

Quoted 5 lines
kernel/printk.c +1 -1
@@ -1072,7 +1072,7 @@ void release_console_mutex(void)
 		 * with interrupts disabled):
 		 */
 #ifdef CONFIG_PREEMPT_RT
-		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+		raw_spin_unlock_irq(&logbuf_lock);

Not really a good idea. If printk is called from an irq disabled region, then we unconditionally enabled interrupts here. The comment above this is misleading and needs to be removed. We had problems in that area before. Does the following patch solve your problem as well ?

Thanks,

tglx

kernel/printk.c +4 -1
index bbce874..3b22cf4 100644
@@ -797,8 +797,11 @@ asmlinkage int vprintk(const char *fmt, va_list args)
 	 * will release 'logbuf_lock' regardless of whether it
 	 * actually gets the mutex or not.
 	 */
-	if (acquire_console_mutex_for_printk(this_cpu))
+	if (acquire_console_mutex_for_printk(this_cpu)) {
+		raw_local_irq_restore(flags);
 		release_console_mutex();
+		raw_local_irq_save(flags);
+	}
 
 	lockdep_on();
 out:
#3 lore raw
Quoted 38 lines · Thomas Gleixner
Quoted 36 lines · Mike Galbraith
Quoted 9 lines · Mike Galbraith

Greetings,

Consoles (serial and vt) are going silent after.

[    1.100178] Freeing initrd memory: 9348k freed
[    1.453009] Freeing unused kernel memory: 1000k freed
[    1.464463] Freeing unused kernel memory: 512k freed
[    1.469724] Freeing unused kernel memory: 360k freed
Quoted 4 lines

If the kernel is configured PREEMPT_VOLUNTARY, consoles work fine again. So far, I've only eyeballed the rt patch, and noticed nothing. I'll be poking around in (shudder) console code soon I suppose, but before I start that.. adventure, is this a known issue?

Hm, that was suspiciously easy.

console: really enable interrupts in release_console_mutex()

vprintk()
raw_local_irq_save()
acquire_console_mutex_for_printk()
release_console_mutex()
raw_spin_unlock_save()
raw_spin_unlock_irqrestore()
call_console_drivers()
_call_console_drivers()
__call_console_drivers()
console_atomic_safe() "nope".

---
 kernel/printk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

kernel/printk.c void release_console_mutex(void) · line 1075

Quoted 10 lines

Index: tip-rt/kernel/printk.c
===================================================================

kernel/printk.c +1 -1
@@ -1072,7 +1072,7 @@ void release_console_mutex(void)
 		 * with interrupts disabled):
 		 */
 #ifdef CONFIG_PREEMPT_RT
-		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+		raw_spin_unlock_irq(&logbuf_lock);

Not really a good idea. If printk is called from an irq disabled region, then we unconditionally enabled interrupts here. The comment above this is misleading and needs to be removed. We had problems in that area before. Does the following patch solve your problem as well ?

Aha. Yes, it does.

-Mike