Re: [PATCH 0/2] soundwire: Suspend and resume asynchronously

From: Richard Fitzgerald

Date: Mon Nov 30 2026 - 06:19:58 EST


On 27/11/2026 3:00 pm, Paul Menzel wrote:
...
Their span is 28.9 ms. With both patches, the callbacks overlap, and the
span drops to 17.1 ms (median of five s2idle cycles each, sleepgraph with
the device callback trace events). It is on the critical path of the resume
with the panel on, right behind SOF, which waits for i915 through its
device link.

Patch 1 marks the generic manager and peripheral devices, patch 2 the Intel
link devices. The SHIM registers are shared by the links; patch 2 explains
why the multi-link SYNC arm and SYNCGO sequence in intel_start_bus()
tolerates two links interleaving. It is the part I am least sure about, so
please check it. The second link’s power-up waits on shim_lock, so in 49 of
50 traced cycles the start-up was serial anyway; in one cycle both links
were armed before the first SYNCGO, and the bus came up fine. If you
prefer, I can serialize intel_start_bus() across links instead; it takes
about 0.1 ms per link.
I cherry-picked these two patches onto torvalds/master and asked Claude Opus-5.5 to review them. Here is Claude's review:

HEAD~1 looks safe on 7.4. HEAD carries one real risk: a cross-link race in the Intel arm/SYNCGO sequence. I found no codec driver whose suspend/resume relies on synchronous PM, and no deadlocks.

1. HEAD: arm and SYNCGO are not atomic across links (main concern)

• Where: intel_start_bus() arms at intel_bus_common.c:30 and issues SYNCGO at :41; intel_start_bus_after_reset() does the same at :108 and :135. Arm and SYNCGO take shim_lock separately, and one SYNCGO clears the arm bit (CMDSYNC) for every link (intel.c:525).
• Who is affected: with async links, intel_resume() starts every link concurrently on every resume. multi_link is on by default (intel_auxdevice.c:407-417), so this covers every Intel system with two or more links, on both cAVS and ACE2.x.
• Bad ordering: link B arms, link A's SYNCGO clears B's arm, then B writes the CONFIG_UPDATE that applies its sdw_cdns_init() settings, which turn on multi-master (MMASTER) mode (cadence_master.c:1481), without being armed.
• Unarmed CONFIG_UPDATEs are routine once a link is already in MMASTER mode: exit_reset (cadence_master.c:1182), clock stop (:1737) and clock restart (:1812).
• The update that first enters MMASTER mode is the one the comment "follow recommended programming flows to avoid timeouts when gsync is enabled" protects.
• The commit message says such an update is "applied right away", but its 50-cycle trace never produced this ordering.
• If it fails: you get "cannot start bus during resume" (intel_auxdevice.c:754). The link is powered down and runtime PM stays disabled, because intel_suspend() disabled it (:653) and the re-enable at :765 is skipped. Every codec on that link then times out until the driver is rebound.
• Runtime resume: the commit message notes runtime resume isn't serialized either. That's true, but it needs runtime resumes on two links to coincide. HEAD makes this concurrency happen on every system resume.
• Suggested fix: hold a mutex shared by all links of the controller from arm to SYNCGO in both start_bus variants. Alternatives are to get Intel to confirm the hardware behaviour, or to drop HEAD; only the combined gain of both patches was measured.
• Test coverage gaps: ACE2.x, three or more links, and streams aggregated across links (e.g. amps split over two links).

2. HEAD~1: ordering is preserved

• Async devices still respect parent→child order and device links, including stateless ones, and every PM phase ends with a barrier.
• The card suspending before its components (and resuming after them) depends on the card→component link at soc-core.c:1826. That link was added by 0f54ce994b23 in v7.2. These patches must not be backported without it.
• If creating that link fails, ASoC only prints a warning. Codecs could then suspend while streams are still running.

3. Codec drivers

• cs35l56 firmware-idle wait (cs35l56-sdw.c:394-420): still correct.
• The card link means every amp is in PS3 (and has stopped streams) before any amp's suspend runs.
• The first instance that needs the wait sleeps while holding the mutex, and the other instances block on it.
• The bus is only reset at resume, which is after the suspend-phase barrier.
• cs35l56 shared RESET: asserted in suspend_late and released in resume_early, so it depends only on phase barriers, which still hold.
• Other drivers: cs42l43, the SDCA class driver and wcd9378, Realtek, tas2783, tac5xx2, sn624x, es9356, max98373 and cs42l42 only keep per-device state. rt1320's BPT firmware transfer is not called from its PM callbacks.
• Qualcomm and AMD: effectively unaffected.

4. Already present before these commits

• The read-modify-write of the write-1-to-clear WAKESTS register clears other links' wake bits (intel.c:322, intel_ace2x.c:526).
• Neither platform polls SYNCGO, so the ACE2.x "SyncGO clear failed" message (intel_ace2x.c:651) is misleading.
• Neither commit message mentions the dependency on 0f54ce994b23.