Repository navigation
drm/apple: audio: release idle TX DMA channel on PCM close - #3712
Conversation
dcp_pcm_open() requests the display audio TX ADMAC channel on the first open (including userspace's initial unplugged probe) and previously kept that channel allocated until driver removal. Because apple-admac holds a runtime PM reference while any channel is allocated, idle external display ADMAC controllers, their ISOC DARTs, and their DISPEXT*_ADMA power domains stayed powered continuously even with no external display attached. Guard snd_pcm_set_managed_buffer() so re-opening reuses the managed buffer, and release dcpaud->chan (and its silence buffer if allocated) when a PCM closes or fails to open and no native link silence transfer is active. On T8142/T6050/T8152 machines with idle external displays, this lets admac_dispext* and their ISOC DARTs autosuspend and power off dispext*_adma. Signed-off-by: Thomas Glanzmann <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: HOLD at a864160f
Blockers:
- Queued CI at
a864160f(2P/0F/19Q): Hosted CI (kunit,apple-build,host-tests, KUnit suites) is still running. - Live plugged external DP/HDMI audio playback + unplug cycle missing (noted in PR body
Not yet:): Current J813 (T8142) evidence covers unplugged PipeWire probing and/dev/snd/pcmC*D0popen/close cycles only. Because this PR modifiesdcpaud_before_modeset(),dcp_pcm_native_close(), andsnd_pcm_set_managed_buffer()reuse across channel release/re-acquire, please post a live plugged external DisplayPort/HDMI audio playback + close + reopen + unplug pass on J813 (plus a second Mac generation row coveringapple-dpaudioif available).
Checked:
- Audited full diff (
+96/-27acrossdrivers/gpu/drm/apple/audio.candtools/asahi/dcpaud-open-fallback-tests.py):- Lock ordering is consistent (
open_mutex->link_lock->data_lock) acrossdcp_pcm_open(),dcp_pcm_close(),dcp_pcm_native_close(), anddcpaud_before_modeset(). dcpaud_release_dma_locked()safely refuses release wheneversilence_running || idle_set || link_prepared || link_started || READ_ONCE(stream_dma)is active, clearsdcpaud->chan/dcpaud->silenceunderdata_lock, and frees the silence buffer and DMA channel outsidedata_lock.- Guarding
snd_pcm_set_managed_buffer()withif (!dcpaud->substream->dma_buffer.dev.dev)prevents re-allocating the managed buffer on subsequent opens while preserving the stableadmacdevice reference. dcpaud-open-fallback-tests.pyverifiesdma_releasesacross all error and success paths.
- Lock ordering is consistent (
Evidence
- Head commit:
a864160fdcc18c5e3acfe6815f0a41a357dfde7b(MERGEABLEintomain). - CI snapshot:
2P/0F/19Q. - Non-blocking note: when a monitor is unplugged while a native silence link was held without a subsequent PCM close,
dcpaud_release_link()stops silence and tears down the link without releasingdcpaud->chan(safe sinceopen_mutexis not held there; the channel is released on the next PCM close or driver remove).
|
Hardware verification at exact patch ( 1. J813 (MacBook Air 13" M5,
|
There was a problem hiding this comment.
Verdict: MERGE at a864160fdcc1
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - Audited full diff (+96/-27 across drivers/gpu/drm/apple/audio.c and tools/asahi/dcpaud-open-fallback-tests.py):
- Lock ordering is consistent (
open_mutex->link_lock->data_lock) acrossdcp_pcm_open(),dcp_pcm_close(),dcp_pcm_native_close(), anddcpaud_before_modeset(). dcpaud_release_dma_locked()safely refuses release wheneversilence_running || idle_set || link_prepared || link_started || READ_ONCE(stream_dma)is active, clearsdcpaud->chan/dcpaud->silenceunderdata_lock, and frees the silence buffer and DMA channel outsidedata_lock.- Guarding
snd_pcm_set_managed_buffer()withif (!dcpaud->substream->dma_buffer.dev.dev)prevents re-allocating the managed buffer on subsequent opens while preserving the stableadmacdevice reference. dcpaud-open-fallback-tests.pyverifiesdma_releasesacross all error and success paths.
Follow-ups (not blocking): queued CI; J813 live plugged DP/HDMI audio playback/close/reopen/unplug row
DjDeveloperr
left a comment
There was a problem hiding this comment.
PCM close and failed opens release the idle DMA channel, while the native link keeps it when silence or a stream still owns it. The J813 and J873g rows cover release and reacquisition across repeated playback, with clean modeset and unplug on J813.
What: Guard
snd_pcm_set_managed_buffer()so re-opening reuses the managed buffer, and releasedcpaud->chan(and its silence buffer if allocated) indcp_pcm_close(),dcp_pcm_native_close(),dcp_pcm_open()error paths, anddcpaud_before_modeset()failure paths whenever no native silence link is active. Previously, userspace's initial unplugged probe ofaudio-controller-*left the display ADMAC TX channel allocated until driver removal, pinningadmac_dispext*, its ISOC DART, anddispext*_admapowered on continuously even with no external display connected.Tested:
7.3.0-aurora-j813-power+(exact cherry-pick ofa864160fdcc1onmainb158a197adc9alongside independent CLPC and cpufreq commits):dispext0_admaanddispext1_admadropped fromontooff-0with 0in-useADMAC channels in/sys/kernel/debug/dmaengine/summary./dev/snd/pcmC0D0pand/dev/snd/pcmC1D0psucceeded cleanly and both domains returned immediately tooff-0; 0 failed units, 0 new kernel warnings/errors.tools/asahi/dcpaud-open-fallback-tests.pyPASS + all 5 mutations killed (no-retry,wait-any,gone-fails,keep-cookie,mask-all),tools/asahi/dcpaud-sleep-hold-tests.py(128/128),ARCH=arm64 LLVM=-19 W=1 drivers/gpu/drm/apple/audio.o(0warnings),scripts/checkpatch.pl --strict(0/0/0).Risk: two-way door · Apple Silicon Macs using
apple-dpaudio(drivers/gpu/drm/apple/audio.c).Revert:
git revertrestores keepingdcpaud->chanallocated across closes.Not yet: Live plugged external DisplayPort/HDMI audio playback + unplug cycle on J813 or J873g; standalone single-PR boot without companion commits.