Skip to contentSkip to conversation

rtc: lockdep fix/workaround

PATCH In review Peter Zijlstra 3 participants 4 messages Sep 19, 2006 – Sep 20, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: lockdep fix/workaround

BUG: warning at kernel/lockdep.c:1816/trace_hardirqs_on() (Not tainted)
 [<c04051ee>] show_trace_log_lvl+0x58/0x171
 [<c0405802>] show_trace+0xd/0x10
 [<c040591b>] dump_stack+0x19/0x1b
 [<c043abee>] trace_hardirqs_on+0xa2/0x11e
 [<c06143c3>] _spin_unlock_irq+0x22/0x26
 [<c0541540>] rtc_get_rtc_time+0x32/0x176
 [<c0419ba4>] hpet_rtc_interrupt+0x92/0x14d
 [<c0450f94>] handle_IRQ_event+0x20/0x4d
 [<c0451055>] __do_IRQ+0x94/0xef
 [<c040678d>] do_IRQ+0x9e/0xbd
 [<c0404a49>] common_interrupt+0x25/0x2c
DWARF2 unwinder stuck at common_interrupt+0x25/0x2c
---
 drivers/char/rtc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/rtc.c +3 -2
Index: linux-2.6.17.noarch/drivers/char/rtc.c
===================================================================
@@ -209,11 +209,12 @@ static const unsigned char days_in_mo[] 
  */
 static inline unsigned char rtc_is_updating(void)
 {
+	unsigned long flags;
 	unsigned char uip;
 
-	spin_lock_irq(&rtc_lock);
+	spin_lock_irqsave(&rtc_lock, flags);
 	uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
-	spin_unlock_irq(&rtc_lock);
+	spin_unlock_irqrestore(&rtc_lock, flags);
 	return uip;
 }
 
Acked-by on v1 1/1
#1 lore raw

Re: [PATCH] rtc: lockdep fix

Quoted 4 lines · Peter Zijlstra
BUG: warning at kernel/lockdep.c:1816/trace_hardirqs_on() (Not tainted)
 [<c04051ee>] show_trace_log_lvl+0x58/0x171
 [<c0405802>] show_trace+0xd/0x10
 [<c040591b>] dump_stack+0x19/0x1b
Quoted 8 lines
 [<c043abee>] trace_hardirqs_on+0xa2/0x11e
 [<c06143c3>] _spin_unlock_irq+0x22/0x26
 [<c0541540>] rtc_get_rtc_time+0x32/0x176
 [<c0419ba4>] hpet_rtc_interrupt+0x92/0x14d
 [<c0450f94>] handle_IRQ_event+0x20/0x4d
 [<c0451055>] __do_IRQ+0x94/0xef
 [<c040678d>] do_IRQ+0x9e/0xbd
 [<c0404a49>] common_interrupt+0x25/0x2c

ouch! That is a scenario that could lead to real lockups. Fix looks good and necessary for v2.6.18 to me.

Quoted 1 line

Ingo

#2 lore raw

Re: [PATCH] rtc: lockdep fix

Quoted 15 lines · Ingo Molnar
Quoted 4 lines · Peter Zijlstra
BUG: warning at kernel/lockdep.c:1816/trace_hardirqs_on() (Not tainted)
 [<c04051ee>] show_trace_log_lvl+0x58/0x171
 [<c0405802>] show_trace+0xd/0x10
 [<c040591b>] dump_stack+0x19/0x1b
Quoted 8 lines
 [<c043abee>] trace_hardirqs_on+0xa2/0x11e
 [<c06143c3>] _spin_unlock_irq+0x22/0x26
 [<c0541540>] rtc_get_rtc_time+0x32/0x176
 [<c0419ba4>] hpet_rtc_interrupt+0x92/0x14d
 [<c0450f94>] handle_IRQ_event+0x20/0x4d
 [<c0451055>] __do_IRQ+0x94/0xef
 [<c040678d>] do_IRQ+0x9e/0xbd
 [<c0404a49>] common_interrupt+0x25/0x2c
Quoted 2 lines

ouch! That is a scenario that could lead to real lockups. Fix looks good and necessary for v2.6.18 to me.

btw this entire code path is evil; the rtc_get_rtc_time() function can do really long delays which is unsuitable for being called in interrupt context!

#3 lore raw

Re: [PATCH] rtc: lockdep fix

Quoted 6 lines · Arjan van de Ven
Quoted 2 lines

ouch! That is a scenario that could lead to real lockups. Fix looks good and necessary for v2.6.18 to me.

btw this entire code path is evil; the rtc_get_rtc_time() function can do really long delays which is unsuitable for being called in interrupt context!

yeah - but i dont think it triggers that often, and a fix for that probably isnt for v2.6.18.

Ingo