mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Joel Becker <Joel.Becker@oracle.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][2.5] hangcheck-timer
Date: 20 Jan 2003 17:42:16 -0800	[thread overview]
Message-ID: <1043113336.32478.97.camel@w-jstultz2.beaverton.ibm.com> (raw)
In-Reply-To: <200301210135.h0L1ZFa06867@eng2.beaverton.ibm.com>

>         Attached is a patch adding hangcheck-timer.  It is used to detect
>  when the system goes out to lunch for a period of time, and then
>  returns.  This is interesting for debugging drivers as well as for
>  clustering environments.
>         The module sets a timer.  When the timer goes off, it then uses
>  get_cycles() to determine how much real time has passed.

get_cycles() is a poor method for determining "real time". 
Please use do_gettimeofday().

>         On a normal system, the real elapsed time will be almost
>  identical to the expected timer duration.  However, if a device decided
>  to udelay for 60 seconds (or some other circumstance), the module takes

I believe you mean "udelay for 60 micro-seconds"

>  + * The hangcheck-timer driver uses the TSC to catch delays that
>  + * jiffies does not notice.  A timer is set.  When the timer fires, it
>  + * checks whether it was delayed and if that delay exceeds a given
>  + * margin of error.  The hangcheck_tick module paramter takes the timer
>  + * duration in seconds.  The hangcheck_margin parameter defines the
>  + * margin of error, in seconds.  The defaults are 60 seconds for the
>  + * timer and 180 seconds for the margin of error.  IOW, a timer is set
>  + * for 60 seconds.  When the timer fires, the callback checks the
>  + * actual duration that the timer waited.  If the duration exceeds the
>  + * alloted time and margin (here 60 + 180, or 240 seconds), the machine
>  + * is restarted.  A healthy machine will have the duration match the
>  + * expected timeout very closely.
>  + */

Wait, so 180 seconds is the margin of error?

[snip]

>  +#define DEFAULT_IOFENCE_MARGIN 60     /* Default fudge factor, in seconds */
>  +#define DEFAULT_IOFENCE_TICK 180      /* Default timer timeout, in seconds */
>  +

ok, time in seconds...


>  +static int hangcheck_tick = DEFAULT_IOFENCE_TICK;
>  +static int hangcheck_margin = DEFAULT_IOFENCE_MARGIN;
>  +static int hangcheck_reboot = 0;  /* Do not reboot */
>  +

so hangcheck_margin's unit is seconds...

[snip]
>  +static void hangcheck_fire(unsigned long data)
>  +{
>  +      unsigned long long cur_tsc, tsc_diff;
>  +
>  +      cur_tsc = get_cycles();
>  +
>  +      if (cur_tsc > hangcheck_tsc)
>  +              tsc_diff = cur_tsc - hangcheck_tsc;
>  +      else
>  +              tsc_diff = (cur_tsc + (~0ULL - hangcheck_tsc)); /* or something */
>  +
[snip]
>  +      
>  +      if (tsc_diff > hangcheck_tsc_margin) {

but now we're using it to compare cycles!  180sec != 180 cycles

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. 

thanks
-john


       reply	other threads:[~2003-01-21  1:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200301210135.h0L1ZFa06867@eng2.beaverton.ibm.com>
2003-01-21  1:42 ` john stultz [this message]
2003-01-21  2:00   ` Joel Becker
2003-01-21  2:45     ` john stultz
2003-01-21 17:29       ` Joel Becker
2003-01-21 20:03         ` john stultz
2003-01-21 20:30           ` Joel Becker
2003-01-21  1:19 Joel Becker
2003-01-21  8:11 ` Christoph Hellwig
2003-01-21 17:33   ` Joel Becker
2003-01-21 12:50 ` Dave Jones
2003-01-21 17:40   ` Joel Becker
2003-01-21 17:42     ` Dave Jones
2003-01-21 18:42       ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1043113336.32478.97.camel@w-jstultz2.beaverton.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=Joel.Becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®