Skip to contentSkip to conversation

remoteproc: core: Prevent system suspend during remoteproc recovery

PATCH Applied Rishabh Bhatnagar 3 participants 3 messages Apr 29, 2020 – May 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: core: Prevent system suspend during remoteproc recovery

The system might go into suspend during recovery of any remoteproc. This will interrupt the recovery process in between increasing the recovery time. Make the platform device as wakeup capable and use pm_stay_wake/pm_relax APIs to avoid system from going into suspend during recovery.

---
 drivers/remoteproc/qcom_q6v5_pas.c   | 2 ++
 drivers/remoteproc/remoteproc_core.c | 5 +++++
 2 files changed, 7 insertions(+)
drivers/remoteproc/qcom_q6v5_pas.c +2 -0
index edf9d0e..e608578 100644
@@ -398,6 +398,8 @@ static int adsp_probe(struct platform_device *pdev)
 	adsp->has_aggre2_clk = desc->has_aggre2_clk;
 	platform_set_drvdata(pdev, adsp);
 
+	device_wakeup_enable(adsp->dev);
+
 	ret = adsp_alloc_memory_region(adsp);
 	if (ret)
 		goto free_rproc;
drivers/remoteproc/remoteproc_core.c +5 -0
index 097f33e..6a1cb98 100644
@@ -1712,6 +1712,8 @@ static void rproc_crash_handler_work(struct work_struct *work)
 
 	if (!rproc->recovery_disabled)
 		rproc_trigger_recovery(rproc);
+
+	pm_relax(rproc->dev.parent);
 }
 
 /**
@@ -2208,6 +2210,9 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
 		return;
 	}
 
+	/* Prevent suspend while the remoteproc is being recovered */
+	pm_stay_awake(rproc->dev.parent);
+
 	dev_err(&rproc->dev, "crash detected in %s: type %s\n",
 		rproc->name, rproc_crash_to_string(type));
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
Quoted 10 lines · Rishabh Bhatnagar

The system might go into suspend during recovery of any remoteproc. This will interrupt the recovery process in between increasing the recovery time. Make the platform device as wakeup capable and use pm_stay_wake/pm_relax APIs to avoid system from going into suspend during recovery.

---

Please don't forget to add a version to $subject and provide a Changelog here next time you're respinning something.

I've picked this up now.

Thanks,
Bjorn

Quoted 43 lines
 drivers/remoteproc/qcom_q6v5_pas.c   | 2 ++
 drivers/remoteproc/remoteproc_core.c | 5 +++++
 2 files changed, 7 insertions(+)
drivers/remoteproc/qcom_q6v5_pas.c +2 -0
index edf9d0e..e608578 100644
@@ -398,6 +398,8 @@ static int adsp_probe(struct platform_device *pdev)
 	adsp->has_aggre2_clk = desc->has_aggre2_clk;
 	platform_set_drvdata(pdev, adsp);
 
+	device_wakeup_enable(adsp->dev);
+
 	ret = adsp_alloc_memory_region(adsp);
 	if (ret)
 		goto free_rproc;
drivers/remoteproc/remoteproc_core.c +5 -0
index 097f33e..6a1cb98 100644
@@ -1712,6 +1712,8 @@ static void rproc_crash_handler_work(struct work_struct *work)
 
 	if (!rproc->recovery_disabled)
 		rproc_trigger_recovery(rproc);
+
+	pm_relax(rproc->dev.parent);
 }
 
 /**
@@ -2208,6 +2210,9 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
 		return;
 	}
 
+	/* Prevent suspend while the remoteproc is being recovered */
+	pm_stay_awake(rproc->dev.parent);
+
 	dev_err(&rproc->dev, "crash detected in %s: type %s\n",
 		rproc->name, rproc_crash_to_string(type));
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
In reply to Rishabh Bhatnagar
This patch was applied to andersson/remoteproc.git (refs/heads/for-next).

Hello:

This patch was applied to andersson/remoteproc.git (refs/heads/for-next).

Quoted 11 lines · On Wed, 29 Apr 2020 11:04:42 -0700 you wrote:

The system might go into suspend during recovery of any remoteproc. This will interrupt the recovery process in between increasing the recovery time. Make the platform device as wakeup capable and use pm_stay_wake/pm_relax APIs to avoid system from going into suspend during recovery.

[...]

Here is a summary with links:
- remoteproc: core: Prevent system suspend during remoteproc recovery

    https://git.kernel.org/andersson/remoteproc/c/a781e5aa59110d002a56bd41a397c0c8892f0609

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot