mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Zhang <rmxpzlb@gmail.com>
To: Tim Surber <me@timsurber.de>
Cc: "Igor Paunovic" <royalnet026@gmail.com>,
	"Heiko Stübner" <heiko@sntech.de>, "Andy Yan" <andyshrk@163.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6] drm/bridge: dw-hdmi-qp: serialize HDMI audio callbacks with PHY enable/disable
Date: Wed, 11 Nov 2026 17:56:00 +0800	[thread overview]
Message-ID: <72a2f21b-fd6b-427d-afa6-b15dc0729650@gmail.com> (raw)
In-Reply-To: <20261110215535.2658927-1-me@timsurber.de>

On 11/11/26 05:55, Tim Surber wrote:
> Hi Frank,
> 
> On Tue, Sep 15, 2026 at 06:34:33PM +0800, Frank Zhang wrote:
>> The crash occurs when HDMI audio callbacks access registers after DRM
>> atomic framework disabled the PHY.
> 
> I reproduced this on a FriendlyElec CM3588 NAS (RK3588) and tested v6.
> The bug can be hit in more situations than the reboot case in the
> commit message. The details are below in case they help with the
> commit message or with the stable backport.
> 
> Setup:
> - rockchip for-next at c3baae5f1 (7.4.0-rc1), arm64 defconfig
> - HDMI TX/RX audio DT enablement for CM3588 on top (HDMI-IN series)
> - Debian forky, GNOME 50 / Mutter 50.5
> - HDMI0 TX looped back into the RK3588 HDMI RX, so playback on HDMI0
>    can be captured on the HDMI-IN card for a functional check
> - netconsole to capture oopses
> 
> Without the patch:
> 
> 1) Display off, then open/close the PCM
> 
>     Mutter switches the outputs off (CRTC fully disabled):
> 
>       busctl --user set-property org.gnome.Mutter.DisplayConfig \
>           /org/gnome/Mutter/DisplayConfig \
>           org.gnome.Mutter.DisplayConfig PowerSaveMode i 3
>       cat /sys/class/drm/card0-HDMI-A-1/enabled   # -> disabled
>       speaker-test -D hw:HDMI0 -c2 -r 48000 -t sine -F S16_LE -l 1
> 
>     hw_params fails with -ENODEV (prepare sees tmds_char_rate == 0).
>     The close that follows still reaches clear_audio_infoframe:
> 
>       Internal error: synchronous external abort: 0000000096000010 [#1] SMP
>       pc : regmap_mmio_read32le+0xc/0x24
>       Call trace:
>        regmap_mmio_read32le+0xc/0x24 (P)
>        _regmap_bus_reg_read+0x68/0xac
>        _regmap_read+0x60/0xd8
>        _regmap_update_bits+0xfc/0x14c
>        regmap_update_bits_base+0x54/0x80
>        dw_hdmi_qp_bridge_clear_audio_infoframe+0x30/0x40 [dw_hdmi_qp]
>        drm_bridge_connector_clear_audio_infoframe+0x20/0x40 [drm_display_helper]
>        clear_infoframe+0x50/0xf4 [drm_display_helper]
>        drm_atomic_helper_connector_hdmi_clear_audio_infoframe+0x64/0xcc [drm_display_helper]
>        dw_hdmi_qp_audio_disable+0x1c/0xa4 [dw_hdmi_qp]
>        drm_bridge_connector_audio_shutdown+0x28/0x4c [drm_display_helper]
>        drm_connector_hdmi_audio_shutdown+0x1c/0x30 [drm_display_helper]
>        hdmi_codec_shutdown+0x58/0x7c [snd_soc_hdmi_codec]
>        snd_soc_dai_shutdown+0x54/0x80 [snd_soc_core]
>        soc_pcm_clean.isra.0+0x5c/0x1e0 [snd_soc_core]
>        soc_pcm_close+0x34/0x60 [snd_soc_core]
>        snd_pcm_release_substream.part.0+0x88/0xe0 [snd_pcm]
>        snd_pcm_release+0x58/0xc8 [snd_pcm]
>        __fput+0xd0/0x300
>        ...
>       note: speaker-test[1576] exited with irqs disabled
>       note: speaker-test[1576] exited with preempt_count 1
> 
>     The task dies holding the ASoC PCM mutex. Afterwards the
>     close_delayed_work kworker stays in D state in
>     snd_soc_close_delayed_work(), so audio stays broken until reboot.
>     One of my runs ended in an SError panic instead of the
>     synchronous abort.
> 
> 2) Display turned off while a stream is running (the wider case)
> 
>     Start playback on hw:HDMI0 with the display on, switch the display
>     off through Mutter as above, keep playing, then stop the stream.
>     Playback keeps running normally (state RUNNING, hw_ptr advancing)
>     and nothing is reported to user space. When the stream is closed,
>     the board dies: SSH drops, nothing reaches netconsole, and it
>     reboots only through kernel.panic. I reproduced this twice.
> 
>     No application error is needed for this. Playing audio over HDMI
>     while the desktop blanks the screen, or while the sink is
>     unplugged, and then stopping playback is enough. I suspect this is
>     also what most users hit in practice, more than the reboot path.
> 
> 3) HDMI output never enabled (HDMI1, nothing connected)
> 
>     Opening and closing hw:HDMI1 repeatedly fails with -ENODEV and does
>     not crash. The same holds for WirePlumber probing HDMI0 at boot,
>     before the compositor enables it. The register accesses only fault
>     after the PHY has been initialised once and then disabled, which
>     matches your analysis.
> 
> With v6 applied:
> 
> - Case 1: the open now fails cleanly ("Playback open error: -95,
>    Operation not supported" from the new startup check). No abort,
>    and the system stays healthy.
> - Case 2: playback continues after the display goes off, and the
>    close completes cleanly. No hang.
> - Case 3: unchanged, -ENODEV, no crash.
> - Functional check: after re-enabling the display, a 440 Hz sine played
>    on HDMI0 is captured correctly on the HDMI-IN card through the
>    loopback, so the prepare/infoframe path still works.
> - Stress test: for 2 minutes, HDMI0 was toggled on and off 114 times
>    (atomic commits disabling/enabling the CRTC at random 0.1-0.9 s
>    intervals), racing about 2950 open/play/close cycles on hw:HDMI0
>    with random lifetimes. No oops, no hung tasks, nothing new in
>    dmesg (lockdep was not enabled).
> 
> It may be worth adding the "stream open while the output is disabled"
> case to the commit message. It is much easier to trigger than the
> reboot race and makes a stronger case for the stable backport.
> 
> Tested-by: Tim Surber <me@timsurber.de> # FriendlyElec CM3588 NAS (RK3588)
> 
> Thanks,
> Tim

Hi Tim,

Thank you for the thorough testing and suggestion. I'll update the 
commit message and send a new version as soon as possible.

Best regards,
Frank


      reply	other threads:[~2026-11-11  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 10:34 Frank Zhang
2026-09-16 16:09 ` Igor Paunovic
2026-09-17  2:23   ` Frank Zhang
2026-11-10 21:55 ` Tim Surber
2026-11-11  9:56   ` Frank Zhang [this message]

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=72a2f21b-fd6b-427d-afa6-b15dc0729650@gmail.com \
    --to=rmxpzlb@gmail.com \
    --cc=andyshrk@163.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=me@timsurber.de \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=royalnet026@gmail.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®