diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2009-12-17 21:48:53 +0800 |
---|---|---|
committer | Wu Zhangjin <wuzhangjin@gmail.com> | 2010-03-10 04:38:25 +0800 |
commit | 7ac72cc54968c4820052f39de5b9b7891f625498 (patch) | |
tree | 8f01fd0c8d8ae0e5beb391b67f5b91fe9412c8de /arch/mips/kernel/traps.c | |
parent | 4bf235ddf271eeb96f0fd08f2dbeef26495ebd10 (diff) | |
download | lwn-7ac72cc54968c4820052f39de5b9b7891f625498.tar.gz lwn-7ac72cc54968c4820052f39de5b9b7891f625498.zip |
MIPS: r4k: Add a high resolution sched_clock()
(v8 -> v9:
O Make it depends on 64BIT for the current mips_sched_clock() only
support 64bit currently.
v7 -> v8:
O Make it works with the exisiting clocksource_mips.mult,
clocksource_mips.shift and copes with the 64bit calculation's overflow
problem with the method introduced by David Daney in "MIPS: Octeon: Use
non-overflowing arithmetic in sched_clock".
To reduce the duplication, I have abstracted an inline
mips_sched_clock() function to arch/mips/include/asm/time.h from
arch/mips/cavium-octeon/csrc-octeon.c.
v6 -> v7:
O Make it depends on !CPU_FREQ and CPU_HAS_FIXED_C0_COUNT
This sched_clock() is only available with the processor has fixed cp0
MIPS count register or even has dynamic cp0 MIPS count register but
with CPU_FREQ disabled.
NOTE: If your processor has fixed c0 count, please select
CPU_HAS_FIXED_C0_COUNT for it and send a related patch to Ralf.
v5 -> v6:
o hard-codes the cycle2ns_scale_factor as 8 for 30(cs->shift) is too
big. With 30, the return value of sched_clock() will also overflow quickly.
o moves the sched_clock() back into csrc-r4k.c as David and Sergei
recommended.
o inits c0 count as zero for PRINTK_TIME=y.
o drops the HR_SCHED_CLCOK option for the current sched_clock() is stable
enough to replace the jiffies based one.
)
This patch adds a cnt32_to_63() and MIPS c0 count based sched_clock(),
which provides high resolution.
Without it, the Ftrace for MIPS will give useless timestamp information.
Because cnt32_to_63() needs to be called at least once per half period
to work properly, Differ from the old version, this v2 revision set up a
kernel timer to ensure the requirement of some MIPSs which have short c0
count period.
And also, we init the c0 count as ZERO(just as jiffies does) in
time_init() before plat_time_init(), without it, PRINTK_TIME=y will get
wrong timestamp information. (NOTE: some platforms have initiazlied c0
count as zero, but some not, this may introduce some duplication,
perhaps a new patch is needed to remove the initialized of c0 count in
the platforms later?)
This is originally from arch/arm/plat-orion/time.c
This revision works well for function graph tracer now, and also,
PRINTK_TIME=y will get normal timestamp informatin.
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Diffstat (limited to 'arch/mips/kernel/traps.c')
0 files changed, 0 insertions, 0 deletions