lkml.org 
[lkml]   [2014]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 1/6] wdt: sunxi: Move restart code to the watchdog driver
Date
On Monday 23 June 2014 14:47:48 Guenter Roeck wrote:
> > To continue the discussion: I would like to add an excerpt from drivers/watchdog/alim7101_wdt.c
> > /*
> > * Notifier for system down
> > */
> >
> > static int wdt_notify_sys(struct notifier_block *this,
> > unsigned long code, void *unused)
> > {
> > if (code == SYS_DOWN || code == SYS_HALT)
> > wdt_turnoff();
> >
> > if (code == SYS_RESTART) {
> > /*
> > * Cobalt devices have no way of rebooting themselves other
> > * than getting the watchdog to pull reset, so we restart the
> > * watchdog on reboot with no heartbeat
> > */
> > wdt_change(WDT_ENABLE);
> > pr_info("Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second\n");
> > }
> > return NOTIFY_DONE;
> > }
> >
> > For some systems the watchdog is the only way to reboot... So where we should put it, is not trivial neither...
> >
>
> Agreed. The above definitely doesn't look like a good solution to me.
>

Right, at the very least, it should be a separate notifier: the existing
reboot_notifier is meant for things that need to happen /before/ reboot,
so adding something in there to actually trigger the reboot is by definition
racy against the other notifiers that may or may not get called after
this one.

Arnd


\
 
 \ /
  Last update: 2014-06-24 12:01    [W:0.080 / U:5.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site