Re: [PATCH][2.5] hangcheck-timer

From: john stultz (
Date: Mon Jan 20 2003 - 21:45:57 EST

On Mon, 2003-01-20 at 18:00, Joel Becker wrote:
> On Mon, Jan 20, 2003 at 05:42:16PM -0800, john stultz wrote:
> > get_cycles() is a poor method for determining "real time".
> > Please use do_gettimeofday().
> Does do_gettimeofday() exist on all platforms? Does it indeed
> give actual wall clock time, instead of the inaccurate time jiffies can
> give?

Yep, do_gettimeofday is called from generic code in sys_gettimeofday()
(kernel/time.c). It returns the same value userspace code would see
calling gettimeofday().

> > > + if (tsc_diff > hangcheck_tsc_margin) {
> >
> > but now we're using it to compare cycles! 180sec != 180 cycles
> Look at the calculations. I'm comparing cycles to cycles,
> calculated from the original seconds.

Ah! Ok, I missed the conversion in hangcheck_init. Even so, the default
initializer is misleading. Yea, that's it... :)

> > Additionally, this code doesn't take systems that have unsync'ed TSCs,
> > or systems that change cpu frequency into account. Again, please use
> > do_gettimeofday(). Then you can then talk about the values returned in
> > secs and usecs, and I believe things will be much more clear.
> I'll look into it, but it must absolutely be in terms of wall
> clock time as measured from outside the system.

Completely understandable. do_gettimeofday will give you just that (w/o
the conversion muck w/ HZ and loops_per_jiffy).


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Jan 23 2003 - 22:00:25 EST