Re: [PATCH] hangcheck-timer is broken on x86

Joel Becker
2010-03-26T21:48:47Z

On Tue, Mar 23, 2010 at 11:36:11PM -0400, Yury Polyanskiy wrote:
> Second, and more importantly, loops_per_jiffy has little to do with the conversion from the
> the time scale of get_cycles() (aka rdtsc) to the time scale of jiffies.

It used to! Fundamentally, of course, we didn't have a
monotonic clock everywhere that satisfied hangcheck-timer's needs. So
we had to use different approaches on different architectures.

> @@ -130,7 +129,9 @@ extern unsigned long long monotonic_clock(void);
> #else
> static inline unsigned long long monotonic_clock(void)
> {
> - return get_cycles();
> + struct timespec ts;
> + getrawmonotonic(&ts);
> + return timespec_to_ns(&ts);
> }
> #endif /* HAVE_MONOTONIC */

I have two questions:

1) Does getrawmonotonic() satisfy hangcheck-timer? What I mean is, will
it always return the wallclock nanoseconds even in the face of CPU speed
changes, suspend, udelay, or any other suspension of kernel operation?
Yes, I know this is a tougher standard than rdtsc(), but this is what
hangcheck-timer wants. rdtsc() at least satisfied udelay and PCI hangs.

2) If it does satisfy, why not use it for all hangcheck usage instead of
any ifdefs?

Joel

--

"The cynics are right nine times out of ten."
- H. L. Mencken

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127