Hi,
About 3 years ago we discovered a problem on DigiConnect ME module. gettimeofday() on DigiEL-5.2 when called successively sometimes produced non-monotonic results. The test environment did not contain services that could adjust CLOCK_REALTIME (like ntpd). It just occasionally jumped backwards “by itself”.
We raised the issue with our local support, and through the support chain they got us a kernel patch that boiled down to the following code in arch/arm/mach-ns9xxx/time-ns921x.c: simple
static cycle_t ns921x_clocksource_read(void)
{
return __raw_readl(SYS_TRC(TIMER_CLOCKSOURCE));
}
was replaced with
/**
-
The Read an Capture register is divided in two parts of 16 bits that allows
-
to configure the timer as 16 or 32 bits. When configured as 32 bits, it
-
seems like the read is not totally atomic, as many times the lower 2 bytes
-
are stuck in 0xffff, producing a wrong value which might result in readings
-
going backwards in time. In this case a new read is necessary.
-
TODO: this is a HW bug to be verified with the ASIC team
*/
static cycle_t ns921x_clocksource_read(void)
{
u32 newval, clkval;clkval = __raw_readl(SYS_TRC(TIMER_CLOCKSOURCE)); if ((u16)clkval == 0xffff) { newval = __raw_readl(SYS_TRC(TIMER_CLOCKSOURCE)); if (newval < clkval) clkval = newval; } return clkval;
}
The question is, has the ASIC bug been confirmed or fixed? Since what chip revision? Errata for NS9210 available on Digi website does not mention any bugs with Timer 0-9. Kernel from DigiEL-5.7 that we use in out products has the old (unpatched) implementation of ns921x_clocksource_read() function.
The reason why I ask is that we’re having problems with clock_gettime(CLOCK_MONOTONIC, …) that produces non-monotonic results (jump backwards) occasionally in our products, and we’d like to find what causes it.
Thanks!