On Tue, 30 May 2006, john stultz wrote:
> On Tue, 2006-05-30 at 08:15 +0200, Ingo Molnar wrote:
> > * Simon Derr <[email protected]> wrote:
> > > * This kernel, when booting, prints:
> > >
> > > BUG in check_monotonic_clock at kernel/time/timeofday.c:164
> > >
> > > But I think this happens because two get_monotonic_clock() are racing
> > > on two cpus. There is a lock to prevent the race, but it is a seqlock.
> > > That means that it is okay if the race happens since another try will
> > > be attempted, but the message that has been printed on the console
> > > can't be removed, and the user is unnecessarily scared.
>
> Simon, I suspect here you actually have unsynced ITCs, as the
> check_monotonic_clock values are all locked w/ spinlocks.
>
> You should probably add a cmpxchg in clocksource_itc_read() where you
> currently do the if (last_itc < now), or you'll race on setting
> last_itc. Let me know if you still see the issue w/ that fix.
I have already tried to add a raw_spinlock_t to avoid this race, and the
message still appears.
What I believe is happening is that is that somewhere between
__get_nsec_offset() and ktime_add_ns(), while in
static ktime_t __get_monotonic_clock(void)
{
s64 offset = __get_nsec_offset();
#ifdef CONFIG_PARANOID_GENERIC_TIME
ktime_t check = get_check_value();
#endif
ktime_t ret;
ret = ktime_add_ns(system_time, offset);
check_monotonic_clock(check,ret);
return ret;
}
the cycle_last and system_time are being updated by a concurrent
timeofday_periodic_hook().
This can happen since system_time_lock is "only" a seqlock.
>From a correctness point of view this is okay as get_monotonic_clock()
will detect the race and call __get_monotonic_clock() again. But the
warning message has been already been printed.
Simon.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]