linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/13] 64-bit sched_clock
Date: Thu, 16 Dec 2010 09:25:27 +0000	[thread overview]
Message-ID: <20101216092527.GL9937@n2100.arm.linux.org.uk> (raw)

This patch series replaces existing sched_clock() implementations
with a version which gives a full 64-bit nanosecond time from counters
with less than 33 bits.

This series depends on the prevously posted clocksource patch series,
and the notrace sched_clock patch, and the ftrace tree previously
merged into my devel-stable branch.  It also depends on a fix to
the clocksource code to achieve the accuracy quoted below - though
it'll build and work without.

We achieve the 64-bit nanosecond time by maintaining a pair of
epochs - one for the counter and a corresponding one for the ns value.
This allows us to calculate how many counter ticks have happened since
the ns epoch was last updated, and therefore how much time has passed.

We use a lockless method to read and update the epoch values,
eliminating any locking overhead.  The epoch update happens at about
90% of the wrap period, resulting in less maintainence overhead.

Lastly, we allow platforms to provide constants for the counter->ns
conversion.

The PXA sched_clock implementation using cnt32_to_63() builds to 72
bytes of code and 12 bytes of data, and provides 54 bits of
nanoseconds, with an error of 0.00008%.

The PXA sched_clock implementation using this infrastructure builds
to 84 bytes of code and 8 bytes of data, and provides 64 bits of
nanoseconds, with an error of 0.00000002%.

The epoch updates in action on Versatile Express (24MHz 32-bit counter):

sched_clock: update 68391420 -> 50e0a246 0ns -> 162637292211ns
sched_clock: update 50e0a246 -> 372c24b7 162637292211ns -> 323625136880ns
sched_clock: update 372c24b7 -> 1d35c46a 323625136880ns -> 484433069633ns
sched_clock: update 1d35c46a -> 0367a736 484433069633ns -> 645350944761ns
...
sched_clock: update f6f7fd55 -> dd2d882e 32669955162290ns -> 32830883021959ns
sched_clock: update dd2d882e -> c36312cd 32830883021959ns -> 32991810879212ns
sched_clock: update c36312cd -> a9989d41 32991810879212ns -> 33152738734673ns
sched_clock: update a9989d41 -> 8fce2781 33152738734673ns -> 33313666587967ns

             reply	other threads:[~2010-12-16  9:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16  9:25 Russell King - ARM Linux [this message]
2010-12-16  9:27 ` [PATCH 01/13] ARM: sched_clock: provide common infrastructure for sched_clock() Russell King - ARM Linux
2010-12-16 12:52   ` Russell King - ARM Linux
2010-12-16  9:28 ` [PATCH 02/13] ARM: ixp4xx: convert sched_clock() to use new infrastructure Russell King - ARM Linux
2010-12-16  9:28 ` [PATCH 03/13] ARM: mmp: " Russell King - ARM Linux
2010-12-16  9:28 ` [PATCH 04/13] ARM: pxa: " Russell King - ARM Linux
2010-12-16 10:05   ` Uwe Kleine-König
2010-12-16 10:14     ` Russell King - ARM Linux
2010-12-16  9:29 ` [PATCH 05/13] ARM: sa1100: " Russell King - ARM Linux
2010-12-16  9:29 ` [PATCH 06/13] ARM: tegra: " Russell King - ARM Linux
2010-12-16  9:29 ` [PATCH 07/13] ARM: u300: " Russell King - ARM Linux
2010-12-16  9:30 ` [PATCH 08/13] ARM: iop: " Russell King - ARM Linux
2010-12-16  9:30 ` [PATCH 09/13] ARM: nomadik: " Russell King - ARM Linux
2010-12-16  9:31 ` [PATCH 10/13] ARM: omap: " Russell King - ARM Linux
2010-12-16  9:31 ` [PATCH 11/13] ARM: orion: " Russell King - ARM Linux
2010-12-16  9:31 ` [PATCH 12/13] ARM: versatile: " Russell King - ARM Linux
2010-12-16  9:32 ` [PATCH 13/13] ARM: vexpress: add sched_clock() for Versatile Express Russell King - ARM Linux
2010-12-16 13:04 ` [PATCH 0/13] 64-bit sched_clock Russell King - ARM Linux
2010-12-19 22:23   ` Linus Walleij
2010-12-19 23:39     ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101216092527.GL9937@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).