Skip to contentSkip to conversation

PM / suspend: show workqueues busy name in suspend flow

PATCH Tejun Heo 2 participants 4 messages Jun 22, 2016 – Jun 29, 2016 2 messages not in the archive Arm MediaTek

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Tejun Heo

author
#1 lore raw

Hello,

Quoted 28 lines · Roger Lu

When suspend flow is aborted because of workqueues busy, show workqueues busy name for debug purpose.

---
 include/linux/workqueue.h |  1 +
 kernel/power/process.c    |  3 +++
 kernel/workqueue.c        | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)
include/linux/workqueue.h +1 -0
index ca73c50..c9f9b24 100644
@@ -609,6 +609,7 @@ long work_on_cpu(int cpu, long (*fn)(void *), void
 *arg);
 #ifdef CONFIG_FREEZER
 extern void freeze_workqueues_begin(void);
 extern bool freeze_workqueues_busy(void);
+extern void show_workqueues_busy(void);
 extern void thaw_workqueues(void);
 #endif /* CONFIG_FREEZER */
kernel/power/process.c +0 -0
index df058be..b538881 100644

kernel/power/process.c static int try_to_freeze_tasks(bool user_only) · line 93

Quoted 5 lines
kernel/power/process.c +2 -0
@@ -89,6 +89,9 @@ static int try_to_freeze_tasks(bool user_only)
 		       elapsed_msecs / 1000, elapsed_msecs % 1000,
 		       todo - wq_busy, wq_busy);
 
+		if (wq_busy)
+			show_workqueues_busy();

I think it'd probably be better to call show_workqueue_state() instead so that we can get a full picture of what's going on.

Thanks.

Signature · 1 line
tejun

A message that is not in the archive (sent off-list or not yet received): 1467020645.25092.24.camel@mtksdaap41

author
#3 lore raw

Hello, Roger.

Quoted 6 lines · Roger Lu

show_workqueue_state() is a better choice to me. However, only freezable workqueue is able to affect suspend flow. So, is there other mailing list discussing about showing freezable workqueue state only?? Maybe we can use that API in this case. Thanks very much.

freezable workqueue means workqueue is created with flag WQ_FREEZABLE.

It's for debugging anyway and workqueue dumps usually are pretty short. I don't think it's fine to use the same function. We can add flags in the printouts but I'm not even sure that'd be necessary.

Thanks.

Signature · 1 line
tejun
#4 lore raw

Dear Tejun,

Quoted 8 lines · Tejun Heo

Hello, Roger.

Quoted 5 lines · Roger Lu

show_workqueue_state() is a better choice to me. However, only freezable workqueue is able to affect suspend flow. So, is there other mailing list discussing about showing freezable workqueue state only?? Maybe we can use that API in this case. Thanks very much.

Quoted 8 lines
Quoted 1 line

freezable workqueue means workqueue is created with flag WQ_FREEZABLE.

It's for debugging anyway and workqueue dumps usually are pretty short. I don't think it's fine to use the same function. We can add flags in the printouts but I'm not even sure that'd be necessary.

Thanks.

Please allow me to elaborate my previous concern about printing freezable workqueue info only in this case.

The benefit of it is that debugger can quickly understand which freezable workqueues block suspend flow and assign this issue to corresponding owner instead of extracting freezable workqueue info from show_workqueue_state() first and, then, assigning the issue.

Adding a flag to printout the info we need is great. Perhaps we can do that. Thanks for the advice.

Sincerely,
Roger Lu.

author
#5 lore raw

Hello, Roger.

Quoted 7 lines · Roger Lu

Please allow me to elaborate my previous concern about printing freezable workqueue info only in this case.

The benefit of it is that debugger can quickly understand which freezable workqueues block suspend flow and assign this issue to corresponding owner instead of extracting freezable workqueue info from show_workqueue_state() first and, then, assigning the issue.

I don't think it matters. At that point, workqueues are generally pretty idle anyway and it shouldn't be difficult to tell which work items are the offending ones. Besides, freezable and unfreezable workqueues share the same backend pools, so it isn't easily separable either.

Thanks.

Signature · 1 line
tejun