linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 2/3] remoteproc: recover a remoteproc when it has crashed
@ 2012-08-20 13:07 Sjur Brændeland
  2012-08-20 20:45 ` Guzman Lugo, Fernando
  0 siblings, 1 reply; 4+ messages in thread
From: Sjur Brændeland @ 2012-08-20 13:07 UTC (permalink / raw)
  To: Fernando Guzman Lugo, Ohad Ben-Cohen; +Cc: LKML

Hi Fernando,

>This patch is introducing rproc_trigger_recover function which is in
>charge of recovering the rproc. One way to recover the rproc after a crash
>is resetting all its virtio devices. Doing that, all rpmsg drivers are
>restored along with the rpmsg devices and that also causes the reset of
>the remoteproc making the rpmsg communication with the remoteproc
>functional again. So far, rproc_trigger_recover function is only resetting
>all virtio devices, if in the future other rproc features are introduced
>and need to be reset too, rproc_trigger_recover function should take care
>of that.

I think you drop the driver module's ref count during recovery, because
rproc_shutdown calls module_put(). Maybe you should move driver
ref count handling to rproc_add and rproc_type_release, instead of
rproc_boot() and rproc_shutdown()?

...
>+int rproc_trigger_recover(struct rproc *rproc)
>+{
>+	struct rproc_vdev *rvdev, *rvtmp;
>+
>+	dev_err(&rproc->dev, "recovering %s\n", rproc->name);
>+
>+	/* clean up remote vdev entries */
>+	list_for_each_entry_safe(rvdev, rvtmp, &rproc->rvdevs, node)
>+		rproc_remove_virtio_dev(rvdev);

...

Is this safe? Are you guaranteed that rproc->power
is counted down to zero at this point. Won't this fail if the
firmware loading starts before all clients has called
rproc_shutdown()?

I guess virtio drivers potentially could defer the call to del_vqs()
to a work-queue. In this case  you cannot be guaranteed that the
rproc is shut down at this point. You may also have e.g. platform
driver who has previously called rproc_boot() and calls
rproc_shutdown() after calling rproc_crash().

I think you should wait for the rproc->power count to go to zero
before initiating the firmware_loading. You could e.g.
move firmware_loading to rproc_shutdown(), or add a
completion.

BTW: I ran into a bug in unregister_virtio_device when testing
your feature with SLAB_DEBUG=y. The dev->index is accessed
after the device is freed. I'll submit a patch on this at some point.

After fixing that, your patch works for me!

Regards,
Sjur

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH 0/3] remoteproc: introduce rproc recovery
@ 2012-08-08 23:07 Fernando Guzman Lugo
  2012-08-08 23:07 ` [PATCH 2/3] remoteproc: recover a remoteproc when it has crashed Fernando Guzman Lugo
  0 siblings, 1 reply; 4+ messages in thread
From: Fernando Guzman Lugo @ 2012-08-08 23:07 UTC (permalink / raw)
  To: ohad, linux-omap, linux-arm-kernel, linux-kernel; +Cc: Fernando Guzman Lugo

These set of patches make possible the remoteproc recover after a crash.
This is a hard recovery, that means the remoteproc is reset and it will
start from the beginning. When a crash happen all the virtio devices are
destroyed. Therefore, both rpmsg drivers and devices are gracefully
removed which also cause rproc users become 0 and the remoteproc is turned
off. After the virtio devices are destroyed the crash handler function
will read the virtio information from the firmware in order to recreate
the virtio devices that will boot the remoteproc and everything will be
functional again.

Fernando Guzman Lugo (3):
  remoteproc: add rproc_report_crash function to notify rproc crashes
  remoteproc: recover a remoteproc when it has crashed
  remoteproc: create debugfs entry to disable/enable recovery
    dynamically

 Documentation/remoteproc.txt             |    7 ++
 drivers/remoteproc/remoteproc_core.c     |  107 ++++++++++++++++++++++++++++--
 drivers/remoteproc/remoteproc_debugfs.c  |   83 +++++++++++++++++++++++
 drivers/remoteproc/remoteproc_internal.h |    1 +
 include/linux/remoteproc.h               |   20 ++++++
 5 files changed, 211 insertions(+), 7 deletions(-)


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

end of thread, other threads:[~2012-08-22 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-20 13:07 [PATCH 2/3] remoteproc: recover a remoteproc when it has crashed Sjur Brændeland
2012-08-20 20:45 ` Guzman Lugo, Fernando
2012-08-22 11:57   ` Sjur BRENDELAND
  -- strict thread matches above, loose matches on Subject: below --
2012-08-08 23:07 [PATCH 0/3] remoteproc: introduce rproc recovery Fernando Guzman Lugo
2012-08-08 23:07 ` [PATCH 2/3] remoteproc: recover a remoteproc when it has crashed Fernando Guzman Lugo

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).