From: Wim Van Sebroeck <wim@iguana.be>
To: Wan ZongShun <mcuos.com@gmail.com>
Cc: linux-arm-kernel <linux-arm-kernel@lists.arm.linux.org.uk>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Add watchdog driver for w90p910
Date: Wed, 5 Aug 2009 09:08:22 +0200 [thread overview]
Message-ID: <20090805070822.GC30892@infomag.iguana.be> (raw)
In-Reply-To: <e68bb3470908041955t7e07929bv612a25e0bc0264c1@mail.gmail.com>
Hi Wan,
> I'm much obliged to you for helping me.
With pleasure :-).
> >> +static irqreturn_t w90p910_wdt_irq(int irq, void *dev_id)
> >> +{
> >> + w90p910_wdt_keepalive();
> >> + return IRQ_HANDLED;
> >> +}
> >
> > How does the interrupt work? what does the watchdog do when it times out?
> > (Is there a datasheet available somewhere?)
> >
>
> The mechanism of watchdog of w90p910 is that the interrupt will occur
> periodicity every a given time interval.
>
> Hmm, there are only two choices to confirm the system running, one to
> clear this WTIF and WTR bits in handler of interrupt, the other to
> reset them in user application before interrupt occurs.
Hmm, I'm confused now. how does the watchdog then reboot your system?
The way we implement watchdog's in linux is that you start the watchdog and that userspace needs to trigger/ping/keep-the-watchdog-alive before the timeout period is finished/over. If the userspace daemon can keep doing this (or with other words: the system is healthy enough to operate normally without to much delay) your system doesn't get rebooted. If it doesn't manage to do it, then the watchdog knows that your system is not stable/healthy enough and will reboot your system.
Here I think that the watchdog is started. Then userspace start pinging the watchdog and everything is OK. If userspace doesn't ping the watchdog in time an interrupt is being generated and instead of rebooting the system, the watchdog is being triggered... If this is indeed what it does then this is wrong.
> > The read-write cyclus to REG_WTCR should also be guarded with a spinlock.
> > Can you incorporate the call to w90p910_wdt_start() in the ioctl code into this function?
> >
>
> Do you mean that I should merge the "w90p910_wdt_settimeout" to
> "w90p910_wdt_start()"? or contrary?
I mean the contrary.
If your watchdog needs to be restarted when you set a new timeout, then it is best to have this in the settimeout function.
It is also better to do a ping to the watchdog once the new timeout was set. It might however be that a ping is enough and that a restart is not needed.
So something like the following diff could be it:
--- w90p910_wdt.c 2009-08-05 06:44:14.286477908 +0000
+++ w90p910_wdt.c 2009-08-05 06:46:04.496353102 +0000
@@ -144,6 +144,9 @@
__raw_writel(val, w90p910_wdt->wdt_base + REG_WTCR);
wdt_time = new_time_level;
+
+ w90p910_wdt_start();
+
return 0;
}
@@ -182,9 +185,7 @@
return -EFAULT;
if (w90p910_wdt_settimeout(new_value))
return -EINVAL;
-
- w90p910_wdt_start();
-
+ w90p910_wdt_keepalive();
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
---
I have an additional question: which timeout values can you set? is it 0, 1, 2 and 3 seconds?
Kind regards,
Wim.
next prev parent reply other threads:[~2009-08-05 7:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-24 15:06 Wan ZongShun
2009-07-30 1:17 ` Wan ZongShun
2009-07-30 5:00 ` Wim Van Sebroeck
2009-07-30 5:03 ` Wan ZongShun
2009-08-04 20:10 ` Wim Van Sebroeck
2009-08-05 2:55 ` Wan ZongShun
2009-08-05 7:08 ` Wim Van Sebroeck [this message]
2009-08-05 8:00 ` Wan ZongShun
2009-08-05 10:31 ` Wim Van Sebroeck
2009-08-05 10:44 ` Wan ZongShun
2009-08-05 13:20 ` [PATCH v2] " Wan ZongShun
2009-08-17 2:40 ` Wan ZongShun
2009-08-17 9:14 ` Wim Van Sebroeck
2009-08-17 9:19 ` Wan ZongShun
2009-08-17 10:00 ` Wan ZongShun
2009-08-17 11:02 ` Wim Van Sebroeck
2009-08-17 11:04 ` Wan ZongShun
2009-08-05 11:37 ` [PATCH] " Wan ZongShun
2009-08-20 12:16 ` Wim Van Sebroeck
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=20090805070822.GC30892@infomag.iguana.be \
--to=wim@iguana.be \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mcuos.com@gmail.com \
/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®