lkml.org 
[lkml]   [2012]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] clocksource, prevent overflow in clocksource_cyc2ns
> 
> So what kernel version are you using?

I retested using top of the linux.git tree, running

echo 1 > /proc/sys/kernel/sysrq
for i in `seq 10000`; do sleep 1000 & done
echo t > /proc/sysrq-trigger

and I no longer see a problem. However, if I increase the number of threads to
1000/cpu I get

Clocksource %s unstable (delta = -429565427)
Clocksource switching to hpet

> to narrow down if you're problem is currently present in mainline or only in
> older kernels, as that will help us find the proper fix.

If I hack in (sorry for the cut-and-paste)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c958338..f38b8d0 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -279,11 +279,16 @@ static void clocksource_watchdog(unsigned long data)
continue;
}

- wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog->m
- watchdog->mult, watchdog->shift);
+ /*wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog-
+ watchdog->mult, watchdog->shift);*/
+ wd_nsec = mult_frac(((wdnow - cs->wd_last), watchdog->mult,
+ 1UL << watchdog->shift);
+
+ /*cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) &
+ cs->mask, cs->mult, cs->shift);*/
+ cs_nsec = mult_frac(((csnow - cs->cs_last), cs->mult,
+ 1UL << cs->shift);

- cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) &
- cs->mask, cs->mult, cs->shift);
cs->cs_last = csnow;
cs->wd_last = wdnow;

then I don't see unstable messages.

I think the problem is still here but it only happens in extreme cases.

P.


\
 
 \ /
  Last update: 2012-04-05 14:31    [W:0.139 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site