* Clock Source in hrtimer
@ 2010-08-15 2:13 wilbur.chan
2010-08-15 6:14 ` wu zhangjin
0 siblings, 1 reply; 3+ messages in thread
From: wilbur.chan @ 2010-08-15 2:13 UTC (permalink / raw)
To: Linux MIPS Mailing List
I am planning to use linux 2.6.24 with hrtimer enabled and with
CONFIG_NO_HZ on mips xlr 732.
As we know, a monotomic increasing Clock Source is required to
support hrtimer, whose cycles could be retrieved from
clocksource->read function.
However on xlr 732 ,there is only a 32 bits counter register, which
would overflow in 4s ( 2^32 / 1GHZ = 4).
How to solve this ?
Thanks in advance
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Clock Source in hrtimer
2010-08-15 2:13 Clock Source in hrtimer wilbur.chan
@ 2010-08-15 6:14 ` wu zhangjin
2010-08-15 16:00 ` wilbur.chan
0 siblings, 1 reply; 3+ messages in thread
From: wu zhangjin @ 2010-08-15 6:14 UTC (permalink / raw)
To: wilbur.chan; +Cc: Linux MIPS Mailing List
On 8/15/10, wilbur.chan <wilbur512@gmail.com> wrote:
> I am planning to use linux 2.6.24 with hrtimer enabled and with
> CONFIG_NO_HZ on mips xlr 732.
>
>
> As we know, a monotomic increasing Clock Source is required to
> support hrtimer, whose cycles could be retrieved from
> clocksource->read function.
>
> However on xlr 732 ,there is only a 32 bits counter register, which
> would overflow in 4s ( 2^32 / 1GHZ = 4).
>
> How to solve this ?
>
don't worry about it, the timekeeper solves it:
kernel/time/timekeeping.c
The r4k timer in most of the MIPS variants also only has a 32bits
counter register, no problem with it:
arch/mips/kernel/csrc-r4k.c
arch/mips/kernel/cevt-r4k.c
does xlr 732 also use such a timer (with MIPS count & compare
registers of coprocessor0)?
If you need to get the time with high resolution, please use:
getnstimeofday(), this function will return a linear time with the
help of timekeeper(timekeeping_get_ns).
Regards,
Wu Zhangjin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Clock Source in hrtimer
2010-08-15 6:14 ` wu zhangjin
@ 2010-08-15 16:00 ` wilbur.chan
0 siblings, 0 replies; 3+ messages in thread
From: wilbur.chan @ 2010-08-15 16:00 UTC (permalink / raw)
To: wu zhangjin; +Cc: Linux MIPS Mailing List
Hi wu,
2010/8/15 wu zhangjin <wuzhangjin@gmail.com>:
>
> don't worry about it, the timekeeper solves it:
>
> kernel/time/timekeeping.c
>
> The r4k timer in most of the MIPS variants also only has a 32bits
> counter register, no problem with it:
>
> arch/mips/kernel/csrc-r4k.c
> arch/mips/kernel/cevt-r4k.c
>
> does xlr 732 also use such a timer (with MIPS count & compare
> registers of coprocessor0)?
>
yes, xlr732 use these two registers to generate timer interrupt,
with a frequency of 1GHZ
> If you need to get the time with high resolution, please use:
> getnstimeofday(), this function will return a linear time with the
> help of timekeeper(timekeeping_get_ns).
>
1) So hrtimer is based on xtime,
If CONFIG_NO_HZ is set , would xtime be updated on time and correctly ?
2) some question about __get_nsec_offset :
/* read clocksource: */
cycle_now = clocksource_read(clock);
/* calculate the delta since the last update_wall_time: */
cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
if cycle_now is smaller than clock->cycle_last , say , cycle_now =
3 , cycle->cycle_last = 2^32-1 , then
cycle_delta = 3 - (2^32-1) = ?
> Regards,
> Wu Zhangjin
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-15 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-15 2:13 Clock Source in hrtimer wilbur.chan
2010-08-15 6:14 ` wu zhangjin
2010-08-15 16:00 ` wilbur.chan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.