From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796392990; b=dRUK3Bg29XfL8YEpp2J1aOhhaYuKzejCdJQoVZDMOHeo7cj7l/3ylEd/jlKwrpAjYZwu gnYy6LlT3xnZW/9oSBBVNUT2uO/rqnzzn1/Isp1tTN5kR7yH0Iw0Gl3vcgBeepMZ5JvgW R++f5naceC14Qt4voqlb+QPIfaPhHb09llbVFmgjcK/H8qPZo0lBbus4Q5IC45jH+hO2h TLqPJiHkZ3TCsg55Wo6xK8w2TPO77EC/DOovcugUzGDGx0Dt5WnaIUwBj38aPMcVqSXcG T0AUnEGmJTDTta9f6iqRW6ZkflQ2Pq5PdsIhETA1MCVRri9iXmdXIT8ZMLP1ndWB5uQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796392990; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=1Moj9Zf8BRuYDwJzQEXCI3Yyg8H0JSpe4Jq5C1QqkIQ=; b=w8ydsivHoC+WRgzKCrHZuYaxiSLrEbakdxLKCa4RRXdLeAvALjIcP+AcMFJrZFmMR5lE oDEPvj5N+1PTgwdzJXI0OUtnZr8/J/8nh5If/XZ3fcjFQ7AJE/4VMDq26Nq+48h+8IKw2 zAHEkyyl8hkyJf1vwgg7EFq3iTWtkcgk2IPGANJJpvL9LVyj2KCdCrJxXs1t9EMu2+rVw 40OfdUFX1OWnBsnrEkoG8QMET3MM615TN/CvYQIB+xRHQebp/CyIatYor0bIG525zLiW9 Rdk6j8mWBmcnHqvQVXyJaqZF9EUR1QUmqJlkwiFttDn5Opp6Lf5Lbs47kBDgNP3NKOQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OQ0euJN1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E980C606A322 for ; Fri, 4 Dec 2026 14:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OQ0euJN1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B06341F000CE; Fri, 4 Dec 2026 14:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796392989; bh=1Moj9Zf8BRuYDwJzQEXCI3Yyg8H0JSpe4Jq5C1QqkIQ=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=OQ0euJN1MHtUBQ1YcYnlu7+M1O+KXjHj5R+r1o1UZ7Mwrbq1saUKuuxcUaVFunda3 lhV9jaYi7aAbSbwpsCqKQksk6rygIMmUCntlEIwHNAxE4/8QYJF2gT6D4lhR5KoaFc 8gliKErUrenwaaru8r5GcYD70JojVn4j9K2bloxEDmr+YePX5XmCbsf9Xqhx6CW27T AMJ0XPK99FAFE0k1fHjL+8nLfPuJmxfnxH794iLWOTudA2rrJqmEDO0oaYqoUdr2x8 PdExjrXxLADHN1hnQElD9uR/Vzy9aaFCwX7L8v9RVEtWeLafP8tW9bAM7tlxo+L9AM lLefhJXELIRYA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] ALSA: hda/hdmi: intelhdmi: Request resume when skipping ELD notification Reply-To: sashiko-reviews@lists.linux.dev To: "Yogesh Gaur" , linux-sound@vger.kernel.org In-Reply-To: <20261204121330.785676-2-yogesh.gaur@intel.com> References: <20261204121330.785676-1-yogesh.gaur@intel.com> <20261204121330.785676-2-yogesh.gaur@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:03:09 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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/in= telhdmi.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, i= nt port, int pipe) > pin_nid =3D 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 =3D=3D PM_EVENT_SUSPEND || > - codec->core.dev.power.power_state.event =3D=3D PM_EVENT_FREEZE) > + codec->core.dev.power.power_state.event =3D=3D PM_EVENT_FREEZE) { > + codec->acomp_requested_resume =3D 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 =3D=3D PM_EVENT_SUSP= END power_state =3D PMSG_RESUME if (... || acomp_requested_resume) /* sees 0, skips resume */ acomp_requested_resume =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204121330.7856= 76-1-yogesh.gaur@intel.com?part=3D2