Skip to contentSkip to conversation

ALSA: hda/i915 - avoid hung task timeout in i915 wait

PATCH In review Kai Vehmanen 4 participants 4 messages Mar 9, 2022 – Mar 10, 2022 Sound

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ALSA: hda/i915 - avoid hung task timeout in i915 wait

If kernel is built with hung task detection enabled and CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set to less than 60 seconds, snd_hdac_i915_init() will trigger the hung task timeout in case i915 is not available and taint the kernel.

Use wait_for_completion_killable_timeout() for the wait to avoid this problem.

---
 sound/hda/hdac_i915.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Changes V2->V3:
- drop the loop and just use wait_for_completion_killable_timeout() (feedback from Tvrtko Ursulin)
- new approach, so dropped the previous reviewed-by tags

sound/hda/hdac_i915.c +2 -2
index 454474ac5716..efe810af28c5 100644
@@ -160,8 +160,8 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
 		if (!IS_ENABLED(CONFIG_MODULES) ||
 		    !request_module("i915")) {
 			/* 60s timeout */
-			wait_for_completion_timeout(&acomp->master_bind_complete,
-						    msecs_to_jiffies(60 * 1000));
+			wait_for_completion_killable_timeout(&acomp->master_bind_complete,
+							     msecs_to_jiffies(60 * 1000));
 		}
 	}
 	if (!acomp->ops) {

base-commit: 3a0099a1909dea6022690b0ae496938dd2e5771c

Signature · 1 line
2.35.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for ALSA: hda/i915 - avoid hung task timeout in i915 wait (rev3)

== Series Details ==

== Series Details ==

Series: ALSA: hda/i915 - avoid hung task timeout in i915 wait (rev3)
URL : https://patchwork.freedesktop.org/series/101156/
State : failure

== Summary ==

Applying: ALSA: hda/i915 - avoid hung task timeout in i915 wait Using index info to reconstruct a base tree...
M sound/hda/hdac_i915.c
Falling back to patching base and 3-way merge...
Auto-merging sound/hda/hdac_i915.c
CONFLICT (content): Merge conflict in sound/hda/hdac_i915.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 ALSA: hda/i915 - avoid hung task timeout in i915 wait When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

Acked-by on v3 1/1
#2 lore raw
In reply to Kai Vehmanen
Quoted 25 lines · Kai Vehmanen

If kernel is built with hung task detection enabled and CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set to less than 60 seconds, snd_hdac_i915_init() will trigger the hung task timeout in case i915 is not available and taint the kernel.

Use wait_for_completion_killable_timeout() for the wait to avoid this problem.

---
  sound/hda/hdac_i915.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Changes V2->V3:
- drop the loop and just use wait_for_completion_killable_timeout() (feedback from Tvrtko Ursulin)
- new approach, so dropped the previous reviewed-by tags

sound/hda/hdac_i915.c +0 -0
index 454474ac5716..efe810af28c5 100644

sound/hda/hdac_i915.c int snd_hdac_i915_init(struct hdac_bus *bus) · line 167

Quoted 10 lines
sound/hda/hdac_i915.c +2 -2
@@ -160,8 +160,8 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
  		if (!IS_ENABLED(CONFIG_MODULES) ||
  		    !request_module("i915")) {
  			/* 60s timeout */
-			wait_for_completion_timeout(&acomp->master_bind_complete,
-						    msecs_to_jiffies(60 * 1000));
+			wait_for_completion_killable_timeout(&acomp->master_bind_complete,
+							     msecs_to_jiffies(60 * 1000));
  		}
  	}
  	if (!acomp->ops) {

Works for me, as discussed I think this is more correct.

Regards,

Tvrtko

Quoted 2 lines

base-commit: 3a0099a1909dea6022690b0ae496938dd2e5771c

#3 lore raw
In reply to Kai Vehmanen
Quoted 6 lines · Kai Vehmanen

If kernel is built with hung task detection enabled and CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set to less than 60 seconds, snd_hdac_i915_init() will trigger the hung task timeout in case i915 is not available and taint the kernel.

Quoted 6 lines

Use wait_for_completion_killable_timeout() for the wait to avoid this problem.

Applied now. Thanks.

Takashi