Hi,
On Wed, Feb 8, 2012 at 1:21 PM, Dmitry Antipov dmitry.antipov@linaro.org wrote:
On 02/07/2012 02:43 PM, Andrew Richardson wrote:
I'm experiencing what appears to be a minimum clock resolution issue in using clock_gettime() on a PandaBoard ES running ubuntu.
Do you have CONFIG_OMAP_32K_TIMER enabled in your kernel? Look at 'dmesg | grep clock' and check for the following:
... OMAP clockevent source: GPTIMER1 at 32768 Hz sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms ...
Most probably this is the answer - by default, recent OMAPs are configured to use less-accurate, but more energy-saving timer (32KHz) in favor of MPU timer.
Sorry, I have a question about the two kind of timers. No matter CONFIG_OMAP_32K_TIMER is defined or not, 'twd' interrupt count is always increased in '/proc/interrupts', and 'gp timer' interrupt count keeps unchanged, so looks MPU timer is still enabled even CONFIG_OMAP_32K_TIMER is disabled, isn't it?
After some investigation, I found the change[1] can remove local timer of 'twd', and tick will be driven by 'gp timer' interrupt, but I am not sure if it is the right thing to do.
Disable CONFIG_OMAP_32K_TIMER to switch to MPU timer, and check 'dmesg | grep clock' to see:
... OMAP clockevent source: GPTIMER1 at 38400000 Hz OMAP clocksource: GPTIMER2 at 38400000 Hz sched_clock: 32 bits at 38MHz, resolution 26ns, wraps every 111848ms ...
BTW, I have no ideas why clock_getres(CLOCK_REALTIME,...) returns {0, 1} regardless of underlying clock source. I expect {0, 30517} for 32K timer and {0, 26} for MPU timer.
[1], 'not select LOCAL_TIMERS for OMAP4 SMP' diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index d965da4..0036218 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -46,7 +46,7 @@ config ARCH_OMAP4 select CPU_V7 select ARM_GIC select HAVE_SMP - select LOCAL_TIMERS if SMP + #select LOCAL_TIMERS if SMP select PL310_ERRATA_588369 select PL310_ERRATA_727915 select ARM_ERRATA_720789
thanks,