All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Simon Kagstrom <simon.kagstrom@netinsight.net>
Cc: linux-kernel@vger.kernel.org, wim@iguana.be, seth.heasley@intel.com
Subject: Re: [PATCH] iTCO_wdt: Don't double the requested timeout
Date: Wed, 24 Feb 2010 16:18:08 +0000	[thread overview]
Message-ID: <4B855140.7030408@draigBrady.com> (raw)
In-Reply-To: <20100224101618.39c3468b@marrow.netinsight.se>

On 24/02/10 09:16, Simon Kagstrom wrote:
> On Tue, 23 Feb 2010 17:09:26 +0000
> Pádraig Brady<P@draigBrady.com>  wrote:
>
>> Actually looking at that code I noticed that it wasn't
>> accounting for the timer counting down twice before reboot,
>> which I thought was the case for ICH4 at least.
>> The following is not even compiled, nor am I sure it
>> applies to TCO v2. Testing/info appreciated.
>
> I tested your change on our TCO v1-based board, and it doubles the time
> until the watchdog triggers. So:

Well it should be halving the timeout :)
I amended the patch and Simon retested to verify
that it now honors the requested timeout.

I also checked an ICH7 box here and it doesn't
seem to need the adjustment, so I've amended the patch accordingly.

Wim, please apply, thanks...


iTCO_wdt: fix TCO V1 timeout values and limits

For TCO V1 devices the programmed timeout was twice too long
because the fact that the TCO V1 timer needs to count down
twice before triggering the watchdog, wasn't accounted for.
Also the timeout values in the module description and error
message were clarified.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
Tested-by: Simon Kagstrom <simon.kagstrom@netinsight.se>

--- a/iTCO_wdt.c        2010-02-24 13:43:54.815676860 +0000
+++ b/iTCO_wdt.c        2010-02-24 15:18:33.341640363 +0000
@@ -304,8 +304,8 @@
  #define WATCHDOG_HEARTBEAT 30  /* 30 sec default heartbeat */
  static int heartbeat = WATCHDOG_HEARTBEAT;  /* in seconds */
  module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. "
-       "(2<heartbeat<39 (TCO v1) or 613 (TCO v2), default="
+MODULE_PARM_DESC(heartbeat, "Watchdog timeout in seconds. "
+       "(5..76 (TCO v1) or 3..614 (TCO v2), default="
                                 __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");

  static int nowayout = WATCHDOG_NOWAYOUT;
@@ -321,8 +321,12 @@
  static inline unsigned int seconds_to_ticks(int seconds)
  {
         /* the internal timer is stored as ticks which decrement
-        * every 0.6 seconds */
-       return (seconds * 10) / 6;
+        * every 0.6 seconds. For TCO v1 the timer counts down
+        * twice before triggering the watchdog */
+       if (iTCO_wdt_private.iTCO_version == 1)
+               return (seconds * 5) / 6;
+       else
+               return (seconds * 10) / 6;
  }

  static void iTCO_wdt_set_NO_REBOOT_bit(void)
@@ -756,9 +760,14 @@
            if not reset to the default */
         if (iTCO_wdt_set_heartbeat(heartbeat)) {
                 iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT);
+               int tco_min=5; int tco_max=76; /* TCO V1 */
+               if (iTCO_wdt_private.iTCO_version == 2) {
+                       tco_min=3; tco_max=614;
+               }
                 printk(KERN_INFO PFX
-                       "heartbeat value must be 2 < heartbeat < 39 (TCO v1) "
-                               "or 613 (TCO v2), using %d\n", heartbeat);
+                       "timeout value %d is not between %d and %d"
+                       " inclusive, using %d\n",
+                       heartbeat, tco_min, tco_max, WATCHDOG_HEARTBEAT);
         }

         ret = misc_register(&iTCO_wdt_miscdev);

  reply	other threads:[~2010-02-24 16:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 15:40 [PATCH] iTCO_wdt: Don't stop on shutdown with nowayout Simon Kagstrom
2010-02-23 16:24 ` Pádraig Brady
2010-02-23 17:09   ` [PATCH] iTCO_wdt: Don't double the requested timeout Pádraig Brady
2010-02-24  9:16     ` Simon Kagstrom
2010-02-24 16:18       ` Pádraig Brady [this message]
2010-04-07 16:20         ` Pádraig Brady
     [not found]       ` <4B84FD15.9020803@draigBrady.com>
     [not found]         ` <20100224124730.6958b2c0@marrow.netinsight.se>
     [not found]           ` <4B8545D1.8000302@draigBrady.com>
     [not found]             ` <20100224165526.61cdd169@marrow.netinsight.se>
     [not found]               ` <4B854F58.4050907@draigBrady.com>
2010-02-25  7:45                 ` Simon Kagstrom
2010-02-24  6:25   ` [PATCH] iTCO_wdt: Don't stop on shutdown with nowayout Simon Kagstrom
2010-03-07 15:16 ` Wim Van Sebroeck
2010-03-08  7:51   ` Simon Kagstrom

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=4B855140.7030408@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seth.heasley@intel.com \
    --cc=simon.kagstrom@netinsight.net \
    --cc=wim@iguana.be \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.