* [PATCH v1] ALSA: hda: optimize the probe codec process
@ 2024-02-28 7:41 songxiebing
2024-02-28 8:20 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: songxiebing @ 2024-02-28 7:41 UTC (permalink / raw)
To: tiwai; +Cc: alsa-devel, linux-kernel, songxiebing
From: songxiebing <songxiebing@kylinos.cn>
In azx_probe_codecs function,when bus->codec_mask is becomes to 0(no codecs),
execute azx_init_chip, bus->codec_mask will be initialized to a value again,
this causes snd_hda_codec_new function to run, the process is as follows:
-->snd_hda_codec_new
-->snd_hda_codec_device_init
-->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s
---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s
---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s
when no codecs, read communication is error, each command will be polled for
2 second,a total of 10s, it is easy to some problem.
like this:
2 [ 14.833404][ 6] [ T164] hda 0006:00: Codec #0 probe error; disabling it...
3 [ 14.844178][ 6] [ T164] hda 0006:00: codec_mask = 0x1
4 [ 14.880532][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
5 [ 15.891988][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
6 [ 16.978090][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0001
7 [ 18.140895][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0002
8 [ 19.135516][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0004
10 [ 19.900086][ 6] [ T164] hda 0006:00: no codecs initialized
11 [ 45.573398][ 2] [ C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25]
Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function.
Signed-off-by: songxiebing <songxiebing@kylinos.cn>
---
sound/pci/hda/hda_controller.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index e5c53ad..e1ece0a 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1474,6 +1474,9 @@ int azx_probe_codecs(struct azx *chip, unsigned int max_slots)
dev_warn(chip->card->dev,
"Codec #%d probe error; disabling it...\n", c);
bus->codec_mask &= ~(1 << c);
+ /* no codecs */
+ if (bus->codec_mask == 0)
+ break;
/* More badly, accessing to a non-existing
* codec often screws up the controller chip,
* and disturbs the further communications.
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] ALSA: hda: optimize the probe codec process
2024-02-28 7:41 [PATCH v1] ALSA: hda: optimize the probe codec process songxiebing
@ 2024-02-28 8:20 ` Takashi Iwai
2024-03-01 1:18 ` [PATCH v2] " songxiebing
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2024-02-28 8:20 UTC (permalink / raw)
To: songxiebing; +Cc: tiwai, alsa-devel, linux-kernel, songxiebing
On Wed, 28 Feb 2024 08:41:38 +0100,
songxiebing wrote:
>
> From: songxiebing <songxiebing@kylinos.cn>
>
> In azx_probe_codecs function,when bus->codec_mask is becomes to 0(no codecs),
> execute azx_init_chip, bus->codec_mask will be initialized to a value again,
> this causes snd_hda_codec_new function to run, the process is as follows:
> -->snd_hda_codec_new
> -->snd_hda_codec_device_init
> -->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s
> when no codecs, read communication is error, each command will be polled for
> 2 second,a total of 10s, it is easy to some problem.
> like this:
> 2 [ 14.833404][ 6] [ T164] hda 0006:00: Codec #0 probe error; disabling it...
> 3 [ 14.844178][ 6] [ T164] hda 0006:00: codec_mask = 0x1
> 4 [ 14.880532][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
> 5 [ 15.891988][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
> 6 [ 16.978090][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0001
> 7 [ 18.140895][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0002
> 8 [ 19.135516][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0004
> 10 [ 19.900086][ 6] [ T164] hda 0006:00: no codecs initialized
> 11 [ 45.573398][ 2] [ C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25]
>
> Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function.
>
> Signed-off-by: songxiebing <songxiebing@kylinos.cn>
Thanks for the patch. The code change looks OK, but you use both
ASCII and non-ASCII comma letters in the patch description.
Could you try to keep only ASCII letters?
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] ALSA: hda: optimize the probe codec process
2024-02-28 8:20 ` Takashi Iwai
@ 2024-03-01 1:18 ` songxiebing
2024-03-01 10:47 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: songxiebing @ 2024-03-01 1:18 UTC (permalink / raw)
To: tiwai; +Cc: alsa-devel, linux-kernel, songxiebing, soxiebing, tiwai
From: songxiebing <songxiebing@kylinos.cn>
In azx_probe_codecs function, when bus->codec_mask is becomes to 0(no codecs),
execute azx_init_chip, bus->codec_mask will be initialized to a value again,
this causes snd_hda_codec_new function to run, the process is as follows:
-->snd_hda_codec_new
-->snd_hda_codec_device_init
-->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s
---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s
---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s
when no codecs, read communication is error, each command will be polled for
2 second, a total of 10s, it is easy to some problem.
like this:
2 [ 14.833404][ 6] [ T164] hda 0006:00: Codec #0 probe error; disabling it...
3 [ 14.844178][ 6] [ T164] hda 0006:00: codec_mask = 0x1
4 [ 14.880532][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
5 [ 15.891988][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
6 [ 16.978090][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0001
7 [ 18.140895][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0002
8 [ 19.135516][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0004
10 [ 19.900086][ 6] [ T164] hda 0006:00: no codecs initialized
11 [ 45.573398][ 2] [ C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25]
Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function.
Signed-off-by: songxiebing <songxiebing@kylinos.cn>
---
Changes in v2: fix some non-ASCII comma letters.
---
sound/pci/hda/hda_controller.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index e5c53ad..e1ece0a 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1474,6 +1474,9 @@ int azx_probe_codecs(struct azx *chip, unsigned int max_slots)
dev_warn(chip->card->dev,
"Codec #%d probe error; disabling it...\n", c);
bus->codec_mask &= ~(1 << c);
+ /* no codecs */
+ if (bus->codec_mask == 0)
+ break;
/* More badly, accessing to a non-existing
* codec often screws up the controller chip,
* and disturbs the further communications.
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ALSA: hda: optimize the probe codec process
2024-03-01 1:18 ` [PATCH v2] " songxiebing
@ 2024-03-01 10:47 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2024-03-01 10:47 UTC (permalink / raw)
To: songxiebing; +Cc: alsa-devel, linux-kernel, songxiebing, tiwai
On Fri, 01 Mar 2024 02:18:41 +0100,
songxiebing wrote:
>
> From: songxiebing <songxiebing@kylinos.cn>
>
> In azx_probe_codecs function, when bus->codec_mask is becomes to 0(no codecs),
> execute azx_init_chip, bus->codec_mask will be initialized to a value again,
> this causes snd_hda_codec_new function to run, the process is as follows:
> -->snd_hda_codec_new
> -->snd_hda_codec_device_init
> -->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s
> ---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s
> when no codecs, read communication is error, each command will be polled for
> 2 second, a total of 10s, it is easy to some problem.
> like this:
> 2 [ 14.833404][ 6] [ T164] hda 0006:00: Codec #0 probe error; disabling it...
> 3 [ 14.844178][ 6] [ T164] hda 0006:00: codec_mask = 0x1
> 4 [ 14.880532][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
> 5 [ 15.891988][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0000
> 6 [ 16.978090][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0001
> 7 [ 18.140895][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0002
> 8 [ 19.135516][ 6] [ T164] hda 0006:00: too slow response, last cmd=0x0f0004
> 10 [ 19.900086][ 6] [ T164] hda 0006:00: no codecs initialized
> 11 [ 45.573398][ 2] [ C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25]
>
> Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function.
>
> Signed-off-by: songxiebing <songxiebing@kylinos.cn>
> ---
> Changes in v2: fix some non-ASCII comma letters.
Thanks, applied now.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-01 10:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 7:41 [PATCH v1] ALSA: hda: optimize the probe codec process songxiebing
2024-02-28 8:20 ` Takashi Iwai
2024-03-01 1:18 ` [PATCH v2] " songxiebing
2024-03-01 10:47 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®