Re: linux-2.6.0-test9-mm3_acpi-pm-monotonic-fix_A0
From: Thomas Schlichter
Date: Wed Nov 19 2003 - 02:36:08 EST
On Tuesday 18 November 2003 23:59, john stultz wrote:
> On Mon, 2003-11-17 at 15:46, Thomas Schlichter wrote:
> > But when booting with the PMTMR clock selected, my Interactivity test
> > fails again. :-( Maybe there is a problem in the PMTMR's monotonic clock
> > part...?!
>
> Good call! I was mis-adding in conversion to nanoseconds. The patch
> below should fix it (Andrew, feel free to ignore this, I'll sync up all
> the acpi-pm changes with you later).
Well, your patch was the correct direction, but it did not completely reach
the target... :-( The 'monotonic_base' variable in the PMTMR stores its value
in microseconds. So the 'base' value has to be convertet to nanoseconds,
too...
A patch that corrects that is attached...
(Btw. another solution would be to store all the values in nanoseconds by
replacing the cyc2us function with a cyc2ns function...)
> Although I'm finding that the sched_clock->monotonic_clock patch doesn't
> look like a win. With that patch sched_clock takes ~400-700 cycles using
> clock=pmtmr. With your "fix-sched_clock.diff" patch its less then 40
> cycles.
>
> While better accuracy is nice, I can't imagine the 10-20x cost of
> sched_clock is worth it. So I think your fix is the best solution.
I think you are right, but the sched_clock->monotonic_clock patch helped us
finding the problems in the monotonic_clock_pmtmr() function... ;-)
> thanks
> -john
np ;-)
Thomas
--- linux-2.6.0-test9-mm3_patched/arch/i386/kernel/timers/timer_pm.c.orig Wed Nov 19 08:05:19 2003
+++ linux-2.6.0-test9-mm3_patched/arch/i386/kernel/timers/timer_pm.c Wed Nov 19 08:07:41 2003
@@ -150,7 +150,7 @@ static unsigned long long monotonic_cloc
/* convert to nanoseconds */
ret = ((this_offset - last_offset) & ACPI_PM_MASK);
- ret = base + (cyc2us(ret)*1000);
+ ret = (base + cyc2us(ret)) * NSEC_PER_USEC;
return ret;
}
Attachment:
pgp00001.pgp
Description: signature