diff mbox series

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

Message ID 20220309182439.1053856-1-kai.vehmanen@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v3] ALSA: hda/i915 - avoid hung task timeout in i915 wait | expand

Commit Message

Kai Vehmanen March 9, 2022, 6:24 p.m. UTC
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.

Co-developed-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 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


base-commit: 3a0099a1909dea6022690b0ae496938dd2e5771c

Comments

Tvrtko Ursulin March 10, 2022, 1:15 p.m. UTC | #1
On 09/03/2022 18:24, Kai Vehmanen wrote:
> 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.
> 
> Co-developed-by: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> ---
>   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
> 
> diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
> index 454474ac5716..efe810af28c5 100644
> --- a/sound/hda/hdac_i915.c
> +++ b/sound/hda/hdac_i915.c
> @@ -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.

Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

> 
> base-commit: 3a0099a1909dea6022690b0ae496938dd2e5771c
Takashi Iwai March 10, 2022, 1:36 p.m. UTC | #2
On Wed, 09 Mar 2022 19:24:39 +0100,
Kai Vehmanen wrote:
> 
> 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.
> 
> Co-developed-by: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Applied now.  Thanks.


Takashi
diff mbox series

Patch

diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 454474ac5716..efe810af28c5 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -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) {