* [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
@ 2022-03-08 14:11 ` Kai Vehmanen
0 siblings, 0 replies; 7+ messages in thread
From: Kai Vehmanen @ 2022-03-08 14:11 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: Ramalingam C, intel-gfx, Lucas De Marchi, 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.
Split the 60sec wait into a loop of smaller waits to avoid this.
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
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 | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 454474ac5716..6219de739b56 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -143,7 +143,8 @@ static bool i915_gfx_present(void)
int snd_hdac_i915_init(struct hdac_bus *bus)
{
struct drm_audio_component *acomp;
- int err;
+ unsigned long wait = 0;
+ int err, i;
if (!i915_gfx_present())
return -ENODEV;
@@ -159,9 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
if (!acomp->ops) {
if (!IS_ENABLED(CONFIG_MODULES) ||
!request_module("i915")) {
- /* 60s timeout */
- wait_for_completion_timeout(&acomp->master_bind_complete,
- msecs_to_jiffies(60 * 1000));
+ /* max 60s timeout */
+ for (i = 0; !wait && i < 60; i++)
+ wait = wait_for_completion_timeout(&acomp->master_bind_complete,
+ msecs_to_jiffies(1000));
}
}
if (!acomp->ops) {
base-commit: fd7698cf0858f8c5e659b655109cd93c2f15cdd3
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
@ 2022-03-08 14:11 ` Kai Vehmanen
0 siblings, 0 replies; 7+ messages in thread
From: Kai Vehmanen @ 2022-03-08 14:11 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: intel-gfx, Lucas De Marchi
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.
Split the 60sec wait into a loop of smaller waits to avoid this.
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
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 | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 454474ac5716..6219de739b56 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -143,7 +143,8 @@ static bool i915_gfx_present(void)
int snd_hdac_i915_init(struct hdac_bus *bus)
{
struct drm_audio_component *acomp;
- int err;
+ unsigned long wait = 0;
+ int err, i;
if (!i915_gfx_present())
return -ENODEV;
@@ -159,9 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
if (!acomp->ops) {
if (!IS_ENABLED(CONFIG_MODULES) ||
!request_module("i915")) {
- /* 60s timeout */
- wait_for_completion_timeout(&acomp->master_bind_complete,
- msecs_to_jiffies(60 * 1000));
+ /* max 60s timeout */
+ for (i = 0; !wait && i < 60; i++)
+ wait = wait_for_completion_timeout(&acomp->master_bind_complete,
+ msecs_to_jiffies(1000));
}
}
if (!acomp->ops) {
base-commit: fd7698cf0858f8c5e659b655109cd93c2f15cdd3
--
2.35.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
2022-03-08 14:11 ` [Intel-gfx] " Kai Vehmanen
(?)
@ 2022-03-08 16:05 ` Lucas De Marchi
-1 siblings, 0 replies; 7+ messages in thread
From: Lucas De Marchi @ 2022-03-08 16:05 UTC (permalink / raw)
To: Kai Vehmanen; +Cc: tiwai, alsa-devel, intel-gfx
On Tue, Mar 08, 2022 at 04:11:12PM +0200, 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.
>
>Split the 60sec wait into a loop of smaller waits to avoid this.
>
>Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>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>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
thanks
Lucas De Marchi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
2022-03-08 14:11 ` [Intel-gfx] " Kai Vehmanen
@ 2022-03-08 16:29 ` Amadeusz Sławiński
-1 siblings, 0 replies; 7+ messages in thread
From: Amadeusz Sławiński @ 2022-03-08 16:29 UTC (permalink / raw)
To: Kai Vehmanen, alsa-devel, tiwai; +Cc: Ramalingam C, intel-gfx, Lucas De Marchi
On 3/8/2022 3:11 PM, 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.
>
> Split the 60sec wait into a loop of smaller waits to avoid this.
>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> 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 | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
> index 454474ac5716..6219de739b56 100644
> --- a/sound/hda/hdac_i915.c
> +++ b/sound/hda/hdac_i915.c
> @@ -143,7 +143,8 @@ static bool i915_gfx_present(void)
> int snd_hdac_i915_init(struct hdac_bus *bus)
> {
> struct drm_audio_component *acomp;
> - int err;
> + unsigned long wait = 0;
I'm not sure if it is best name for variable that is set to 0 ("false"),
maybe `done` would be better? Especially looking at condition in the
following for loop.
> + int err, i;
>
> if (!i915_gfx_present())
> return -ENODEV;
> @@ -159,9 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
> if (!acomp->ops) {
> if (!IS_ENABLED(CONFIG_MODULES) ||
> !request_module("i915")) {
> - /* 60s timeout */
> - wait_for_completion_timeout(&acomp->master_bind_complete,
> - msecs_to_jiffies(60 * 1000));
> + /* max 60s timeout */
> + for (i = 0; !wait && i < 60; i++)
> + wait = wait_for_completion_timeout(&acomp->master_bind_complete,
> + msecs_to_jiffies(1000));
> }
> }
> if (!acomp->ops) {
>
> base-commit: fd7698cf0858f8c5e659b655109cd93c2f15cdd3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
@ 2022-03-08 16:29 ` Amadeusz Sławiński
0 siblings, 0 replies; 7+ messages in thread
From: Amadeusz Sławiński @ 2022-03-08 16:29 UTC (permalink / raw)
To: Kai Vehmanen, alsa-devel, tiwai; +Cc: intel-gfx, Lucas De Marchi
On 3/8/2022 3:11 PM, 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.
>
> Split the 60sec wait into a loop of smaller waits to avoid this.
>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> 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 | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
> index 454474ac5716..6219de739b56 100644
> --- a/sound/hda/hdac_i915.c
> +++ b/sound/hda/hdac_i915.c
> @@ -143,7 +143,8 @@ static bool i915_gfx_present(void)
> int snd_hdac_i915_init(struct hdac_bus *bus)
> {
> struct drm_audio_component *acomp;
> - int err;
> + unsigned long wait = 0;
I'm not sure if it is best name for variable that is set to 0 ("false"),
maybe `done` would be better? Especially looking at condition in the
following for loop.
> + int err, i;
>
> if (!i915_gfx_present())
> return -ENODEV;
> @@ -159,9 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
> if (!acomp->ops) {
> if (!IS_ENABLED(CONFIG_MODULES) ||
> !request_module("i915")) {
> - /* 60s timeout */
> - wait_for_completion_timeout(&acomp->master_bind_complete,
> - msecs_to_jiffies(60 * 1000));
> + /* max 60s timeout */
> + for (i = 0; !wait && i < 60; i++)
> + wait = wait_for_completion_timeout(&acomp->master_bind_complete,
> + msecs_to_jiffies(1000));
> }
> }
> if (!acomp->ops) {
>
> base-commit: fd7698cf0858f8c5e659b655109cd93c2f15cdd3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
2022-03-08 16:29 ` [Intel-gfx] " Amadeusz Sławiński
@ 2022-03-08 16:37 ` Takashi Iwai
-1 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2022-03-08 16:37 UTC (permalink / raw)
To: Amadeusz SX2awiX4ski
Cc: Ramalingam C, alsa-devel, Lucas De Marchi, intel-gfx,
Kai Vehmanen
On Tue, 08 Mar 2022 17:29:21 +0100,
Amadeusz SX2awiX4ski wrote:
>
> On 3/8/2022 3:11 PM, 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.
> >
> > Split the 60sec wait into a loop of smaller waits to avoid this.
> >
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > 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 | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
> > index 454474ac5716..6219de739b56 100644
> > --- a/sound/hda/hdac_i915.c
> > +++ b/sound/hda/hdac_i915.c
> > @@ -143,7 +143,8 @@ static bool i915_gfx_present(void)
> > int snd_hdac_i915_init(struct hdac_bus *bus)
> > {
> > struct drm_audio_component *acomp;
> > - int err;
> > + unsigned long wait = 0;
>
> I'm not sure if it is best name for variable that is set to 0
> ("false"), maybe `done` would be better? Especially looking at
> condition in the following for loop.
Or, more simply some thing like
/* max 60s timeout */
for (i = 0; i < 60; i++) {
if (wait_for_completion_timeout(&acomp->master_bind_complete,
msecs_to_jiffies(1000)))
break;
}
Takashi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait
@ 2022-03-08 16:37 ` Takashi Iwai
0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2022-03-08 16:37 UTC (permalink / raw)
To: Amadeusz SX2awiX4ski; +Cc: alsa-devel, Lucas De Marchi, intel-gfx
On Tue, 08 Mar 2022 17:29:21 +0100,
Amadeusz SX2awiX4ski wrote:
>
> On 3/8/2022 3:11 PM, 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.
> >
> > Split the 60sec wait into a loop of smaller waits to avoid this.
> >
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > 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 | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
> > index 454474ac5716..6219de739b56 100644
> > --- a/sound/hda/hdac_i915.c
> > +++ b/sound/hda/hdac_i915.c
> > @@ -143,7 +143,8 @@ static bool i915_gfx_present(void)
> > int snd_hdac_i915_init(struct hdac_bus *bus)
> > {
> > struct drm_audio_component *acomp;
> > - int err;
> > + unsigned long wait = 0;
>
> I'm not sure if it is best name for variable that is set to 0
> ("false"), maybe `done` would be better? Especially looking at
> condition in the following for loop.
Or, more simply some thing like
/* max 60s timeout */
for (i = 0; i < 60; i++) {
if (wait_for_completion_timeout(&acomp->master_bind_complete,
msecs_to_jiffies(1000)))
break;
}
Takashi
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-03-08 16:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-08 14:11 [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait Kai Vehmanen
2022-03-08 14:11 ` [Intel-gfx] " Kai Vehmanen
2022-03-08 16:05 ` Lucas De Marchi
2022-03-08 16:29 ` Amadeusz Sławiński
2022-03-08 16:29 ` [Intel-gfx] " Amadeusz Sławiński
2022-03-08 16:37 ` Takashi Iwai
2022-03-08 16:37 ` [Intel-gfx] " Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.