All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remoteproc: Create a separate workqueue for recovery tasks
@ 2020-12-12 20:48 Rishabh Bhatnagar
  2020-12-15 22:55 ` Bjorn Andersson
  0 siblings, 1 reply; 7+ messages in thread
From: Rishabh Bhatnagar @ 2020-12-12 20:48 UTC (permalink / raw)
  To: linux-remoteproc, linux-kernel
  Cc: tsoni, bjorn.andersson, psodagud, sidgup, Rishabh Bhatnagar

Create an unbound high priority workqueue for recovery tasks.
Recovery time is an important parameter for a subsystem and there
might be situations where multiple subsystems crash around the same
time. Scheduling into an unbound workqueue increases parallelization
and avoids time impact. Also creating a high priority workqueue
will utilize separate worker threads with higher nice values than
normal ones.

Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
---
 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 46c2937..8fd8166 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -48,6 +48,8 @@ static DEFINE_MUTEX(rproc_list_mutex);
 static LIST_HEAD(rproc_list);
 static struct notifier_block rproc_panic_nb;
 
+static struct workqueue_struct *rproc_wq;
+
 typedef int (*rproc_handle_resource_t)(struct rproc *rproc,
 				 void *, int offset, int avail);
 
@@ -2475,7 +2477,7 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
 		rproc->name, rproc_crash_to_string(type));
 
 	/* create a new task to handle the error */
-	schedule_work(&rproc->crash_handler);
+	queue_work(rproc_wq, &rproc->crash_handler);
 }
 EXPORT_SYMBOL(rproc_report_crash);
 
@@ -2520,6 +2522,10 @@ static void __exit rproc_exit_panic(void)
 
 static int __init remoteproc_init(void)
 {
+	rproc_wq = alloc_workqueue("rproc_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
+	if (!rproc_wq)
+		return -ENOMEM;
+
 	rproc_init_sysfs();
 	rproc_init_debugfs();
 	rproc_init_cdev();
@@ -2536,6 +2542,7 @@ static void __exit remoteproc_exit(void)
 	rproc_exit_panic();
 	rproc_exit_debugfs();
 	rproc_exit_sysfs();
+	destroy_workqueue(rproc_wq);
 }
 module_exit(remoteproc_exit);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

end of thread, other threads:[~2021-01-08 21:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12 20:48 [PATCH] remoteproc: Create a separate workqueue for recovery tasks Rishabh Bhatnagar
2020-12-15 22:55 ` Bjorn Andersson
2020-12-17 16:12   ` Alex Elder
2020-12-17 18:21     ` rishabhb
2020-12-17 18:49       ` Alex Elder
2020-12-22  0:35         ` Bjorn Andersson
2021-01-08 21:03           ` rishabhb

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.