Skip to contentSkip to conversation

Query on moving Recovery remoteproc work to a separate wq instead of system freezable wq

PATCH Mukesh Ojha 2 participants 3 messages Jan 17, 2022 – Jan 18, 2022 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

Hi,

There could be a situation there is too much load(of tasks which is affined to particular core) on a core on which  rproc recovery thread will not get a chance to run with no reason but the load. If we make this queue unbound, then this work can run on any core.

Kindly Let me if i can post a proper patch for this like below.

drivers/remoteproc/remoteproc_core.c +0 -0
@@ -59,6 +59,7 @@ static int rproc_release_carveout(struct rproc *rproc,
 

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

 static const char * const rproc_crash_names[] = {
        [RPROC_MMUFAULT]        = "mmufault",
@@ -2487,7 +2488,7 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type) rproc->name, rproc_crash_to_string(type));

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

@@ -2532,6 +2533,12 @@ static void __exit rproc_exit_panic(void)

 static int __init remoteproc_init(void)
 {
+       rproc_recovery_wq = alloc_workqueue("rproc_recovery_wq", WQ_UNBOUND | +                               WQ_HIGHPRI | WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0); +       if (!rproc_recovery_wq) {
+               pr_err("creation of rproc_recovery_wq failed\n");
+       }
+

Thanks,
Mukesh

#1 lore raw
Quoted 3 lines · Mukesh Ojha

Hi,

There could be a situation there is too much load(of tasks which is affined

As in "it's theoretically possible" or "we run into this issue all the time"?

Quoted 32 lines

to particular core) on a core on which  rproc
recovery thread will not get a chance to run with no reason but the load. If we make this queue unbound, then this work
can run on any core.

Kindly Let me if i can post a proper patch for this like below.

drivers/remoteproc/remoteproc_core.c +3 -1
@@ -59,6 +59,7 @@ static int rproc_release_carveout(struct rproc *rproc,
 
  /* Unique indices for remoteproc devices */
  static DEFINE_IDA(rproc_dev_index);
+static struct workqueue_struct *rproc_recovery_wq;
 
  static const char * const rproc_crash_names[] = {
         [RPROC_MMUFAULT]        = "mmufault",
@@ -2487,7 +2488,7 @@ void rproc_report_crash(struct rproc *rproc, enum
 rproc_crash_type type)
                 rproc->name, rproc_crash_to_string(type));
 
         /* Have a worker handle the error; ensure system is not suspended */
-       queue_work(system_freezable_wq, &rproc->crash_handler);
+       queue_work(rproc_recovery_wq, &rproc->crash_handler);
  }
  EXPORT_SYMBOL(rproc_report_crash);
@@ -2532,6 +2533,12 @@ static void __exit rproc_exit_panic(void)
 
  static int __init remoteproc_init(void)
  {
+       rproc_recovery_wq = alloc_workqueue("rproc_recovery_wq", WQ_UNBOUND
Quoted 3 lines

|
+                               WQ_HIGHPRI | WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0);

Afaict this is not only a separate work queue, but a high priority, "cpu intensive" work queue. Does that really represent the urgency of getting the recovery under way?

Regards,
Bjorn

Quoted 7 lines

+       if (!rproc_recovery_wq) {
+               pr_err("creation of rproc_recovery_wq failed\n"); +       }
+

Thanks,
Mukesh

#2 lore raw
Quoted 7 lines · Bjorn Andersson
Quoted 3 lines · Mukesh Ojha

Hi,

There could be a situation there is too much load(of tasks which is affined

As in "it's theoretically possible" or "we run into this issue all the time"?

During recovery we notify all the remoteproc kernel clients about the crash and if one of the notification gets stuck

for more than 20-30s we ideally inject panic . During analysis, We saw that just because of the load(stress testing) on the

core we are not able to proceed. would be good to avail this work to run on different CPU.

Quoted 30 lines
Quoted 30 lines

to particular core) on a core on which  rproc
recovery thread will not get a chance to run with no reason but the load. If we make this queue unbound, then this work
can run on any core.

Kindly Let me if i can post a proper patch for this like below.

drivers/remoteproc/remoteproc_core.c +2 -1
@@ -59,6 +59,7 @@ static int rproc_release_carveout(struct rproc *rproc,
 
  /* Unique indices for remoteproc devices */
  static DEFINE_IDA(rproc_dev_index);
+static struct workqueue_struct *rproc_recovery_wq;
 
  static const char * const rproc_crash_names[] = {
         [RPROC_MMUFAULT]        = "mmufault",
@@ -2487,7 +2488,7 @@ void rproc_report_crash(struct rproc *rproc, enum
 rproc_crash_type type)
                 rproc->name, rproc_crash_to_string(type));
 
         /* Have a worker handle the error; ensure system is not suspended */
-       queue_work(system_freezable_wq, &rproc->crash_handler);
+       queue_work(rproc_recovery_wq, &rproc->crash_handler);
  }
  EXPORT_SYMBOL(rproc_report_crash);
@@ -2532,6 +2533,12 @@ static void __exit rproc_exit_panic(void)
 
Quoted 9 lines
Quoted 6 lines
drivers/remoteproc/remoteproc_core.c +1 -0
  static int __init remoteproc_init(void)
  {
+       rproc_recovery_wq = alloc_workqueue("rproc_recovery_wq", WQ_UNBOUND

|
+                               WQ_HIGHPRI | WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0);

Afaict this is not only a separate work queue, but a high priority, "cpu intensive" work queue. Does that really represent the urgency of getting the recovery under way?

Adding a WQ_CPU_INTENSIVE(no use) here is a blunder from my end, will remove this.

Thanks,
-Mukesh

Quoted 10 lines

Regards,
Bjorn

Quoted 7 lines

+       if (!rproc_recovery_wq) {
+               pr_err("creation of rproc_recovery_wq failed\n"); +       }
+

Thanks,
Mukesh