[patch] hrtimers: add state tracking, fix

From: Ingo Molnar
Date: Tue Dec 19 2006 - 14:59:25 EST



* Tilman Schmidt <tilman@xxxxxxx> wrote:

> I tried kernel 2.6.20-rc1-mm1 with the "tickless" option on my P3/933
> but it has now for the second time in a row caused a system freeze as
> soon as I left the system idle for a couple of hours. The second time
> I was warned and switched to a text console before I left the system,
> and was able to collect this BUG message (copied manually, beware of
> typos):
>
> EFLAGS: 00200082 (2.6.20-rc1-mm1-noinitrd #0)
> EIP is at __rb_rotate_right+0x1/0x54
[...]
> Call Trace:
> [<c021d049>] rb_insert_color+0x55/0xbe
> [<c012d15b>] enqueue_hrtimer+0x10a/0x116
> [<c012d9b4>] hrtimer_start+0x78/0x93

thanks for the report - this made me review the hrtimer state engine
logic, and bingo, it indeed has a nasty typo! Could you try the fix
below, does it fix your problem? It might explain the crash you are
seeing, because the typo means we'd ignore HRTIMER_STATE_PENDING state
(which is rare but possible).

Ingo

-------------------------->
Subject: [patch] hrtimers: add state tracking, fix
From: Ingo Molnar <mingo@xxxxxxx>

fix bug in hrtimer_is_queued(), introduced by a cleanup during
the recent refactoring.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
kernel/hrtimer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/kernel/hrtimer.c
===================================================================
--- linux.orig/kernel/hrtimer.c
+++ linux/kernel/hrtimer.c
@@ -157,7 +157,7 @@ static void hrtimer_get_softirq_time(str
static inline int hrtimer_is_queued(struct hrtimer *timer)
{
return timer->state &
- (HRTIMER_STATE_ENQUEUED || HRTIMER_STATE_PENDING);
+ (HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING);
}

/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/