Skip to content

Commit cab8300

Browse files
Mukesh Ojhaandersson
authored andcommitted
remoteproc: Use unbounded workqueue for recovery work
There could be a scenario when there is too much load on a core (n number of tasks which is affined) or in a case when multiple rproc subsystem is going for recovery, they queue their recovery work to one core so even though subsystem are independent their recovery will be delayed if one of the subsystem recovery work is taking more time in completing. If we make this queue unbounded, the recovery work could be picked on any cpu. This patch is trying to address this. Signed-off-by: Mukesh Ojha <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 60349fd commit cab8300

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/remoteproc/remoteproc_core.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ static int rproc_release_carveout(struct rproc *rproc,
5959

6060
/* Unique indices for remoteproc devices */
6161
static DEFINE_IDA(rproc_dev_index);
62+
static struct workqueue_struct *rproc_recovery_wq;
6263

6364
static const char * const rproc_crash_names[] = {
6465
[RPROC_MMUFAULT] = "mmufault",
@@ -2763,8 +2764,7 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
27632764
dev_err(&rproc->dev, "crash detected in %s: type %s\n",
27642765
rproc->name, rproc_crash_to_string(type));
27652766

2766-
/* Have a worker handle the error; ensure system is not suspended */
2767-
queue_work(system_freezable_wq, &rproc->crash_handler);
2767+
queue_work(rproc_recovery_wq, &rproc->crash_handler);
27682768
}
27692769
EXPORT_SYMBOL(rproc_report_crash);
27702770

@@ -2813,6 +2813,13 @@ static void __exit rproc_exit_panic(void)
28132813

28142814
static int __init remoteproc_init(void)
28152815
{
2816+
rproc_recovery_wq = alloc_workqueue("rproc_recovery_wq",
2817+
WQ_UNBOUND | WQ_FREEZABLE, 0);
2818+
if (!rproc_recovery_wq) {
2819+
pr_err("remoteproc: creation of rproc_recovery_wq failed\n");
2820+
return -ENOMEM;
2821+
}
2822+
28162823
rproc_init_sysfs();
28172824
rproc_init_debugfs();
28182825
rproc_init_cdev();
@@ -2826,9 +2833,13 @@ static void __exit remoteproc_exit(void)
28262833
{
28272834
ida_destroy(&rproc_dev_index);
28282835

2836+
if (!rproc_recovery_wq)
2837+
return;
2838+
28292839
rproc_exit_panic();
28302840
rproc_exit_debugfs();
28312841
rproc_exit_sysfs();
2842+
destroy_workqueue(rproc_recovery_wq);
28322843
}
28332844
module_exit(remoteproc_exit);
28342845

0 commit comments

Comments
 (0)