From: sashiko-bot@kernel.org
To: "Yogesh Gaur" <yogesh.gaur@intel.com>, linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/2] ALSA: hda/hdmi: intelhdmi: Request resume when skipping ELD notification
Date: Fri, 04 Dec 2026 14:03:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-249923@kernel.org> (raw)
In-Reply-To: <20261204121330.785676-2-yogesh.gaur@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] ALSA: hda/hdmi: bitfield data race in intel_pin_eld_notify()
- [Medium] ALSA: hda/hdmi: TOCTOU race drops ELD notify in
intel_pin_eld_notify()
- [Low] ALSA: hda/hdmi: commit message overstates silent stream resume
sync
--
commit e7a308e01d9fac7611a59d7f65d7969384c790b7
Author: Yogesh Gaur <yogesh.gaur@intel.com>
ALSA: hda/hdmi: intelhdmi: Request resume when skipping ELD notification
This commit sets codec->acomp_requested_resume when intel_pin_eld_notify()
skips a notification during system suspend or hibernation, so the codec is
resumed to sync jack state after sleep.
> When intel_pin_eld_notify() skips a notification during system suspend
> or hibernation, the jack state is not synced after resume unless silent
> stream is enabled, because relaxed_resume is set. A monitor plugged in
> while the system sleeps is then not reported.
[Severity: Low]
Is "unless silent stream is enabled" accurate here?
In i915_hdmi_suspend(), codec->forced_resume is only set when a pin already
has per_pin->silent_stream active at suspend. Even with silent stream
enabled, a monitor plugged during sleep when none was connected before still
leaves forced_resume clear.
> diff --git a/sound/hda/codecs/hdmi/intelhdmi.c b/sound/hda/codecs/hdmi/intelhdmi.c
> index 46dcc3e50fb31..e3c69675902e9 100644
> --- a/sound/hda/codecs/hdmi/intelhdmi.c
> +++ b/sound/hda/codecs/hdmi/intelhdmi.c
> @@ -163,12 +163,14 @@ static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
> pin_nid = intel_port2pin(codec, port);
> if (!pin_nid)
> return;
> - /* skip notification during system suspend (but not in runtime PM);
> - * the state will be updated at resume
> + /* skip notification during system suspend and hibernation (but not
> + * in runtime PM); states would be updated at resume request
> */
> if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND ||
> - codec->core.dev.power.power_state.event == PM_EVENT_FREEZE)
> + codec->core.dev.power.power_state.event == PM_EVENT_FREEZE) {
> + codec->acomp_requested_resume = 1;
> return;
> + }
[Severity: Medium]
Can this unlocked write to codec->acomp_requested_resume race with sibling
bitfields in struct hda_codec?
acomp_requested_resume shares a 32-bit bitfield word with forced_resume and
no_stream_clean_at_suspend, so writing it compiles to a non-atomic
read-modify-write. intel_audio_codec_enable() calls pin_eld_notify() after
dropping display->audio.mutex and without any HDA lock.
Because the HDA codec is a PM consumer of the display device,
i915_hdmi_suspend() runs before i915_drm_suspend() stops display HPD and
modeset work, and updates forced_resume and no_stream_clean_at_suspend in
the same word. A concurrent write here can clobber those flags and break
KAE silent-stream retention across suspend, or race with
hda_codec_pm_complete() clearing acomp_requested_resume.
Using an atomic flag or a separate field outside the bitfield word (or
synchronizing with a lock) would avoid clobbering adjacent bits.
[Severity: Medium]
Can an ELD notification arriving during system resume still be dropped by a
TOCTOU race between intel_pin_eld_notify() and hda_codec_pm_complete()?
When the codec uses direct_complete, power_state stays PMSG_SUSPEND until
hda_codec_pm_complete() runs. During resume, i915 re-enables HPD, MST, and
output polling in intel_display_driver_pm_resume() before dpm_complete()
calls hda_codec_pm_complete():
CPU0 CPU1
hda_codec_pm_complete() intel_pin_eld_notify()
power_state.event == PM_EVENT_SUSPEND
power_state = PMSG_RESUME
if (... || acomp_requested_resume)
/* sees 0, skips resume */
acomp_requested_resume = 1
return <-- notification dropped
There is no shared lock or memory barrier ordering the power_state update
against acomp_requested_resume (and store-load reordering allows the same
outcome even without preemption). The hotplug event is missed and jack
state stays stale until a later wake.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204121330.785676-1-yogesh.gaur@intel.com?part=2
next prev parent reply other threads:[~2026-12-04 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 12:13 [PATCH 1/2] ALSA: hda/hdmi: intelhdmi: Skip ELD notification during hibernation freeze Yogesh Gaur
2026-12-04 12:13 ` [PATCH 2/2] ALSA: hda/hdmi: intelhdmi: Request resume when skipping ELD notification Yogesh Gaur
2026-12-04 14:03 ` sashiko-bot [this message]
2026-12-04 17:27 ` Kai Vehmanen
2026-12-04 12:19 ` [PATCH 1/2] ALSA: hda/hdmi: intelhdmi: Skip ELD notification during hibernation freeze Kai Vehmanen
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=sashiko-outbox-249923@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yogesh.gaur@intel.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