From: Takashi Iwai <tiwai@suse.de>
To: songxiebing <songxiebing@kylinos.cn>
Cc: tiwai@suse.com, perex@perex.cz, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda: Reset pending verb count on response timeout
Date: Fri, 09 Oct 2026 15:22:45 +0200 [thread overview]
Message-ID: <87o6d33t5m.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261009034040.379171-1-songxiebing@kylinos.cn>
On Fri, 09 Oct 2026 05:40:40 +0200,
songxiebing wrote:
>
> From: Bob Song <songxiebing@kylinos.cn>
>
> On some controllers the HDA link reports a verb timeout and the driver
> falls back to polling mode. After that, every subsequent verb sent to
> that codec address keeps timing out (roughly one second per verb), while
> the hardware itself looks perfectly healthy: the RIRB write pointer keeps
> advancing, interrupts are still delivered, and verbs that carry no reply
> payload -- notably writes -- still take effect on the codec.
>
> The reason is that snd_hdac_bus_send_cmd() increments
> bus->rirb.cmds[addr] for every verb, but the counter is only decremented
> by snd_hdac_bus_update_rirb() when a matching RIRB response is read, with
> no rollback if the response never arrives.
>
> When a controller cannot fall back to single-command mode, i.e.
> chip->fallback_to_single_cmd is zero, azx_rirb_get_response() bails out
> with -EIO immediately and never reaches the bus-reset / single_cmd
> recovery that reinitializes CORB/RIRB and clears the counters (that path
> is guarded by the same flag). The ACPI platform, Tegra and CIX
> controllers never set that flag, so they are all exposed to this.
>
> A single lost response therefore poisons bus->rirb.cmds[addr]
> permanently: each later verb still gets one response that only brings the
> count back down to the stale baseline of 1, so
> snd_hdac_bus_get_response() keeps timing out even though the codec
> answers normally.
>
> Fix this by dropping the pending count for the codec address once the
> verb is known to be dead. A late response is then handled as a spurious
> response exactly as before, and the following verbs recover.
>
> Signed-off-by: Bob Song <songxiebing@kylinos.cn>
Thanks for the patch.
I think, however, that it's better to fix in the hda core side,
i.e. snd_hdac_bus_exec_verb_unlocked(). When bus->ops->get_response()
gets an error, just reset bus->rirb.cmds[addr]. Maybe create a helper
(e.g. snd_hdac_bus_reset_response_counter(buf, addr)) in
sound/hda/core/controller.c, and call it instead of open-code to make
the meaning clearer.
In this way, it'll cover all HD-audio controllers, not only hda-intel.
Takashi
next prev parent reply other threads:[~2026-10-09 13:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 3:40 songxiebing
2026-10-09 13:22 ` Takashi Iwai [this message]
2026-10-10 2:29 ` [PATCH v2] ALSA: hda: Reset response counter when a verb times out songxiebing
2026-10-10 8:06 ` Takashi Iwai
2026-10-10 8:27 ` [PATCH v3] " songxiebing
2026-10-10 9:55 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o6d33t5m.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=songxiebing@kylinos.cn \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®