* [PATCH v6 0/1] remoteproc: core: do pm relax when in
@ 2022-12-06 1:59 Maria Yu
2022-12-06 1:59 ` [PATCH v6 1/1] remoteproc: core: do pm_relax when in RPROC_OFFLINE state Maria Yu
0 siblings, 1 reply; 3+ messages in thread
From: Maria Yu @ 2022-12-06 1:59 UTC (permalink / raw)
To: mathieu.poirier, andersson, linux-remoteproc, linux-kernel
Cc: Maria Yu, quic_clew, quic_mojha
If the remote processor is offline, no need to recover anything, and
pm_relax is needed to be called.
summary from some discussion points:
pm_stay_awake() is needed to stop and reverse the suspend process that
is currently underway.
RPROC_OFFLINE state indicate there is no recovery process
is in progress and no chance to do the pm_relax.
Because when recovering from crash, rproc->lock is held and
state is RPROC_CRASHED -> RPROC_OFFLINE -> RPROC_RUNNING,
and then unlock rproc->lock.
When the state is in RPROC_OFFLINE it means separate request
of rproc_stop was done and no need to hold the wakeup source
in crash handler to recover any more.
Changelog
===
V6
---
Address the comments.
Drop the allocate ordered workqueue change.
V5
---
Use goto out instead of directly call pm_relax and return. Suggested by
Mathieu.
Add new change with allocate ordered workqueue for allow only 1 active
work.
V4
---
Add pm relax when in RPROC_OFFLINE.
previous discussion here:
[1] https://lore.kernel.org/lkml/1bcd3fe8-f68d-ea7f-c0f9-68771e3421d5@quicinc.com/
[2] https://lore.kernel.org/linux-remoteproc/20221202094532.2925-1-quic_aiquny@quicinc.com/T/#t
Maria Yu (1):
remoteproc: core: do pm_relax when in RPROC_OFFLINE state
drivers/remoteproc/remoteproc_core.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v6 1/1] remoteproc: core: do pm_relax when in RPROC_OFFLINE state
2022-12-06 1:59 [PATCH v6 0/1] remoteproc: core: do pm relax when in Maria Yu
@ 2022-12-06 1:59 ` Maria Yu
2022-12-07 18:36 ` Mathieu Poirier
0 siblings, 1 reply; 3+ messages in thread
From: Maria Yu @ 2022-12-06 1:59 UTC (permalink / raw)
To: mathieu.poirier, andersson, linux-remoteproc, linux-kernel
Cc: Maria Yu, quic_clew, quic_mojha
Make sure that pm_relax() happens even when the remoteproc
is stopped before the crash handler work is scheduled.
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
---
drivers/remoteproc/remoteproc_core.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 8768cb64f560..7419e1460f2a 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1862,12 +1862,18 @@ static void rproc_crash_handler_work(struct work_struct *work)
mutex_lock(&rproc->lock);
- if (rproc->state == RPROC_CRASHED || rproc->state == RPROC_OFFLINE) {
+ if (rproc->state == RPROC_CRASHED) {
/* handle only the first crash detected */
mutex_unlock(&rproc->lock);
return;
}
+ if (rproc->state == RPROC_OFFLINE) {
+ /* Don't recover if the remote processor was stopped */
+ mutex_unlock(&rproc->lock);
+ goto out;
+ }
+
rproc->state = RPROC_CRASHED;
dev_err(dev, "handling crash #%u in %s\n", ++rproc->crash_cnt,
rproc->name);
@@ -1877,6 +1883,7 @@ static void rproc_crash_handler_work(struct work_struct *work)
if (!rproc->recovery_disabled)
rproc_trigger_recovery(rproc);
+out:
pm_relax(rproc->dev.parent);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v6 1/1] remoteproc: core: do pm_relax when in RPROC_OFFLINE state
2022-12-06 1:59 ` [PATCH v6 1/1] remoteproc: core: do pm_relax when in RPROC_OFFLINE state Maria Yu
@ 2022-12-07 18:36 ` Mathieu Poirier
0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Poirier @ 2022-12-07 18:36 UTC (permalink / raw)
To: Maria Yu; +Cc: andersson, linux-remoteproc, linux-kernel, quic_clew, quic_mojha
On Tue, Dec 06, 2022 at 09:59:57AM +0800, Maria Yu wrote:
> Make sure that pm_relax() happens even when the remoteproc
> is stopped before the crash handler work is scheduled.
>
> Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
> ---
> drivers/remoteproc/remoteproc_core.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 8768cb64f560..7419e1460f2a 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -1862,12 +1862,18 @@ static void rproc_crash_handler_work(struct work_struct *work)
>
> mutex_lock(&rproc->lock);
>
> - if (rproc->state == RPROC_CRASHED || rproc->state == RPROC_OFFLINE) {
> + if (rproc->state == RPROC_CRASHED) {
> /* handle only the first crash detected */
> mutex_unlock(&rproc->lock);
> return;
> }
>
> + if (rproc->state == RPROC_OFFLINE) {
> + /* Don't recover if the remote processor was stopped */
> + mutex_unlock(&rproc->lock);
> + goto out;
> + }
> +
> rproc->state = RPROC_CRASHED;
> dev_err(dev, "handling crash #%u in %s\n", ++rproc->crash_cnt,
> rproc->name);
> @@ -1877,6 +1883,7 @@ static void rproc_crash_handler_work(struct work_struct *work)
> if (!rproc->recovery_disabled)
> rproc_trigger_recovery(rproc);
>
> +out:
> pm_relax(rproc->dev.parent);
I have applied this patch.
Thanks,
Mathieu
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-07 18:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 1:59 [PATCH v6 0/1] remoteproc: core: do pm relax when in Maria Yu
2022-12-06 1:59 ` [PATCH v6 1/1] remoteproc: core: do pm_relax when in RPROC_OFFLINE state Maria Yu
2022-12-07 18:36 ` Mathieu Poirier
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).