mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Shifts for clocksources and clockevents
       [not found] <63386a3d0804090104h59fd6633x41a981eb8a1919ce@mail.gmail.com>
@ 2008-05-27 14:54 ` Linus Walleij
  2008-05-28  1:25   ` john stultz
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2008-05-27 14:54 UTC (permalink / raw)
  To: linux-kernel

I asked this on the ARM Linux mailing list a while back, but
it appears noone there really has a clue. (Or they didn't see
it.)

Can someone give me a rationale behind the values assigned to
the .shift field in clock_event_device and clocksource in the current
ARM platforms?

When I read the documentation in Documentation/hrtimers/highres.txt
it points me to the PDF
http://www.linuxsymposium.org/2006/linuxsymposium_procv1.pdf
from which I get the impression that shift shall be assigned so
that

(time in ns for 1 cycle)
--------------------------     = 1
           shift
         2

So for a timer running cycles at 1MHz shift would be something like
10 so that 1000/1024 ~= 1.

However the current assignments doesn't look like that at all. I get
the impression that .shift for clock_event_device seem to be set
to 32 at all times in order to blow 32bit counters up to 64 bit,
and clocksource .shift is set to something like 18, 20 or 24 for
unclear reasons.

Any hints here?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Shifts for clocksources and clockevents
  2008-05-27 14:54 ` Shifts for clocksources and clockevents Linus Walleij
@ 2008-05-28  1:25   ` john stultz
  0 siblings, 0 replies; 2+ messages in thread
From: john stultz @ 2008-05-28  1:25 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel

On Tue, May 27, 2008 at 7:54 AM, Linus Walleij
<linus.ml.walleij@gmail.com> wrote:
> I asked this on the ARM Linux mailing list a while back, but
> it appears noone there really has a clue. (Or they didn't see
> it.)
>
> Can someone give me a rationale behind the values assigned to
> the .shift field in clock_event_device and clocksource in the current
> ARM platforms?
>
> When I read the documentation in Documentation/hrtimers/highres.txt
> it points me to the PDF
> http://www.linuxsymposium.org/2006/linuxsymposium_procv1.pdf
> from which I get the impression that shift shall be assigned so
> that
>
> (time in ns for 1 cycle)
> --------------------------     = 1
>           shift
>         2
>
> So for a timer running cycles at 1MHz shift would be something like
> 10 so that 1000/1024 ~= 1.
>
> However the current assignments doesn't look like that at all. I get
> the impression that .shift for clock_event_device seem to be set
> to 32 at all times in order to blow 32bit counters up to 64 bit,
> and clocksource .shift is set to something like 18, 20 or 24 for
> unclear reasons.
>
> Any hints here?

The goal is to have the highest shift-value possible (providing
improved slewing accuracy for ntp), while not overflowing on the
multiply if the cycles are not accumulated over an extended period of
time (usually 2-5 seconds).

See the comments in kernel/time/jiffies.c for an example.

thanks
-john

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-28  1:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <63386a3d0804090104h59fd6633x41a981eb8a1919ce@mail.gmail.com>
2008-05-27 14:54 ` Shifts for clocksources and clockevents Linus Walleij
2008-05-28  1:25   ` john stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®