public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: lockdep fix/workaround
@ 2006-09-19 19:54 Peter Zijlstra
  2006-09-20  8:21 ` [PATCH] rtc: lockdep fix Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2006-09-19 19:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Ingo Molnar, Arjan van de Ven


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

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 drivers/char/rtc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.17.noarch/drivers/char/rtc.c
===================================================================
--- linux-2.6.17.noarch.orig/drivers/char/rtc.c	2006-09-18 21:34:11.000000000 +0200
+++ linux-2.6.17.noarch/drivers/char/rtc.c	2006-09-18 21:35:03.000000000 +0200
@@ -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;
 }
 



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

* Re: [PATCH] rtc: lockdep fix
  2006-09-19 19:54 [PATCH] rtc: lockdep fix/workaround Peter Zijlstra
@ 2006-09-20  8:21 ` Ingo Molnar
  2006-09-20  8:49   ` Arjan van de Ven
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2006-09-20  8:21 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel, Andrew Morton, Arjan van de Ven


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> 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

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

> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

Acked-by: Ingo Molnar <mingo@elte.hu>

	Ingo

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

* Re: [PATCH] rtc: lockdep fix
  2006-09-20  8:49   ` Arjan van de Ven
@ 2006-09-20  8:47     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2006-09-20  8:47 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Peter Zijlstra, linux-kernel, Andrew Morton


* Arjan van de Ven <arjan@linux.intel.com> wrote:

> >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

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

* Re: [PATCH] rtc: lockdep fix
  2006-09-20  8:21 ` [PATCH] rtc: lockdep fix Ingo Molnar
@ 2006-09-20  8:49   ` Arjan van de Ven
  2006-09-20  8:47     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Arjan van de Ven @ 2006-09-20  8:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel, Andrew Morton

Ingo Molnar wrote:
> * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> 
>> 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
> 
> 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!

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

end of thread, other threads:[~2006-09-20  8:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-19 19:54 [PATCH] rtc: lockdep fix/workaround Peter Zijlstra
2006-09-20  8:21 ` [PATCH] rtc: lockdep fix Ingo Molnar
2006-09-20  8:49   ` Arjan van de Ven
2006-09-20  8:47     ` Ingo Molnar

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