From: Yury Polyanskiy on
On Fri, 26 Mar 2010 17:57:11 -0700
Joel Becker <Joel.Becker(a)oracle.com> wrote:

> On Fri, Mar 26, 2010 at 06:00:25PM -0400, Yury Polyanskiy wrote:
> > On Fri, 26 Mar 2010 14:46:49 -0700
> > Joel Becker <Joel.Becker(a)oracle.com> wrote:
> >
> > > On Tue, Mar 23, 2010 at 11:36:11PM -0400, Yury Polyanskiy wrote:
> >
> > > 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.
> >
> > Yes, as far as I can tell. Note that rdtsc is hosed on suspend-resume.
>
> Yeah, I know. rdtsc hangcheck-timer really required no suspend
> or cpufreq. Since it is only really used by servers, this wasn't a
> terrible restriction. Then virtualization came along...

Joel, just realized there is a slight mistake in what I said before.
getrawmonotonic() is a refined jiffies (and actually resolves to
get_cycles() on my system in the end). Thus it doesn't count while in
suspend. However, jiffies-based timers (aka timer-wheel) are also
stopped while in suspend. So getrawmonotonic() is the right call to
check the precision of the jiffies-based timer (i.e. you dont need to
make a correction by calling monotonic_to_bootbased()).

So my comment about rdtsc and suspend-resume is wrong.

Yury
From: Joel Becker on
On Fri, Mar 26, 2010 at 10:02:59PM -0400, Yury Polyanskiy wrote:
> Joel, just realized there is a slight mistake in what I said before.
> getrawmonotonic() is a refined jiffies (and actually resolves to
> get_cycles() on my system in the end). Thus it doesn't count while in
> suspend. However, jiffies-based timers (aka timer-wheel) are also
> stopped while in suspend. So getrawmonotonic() is the right call to
> check the precision of the jiffies-based timer (i.e. you dont need to
> make a correction by calling monotonic_to_bootbased()).

It's OK to tell hangcheck-timer users that suspend is not
allowed. After all, you're running something that you don't want to see
hang.
Is there a clock in the system that is a true wallclock? I'm
guessing, since getrawmonotonic() is get_cycles() based, that it doesn't
provide accurate time in the face of cpufreq changes. Is that true?

Joel



--

Life's Little Instruction Book #497

"Go down swinging."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker(a)oracle.com
Phone: (650) 506-8127
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Yury Polyanskiy on
On Sat, Mar 27, 2010 at 6:03 PM, Joel Becker <Joel.Becker(a)oracle.com> wrote:
> On Fri, Mar 26, 2010 at 10:02:59PM -0400, Yury Polyanskiy wrote:
>> Joel, just realized there is a slight mistake in what I said before.
>> getrawmonotonic() is a refined jiffies (and actually resolves to
>> get_cycles() on my system in the end). Thus it doesn't count while in
>> suspend. However, jiffies-based timers (aka timer-wheel) are also
>> stopped while in suspend. So getrawmonotonic() is the right call to
>> check the precision of the jiffies-based timer (i.e. you dont need to
>> make a correction by calling monotonic_to_bootbased()).
>
> � � � �It's OK to tell hangcheck-timer users that suspend is not
> allowed. �After all, you're running something that you don't want to see
> hang.

Joel, what I am saying is exactly the opposite: it is totally ok to
suspend-resume with hangcheck-timer (jiffies are stopped and so is
getrawmonotonic() when system suspended).

> � � � �Is there a clock in the system that is a true wallclock? �I'm
> guessing, since getrawmonotonic() is get_cycles() based, that it doesn't
> provide accurate time in the face of cpufreq changes. �Is that true?

Of course, getrawmonotonic accounts for cpufreq changes (see
arch/x86/kernel/tsc.c:time_cpufreq_notifier()).


Yury
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Joel Becker on
On Sat, Mar 27, 2010 at 06:51:01PM -0400, Yury Polyanskiy wrote:
> > � � � �It's OK to tell hangcheck-timer users that suspend is not
> > allowed. �After all, you're running something that you don't want to see
> > hang.
>
> Joel, what I am saying is exactly the opposite: it is totally ok to
> suspend-resume with hangcheck-timer (jiffies are stopped and so is
> getrawmonotonic() when system suspended).

Nope. The point of hangcheck-timer is that it reboots should
the system not be running for a certain amountof time. If
suspend-resume is allowed, a system can resume after days and think it
wasn't more than a second. hangcheck-timer will not know to reboot.

> > � � � �Is there a clock in the system that is a true wallclock? �I'm
> > guessing, since getrawmonotonic() is get_cycles() based, that it doesn't
> > provide accurate time in the face of cpufreq changes. �Is that true?
>
> Of course, getrawmonotonic accounts for cpufreq changes (see
> arch/x86/kernel/tsc.c:time_cpufreq_notifier()).

Excellent! That's a definite improvement over raw get_cycles().

Joel

--

Life's Little Instruction Book #182

"Be romantic."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker(a)oracle.com
Phone: (650) 506-8127
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Yury Polyanskiy on
On Sat, 27 Mar 2010 16:36:30 -0700
Joel Becker <Joel.Becker(a)oracle.com> wrote:

> On Sat, Mar 27, 2010 at 06:51:01PM -0400, Yury Polyanskiy wrote:
> > >        It's OK to tell hangcheck-timer users that suspend is not
> > > allowed.  After all, you're running something that you don't want to see
> > > hang.
> >
> > Joel, what I am saying is exactly the opposite: it is totally ok to
> > suspend-resume with hangcheck-timer (jiffies are stopped and so is
> > getrawmonotonic() when system suspended).
>
> Nope. The point of hangcheck-timer is that it reboots should
> the system not be running for a certain amountof time. If
> suspend-resume is allowed, a system can resume after days and think it
> wasn't more than a second. hangcheck-timer will not know to reboot.

But what is the reason for rebooting? Hangcheck is supposed to reboot
the machine only if the timer handler was run too late. However,
jiffies-based timers DO NOT count time spent in suspend.

Y