Re: 2.6.17-mm2 hrtimer code wedges at boot?

From: john stultz
Date: Thu Jul 06 2006 - 01:42:18 EST


On Wed, 2006-07-05 at 18:12 -0700, john stultz wrote:
> On Wed, 2006-07-05 at 17:51 -0700, john stultz wrote:
> > I quickly revived my P-D adjustment patch and it does not appear to
> > suffer from the same problem with the above droptick change (although
> > its only been lightly tested).
> >
> > I realize you may have a more trivial change to this issue, but would
> > you consider my method again?
> >
> > Vladis: Mind trying the following patch to see if it affects the
> > behavior.
>
> Bah! Never mind. Don't bother, trying it.

I take that back. :)

Vladis, would you still try that patch to see if it helps?


> Of course, only after I send the mail, the same problem reproduces
> itself w/ my patch!

In my rush to finish up for dinner, I fat-fingered the droptick code
(forgot the static!) so I wasn't ever get timer ticks. :(

Then after I fixed that, I noticed long-ish stalls starting X or
switching between X and VT consoles. However after digging into it I
realized the issue is that xtime is only being updated every 100 ticks,
and nanosleep used xtime (via hrtimers), so it was getting the extra
100tick latency on every call.

So just to be fair, I double checked the following patch against
mainline, saw the hang Vladis was seeing, then applied it to my earlier
patch along with this patch and the system booted fine w/ no stalls.

thanks
-john


Patch to trigger the boot hang against vanilla 2.6.18-rc1

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index d17766d..3f516f6 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -132,7 +132,7 @@ static void hrtimer_get_softirq_time(str

do {
seq = read_seqbegin(&xtime_lock);
- xtim = timespec_to_ktime(xtime);
+ xtim = ktime_get_real();
tomono = timespec_to_ktime(wall_to_monotonic);

} while (read_seqretry(&xtime_lock, seq));
diff --git a/kernel/timer.c b/kernel/timer.c
index 396a3c0..5394104 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1090,6 +1090,9 @@ static void clocksource_adjust(struct cl
static void update_wall_time(void)
{
cycle_t offset;
+ static int droptick;
+ if(droptick++%100)
+ return;

clock->xtime_nsec += (s64)xtime.tv_nsec << clock->shift;



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