linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
       [not found] ` <20130914152124.317379835@gmail.com>
@ 2013-09-15 18:09   ` Arnd Bergmann
  2013-09-15 18:52     ` Domenico Andreoli
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2013-09-15 18:09 UTC (permalink / raw)
  To: Domenico Andreoli
  Cc: Russell King - ARM Linux, Olof Johansson, linux-arm-kernel,
	Wim Van Sebroeck, linux-watchdog

On Saturday 14 September 2013, Domenico Andreoli wrote:
> +
> +static int __init bcm4760_wdt_init(void)
> +{
> +	struct device_node *node;
> +
> +	node = of_find_matching_node(NULL, bcm4760_pm_wdt_match);
> +	if (!node) {
> +		pr_info("No bcm4760 watchdog node\n");
> +		return -1;
> +	}
> +
> +	wdt_regs = of_iomap(node, 0);
> +	of_node_put(node);

Since this is now in the drivers directory and initialized at regular
module_init level, I'd ask you to register it as a proper platform_driver
and move the initialization into the probe() callback. You also need to
put Wim as the watchdog subsystem maintainer on Cc (I did in this reply)
and ask him to merge the driver.

I assume that Wim will ask you to add a watchdog_register_device() call
and a set of watchdog_ops to make this a functional driver. From the
platform perspective, I don't care, but it is certainly a logical step.

	Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-15 18:09   ` [PATCH v4 4/4] ARM: bcm4760: Add restart hook Arnd Bergmann
@ 2013-09-15 18:52     ` Domenico Andreoli
  2013-09-15 20:10       ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Domenico Andreoli @ 2013-09-15 18:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Domenico Andreoli, Olof Johansson, Wim Van Sebroeck,
	Russell King - ARM Linux, linux-watchdog, linux-arm-kernel

On Sun, Sep 15, 2013 at 08:09:26PM +0200, Arnd Bergmann wrote:
> On Saturday 14 September 2013, Domenico Andreoli wrote:
> > +
> > +static int __init bcm4760_wdt_init(void)
> > +{
> > +	struct device_node *node;
> > +
> > +	node = of_find_matching_node(NULL, bcm4760_pm_wdt_match);
> > +	if (!node) {
> > +		pr_info("No bcm4760 watchdog node\n");
> > +		return -1;
> > +	}
> > +
> > +	wdt_regs = of_iomap(node, 0);
> > +	of_node_put(node);
> 
> Since this is now in the drivers directory and initialized at regular
> module_init level, I'd ask you to register it as a proper platform_driver
> and move the initialization into the probe() callback. You also need to
> put Wim as the watchdog subsystem maintainer on Cc (I did in this reply)
> and ask him to merge the driver.
> 
> I assume that Wim will ask you to add a watchdog_register_device() call
> and a set of watchdog_ops to make this a functional driver. From the
> platform perspective, I don't care, but it is certainly a logical step.

issue here is that there is already a proper watchdog driver, the sp805.

so I guess now the task shifts to adding restart hook support to it, right?

Kind regards,
Domenico

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-15 18:52     ` Domenico Andreoli
@ 2013-09-15 20:10       ` Arnd Bergmann
  2013-09-16  7:18         ` Domenico Andreoli
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2013-09-15 20:10 UTC (permalink / raw)
  To: Domenico Andreoli
  Cc: Domenico Andreoli, Olof Johansson, Wim Van Sebroeck,
	Russell King - ARM Linux, linux-watchdog, linux-arm-kernel

On Sunday 15 September 2013, Domenico Andreoli wrote:
> issue here is that there is already a proper watchdog driver, the sp805.
> 
> so I guess now the task shifts to adding restart hook support to it, right?

Yes, correct.

There is an interesting question however: we have to deal with the same driver
being used in some machines that need to use it as the only way to reset the
system, as well as the case where you actually want to use some other method.

An easy way to handle this would be a boolean device tree property that
tells the driver whether or not to register, but we might want to
come up with a more sophisticated way to have multiple reset handlers
registered an prioritized so we try the "best" one first. Maybe someone
else has an opinion on this. If not, just do the property.

	Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-15 20:10       ` Arnd Bergmann
@ 2013-09-16  7:18         ` Domenico Andreoli
  2013-09-16  8:45           ` Arnd Bergmann
  2013-09-16 12:00           ` Wim Van Sebroeck
  0 siblings, 2 replies; 8+ messages in thread
From: Domenico Andreoli @ 2013-09-16  7:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Domenico Andreoli, Olof Johansson, Wim Van Sebroeck,
	Russell King - ARM Linux, linux-watchdog, linux-arm-kernel

On Sun, Sep 15, 2013 at 10:10:36PM +0200, Arnd Bergmann wrote:
> On Sunday 15 September 2013, Domenico Andreoli wrote:
> > issue here is that there is already a proper watchdog driver, the sp805.
> > 
> > so I guess now the task shifts to adding restart hook support to it, right?
> 
> Yes, correct.
> 
> There is an interesting question however: we have to deal with the same driver
> being used in some machines that need to use it as the only way to reset the
> system, as well as the case where you actually want to use some other method.

in a certain sense, there is space for a generic watchdog based restart
hook mechanism but the current watchdog ops do not provide the necessary
guarantees in atomic context.

> An easy way to handle this would be a boolean device tree property that
> tells the driver whether or not to register, but we might want to
> come up with a more sophisticated way to have multiple reset handlers
> registered an prioritized so we try the "best" one first. Maybe someone
> else has an opinion on this. If not, just do the property.

the simplest solution I see is adding a DT option to the sp805 driver so
that it registers the restart hook when asked to do so.

need to investigate whether the sp805 DT support is provided by some generic
AMBA mechanism or is completely missing.

> 
> 	Arnd

thanks,
Domenico

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-16  7:18         ` Domenico Andreoli
@ 2013-09-16  8:45           ` Arnd Bergmann
  2013-09-16 12:00           ` Wim Van Sebroeck
  1 sibling, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2013-09-16  8:45 UTC (permalink / raw)
  To: Domenico Andreoli
  Cc: Domenico Andreoli, Olof Johansson, Wim Van Sebroeck,
	Russell King - ARM Linux, linux-watchdog, linux-arm-kernel

On Monday 16 September 2013, Domenico Andreoli wrote:
> On Sun, Sep 15, 2013 at 10:10:36PM +0200, Arnd Bergmann wrote:
> > On Sunday 15 September 2013, Domenico Andreoli wrote:
> > > issue here is that there is already a proper watchdog driver, the sp805.
> > > 
> > > so I guess now the task shifts to adding restart hook support to it, right?
> > 
> > Yes, correct.
> > 
> > There is an interesting question however: we have to deal with the same driver
> > being used in some machines that need to use it as the only way to reset the
> > system, as well as the case where you actually want to use some other method.
> 
> in a certain sense, there is space for a generic watchdog based restart
> hook mechanism but the current watchdog ops do not provide the necessary
> guarantees in atomic context.

It sounds like a good idea. I see another problem there, which is that registering
a restart hook is architecture specific at the moment, so it would also require
generalizing that, or alternatively keeping watchdog based restart specific to
ARM and any architecture that adds support in a similar way.

> > An easy way to handle this would be a boolean device tree property that
> > tells the driver whether or not to register, but we might want to
> > come up with a more sophisticated way to have multiple reset handlers
> > registered an prioritized so we try the "best" one first. Maybe someone
> > else has an opinion on this. If not, just do the property.
> 
> the simplest solution I see is adding a DT option to the sp805 driver so
> that it registers the restart hook when asked to do so.
> 
> need to investigate whether the sp805 DT support is provided by some generic
> AMBA mechanism or is completely missing.

I think it should just work if you put the right properties into DT: it only
uses one memory resource (from "reg" property) and one clk (from "clocks"
property), and those are automatically there for AMBA devices. If the hardware
does not fill the correct primecell ID, you may have to add a
"arm,primecell-periphid=<0x00141805>" property.

	Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-16  7:18         ` Domenico Andreoli
  2013-09-16  8:45           ` Arnd Bergmann
@ 2013-09-16 12:00           ` Wim Van Sebroeck
  2013-09-16 20:01             ` Arnd Bergmann
  1 sibling, 1 reply; 8+ messages in thread
From: Wim Van Sebroeck @ 2013-09-16 12:00 UTC (permalink / raw)
  To: Arnd Bergmann, Domenico Andreoli, Olof Johansson,
	Russell King - ARM Linux, linux-watchdog, linux-arm-kernel

Hi All,

> On Sun, Sep 15, 2013 at 10:10:36PM +0200, Arnd Bergmann wrote:
> > On Sunday 15 September 2013, Domenico Andreoli wrote:
> > > issue here is that there is already a proper watchdog driver, the sp805.
> > > 
> > > so I guess now the task shifts to adding restart hook support to it, right?
> > 
> > Yes, correct.
> > 
> > There is an interesting question however: we have to deal with the same driver
> > being used in some machines that need to use it as the only way to reset the
> > system, as well as the case where you actually want to use some other method.
> 
> in a certain sense, there is space for a generic watchdog based restart
> hook mechanism but the current watchdog ops do not provide the necessary
> guarantees in atomic context.

I remember that the Cobalt Devices have no ability to reboot themselves.
That's why the driver uses the reboot_notifier for rebooting the device.
See drivers/watchdog/alim7101_wdt.c .

I'll have a look to have an extra ops that adds this functionality in the framework.

Kind regards,
Wim.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-16 12:00           ` Wim Van Sebroeck
@ 2013-09-16 20:01             ` Arnd Bergmann
  2013-09-30 14:02               ` Domenico Andreoli
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2013-09-16 20:01 UTC (permalink / raw)
  To: Wim Van Sebroeck
  Cc: Domenico Andreoli, Olof Johansson, Russell King - ARM Linux,
	linux-watchdog, linux-arm-kernel

On Monday 16 September 2013 14:00:01 Wim Van Sebroeck wrote:
> 
> I remember that the Cobalt Devices have no ability to reboot themselves.
> That's why the driver uses the reboot_notifier for rebooting the device.
> See drivers/watchdog/alim7101_wdt.c .

Hmm, a notifier seems the wrong approach here, because we really want
to handle all reboot_notifiers before actually rebooting, and we'd enter
the wdt driver at a random point in the notifier chain. It probably works
by chance if the watchdog reboots a second after its notifier is called,
and all other calls are done as well, but it doesn't seem like a clean
solution.

> I'll have a look to have an extra ops that adds this functionality in the framework.

Ok, cool. Thanks!

	Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 4/4] ARM: bcm4760: Add restart hook
  2013-09-16 20:01             ` Arnd Bergmann
@ 2013-09-30 14:02               ` Domenico Andreoli
  0 siblings, 0 replies; 8+ messages in thread
From: Domenico Andreoli @ 2013-09-30 14:02 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Wim Van Sebroeck, Olof Johansson, Russell King - ARM Linux,
	linux-watchdog, linux-arm-kernel

Hi Wim,

On Mon, Sep 16, 2013 at 10:01:08PM +0200, Arnd Bergmann wrote:
> On Monday 16 September 2013 14:00:01 Wim Van Sebroeck wrote:
> > 
> > I remember that the Cobalt Devices have no ability to reboot themselves.
> > That's why the driver uses the reboot_notifier for rebooting the device.
> > See drivers/watchdog/alim7101_wdt.c .
> 
> Hmm, a notifier seems the wrong approach here, because we really want
> to handle all reboot_notifiers before actually rebooting, and we'd enter
> the wdt driver at a random point in the notifier chain. It probably works
> by chance if the watchdog reboots a second after its notifier is called,
> and all other calls are done as well, but it doesn't seem like a clean
> solution.
> 
> > I'll have a look to have an extra ops that adds this functionality in the framework.

I'd like to do something here.

I'm thinking at a simple "atomic_reset()" wdt op which purpose it to use
the specific watchdog to trigger a HW reset. As the name implies, the call
needs to be callable in atomic context. Any other constrains I'm missing?

At this point a DT attribute in the wdt stanzas could be used to register
the reboot hook at runtime.

thanks,
Domenico

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-09-30 14:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20130914152032.401907974@gmail.com>
     [not found] ` <20130914152124.317379835@gmail.com>
2013-09-15 18:09   ` [PATCH v4 4/4] ARM: bcm4760: Add restart hook Arnd Bergmann
2013-09-15 18:52     ` Domenico Andreoli
2013-09-15 20:10       ` Arnd Bergmann
2013-09-16  7:18         ` Domenico Andreoli
2013-09-16  8:45           ` Arnd Bergmann
2013-09-16 12:00           ` Wim Van Sebroeck
2013-09-16 20:01             ` Arnd Bergmann
2013-09-30 14:02               ` Domenico Andreoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).