112f38a4a3
Provide common sched_clock() infrastructure for platforms to use to create a 64-bit ns based sched_clock() implementation from a counter running at a non-variable clock rate. This implementation is based upon maintaining an epoch for the counter and an epoch for the nanosecond time. When we desire a sched_clock() time, we calculate the number of counter ticks since the last epoch update, convert this to nanoseconds and add to the epoch nanoseconds. We regularly refresh these epochs within the counter wrap interval. We perform a similar calculation as above, and store the new epochs. We read and write the epochs in such a way that sched_clock() can easily (and locklessly) detect when an update is in progress, and repeat the loading of these constants when they're known not to be stable. The one caveat is that sched_clock() is not called in the middle of an update. We achieve that by disabling IRQs. Finally, if the clock rate is known at compile time, the counter to ns conversion factors can be specified, allowing sched_clock() to be tightly optimized. We ensure that these factors are correct by providing an initialization function which performs a run-time check. Acked-by: Peter Zijlstra <peterz@infradead.org> Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Tested-by: Will Deacon <will.deacon@arm.com> Tested-by: Mikael Pettersson <mikpe@it.uu.se> Tested-by: Eric Miao <eric.y.miao@gmail.com> Tested-by: Olof Johansson <olof@lixom.net> Tested-by: Jamie Iles <jamie@jamieiles.com> Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> |
||
---|---|---|
.. | ||
hardware | ||
mach | ||
a.out-core.h | ||
a.out.h | ||
asm-offsets.h | ||
assembler.h | ||
atomic.h | ||
auxvec.h | ||
bitops.h | ||
bitsperlong.h | ||
bug.h | ||
bugs.h | ||
byteorder.h | ||
cache.h | ||
cacheflush.h | ||
cachetype.h | ||
checksum.h | ||
clkdev.h | ||
cpu-multi32.h | ||
cpu-single.h | ||
cpu.h | ||
cputime.h | ||
cputype.h | ||
current.h | ||
delay.h | ||
device.h | ||
div64.h | ||
dma-mapping.h | ||
dma.h | ||
domain.h | ||
ecard.h | ||
elf.h | ||
emergency-restart.h | ||
entry-macro-vic2.S | ||
errno.h | ||
fb.h | ||
fcntl.h | ||
fiq.h | ||
fixmap.h | ||
flat.h | ||
floppy.h | ||
fpstate.h | ||
ftrace.h | ||
futex.h | ||
glue.h | ||
gpio.h | ||
hardirq.h | ||
highmem.h | ||
hw_breakpoint.h | ||
hw_irq.h | ||
hwcap.h | ||
ide.h | ||
io.h | ||
ioctl.h | ||
ioctls.h | ||
ipcbuf.h | ||
irq_regs.h | ||
irq.h | ||
irqflags.h | ||
Kbuild | ||
kdebug.h | ||
kexec.h | ||
kgdb.h | ||
kmap_types.h | ||
kprobes.h | ||
leds.h | ||
limits.h | ||
linkage.h | ||
local64.h | ||
local.h | ||
localtimer.h | ||
locks.h | ||
mach-types.h | ||
mc146818rtc.h | ||
memblock.h | ||
memory.h | ||
mman.h | ||
mmu_context.h | ||
mmu.h | ||
module.h | ||
msgbuf.h | ||
mtd-xip.h | ||
mutex.h | ||
nwflash.h | ||
outercache.h | ||
page-nommu.h | ||
page.h | ||
param.h | ||
parport.h | ||
pci.h | ||
percpu.h | ||
perf_event.h | ||
pgalloc.h | ||
pgtable-hwdef.h | ||
pgtable-nommu.h | ||
pgtable.h | ||
pmu.h | ||
poll.h | ||
posix_types.h | ||
proc-fns.h | ||
processor.h | ||
procinfo.h | ||
ptrace.h | ||
resource.h | ||
scatterlist.h | ||
sched_clock.h | ||
seccomp.h | ||
sections.h | ||
segment.h | ||
sembuf.h | ||
serial.h | ||
setup.h | ||
shmbuf.h | ||
shmparam.h | ||
sigcontext.h | ||
siginfo.h | ||
signal.h | ||
sizes.h | ||
smp_mpidr.h | ||
smp_plat.h | ||
smp_scu.h | ||
smp_twd.h | ||
smp.h | ||
socket.h | ||
sockios.h | ||
sparsemem.h | ||
spinlock_types.h | ||
spinlock.h | ||
stackprotector.h | ||
stacktrace.h | ||
stat.h | ||
statfs.h | ||
string.h | ||
swab.h | ||
system.h | ||
tcm.h | ||
termbits.h | ||
termios.h | ||
therm.h | ||
thread_info.h | ||
thread_notify.h | ||
timex.h | ||
tlb.h | ||
tlbflush.h | ||
tls.h | ||
topology.h | ||
traps.h | ||
types.h | ||
uaccess.h | ||
ucontext.h | ||
unaligned.h | ||
unified.h | ||
unistd.h | ||
unwind.h | ||
user.h | ||
vfp.h | ||
vfpmacros.h | ||
vga.h | ||
xor.h |