From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>,
Vinod Koul <vkoul@kernel.org>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@opensource.cirrus.com
Subject: Re: [PATCH 0/2] soundwire: Suspend and resume asynchronously
Date: Mon, 30 Nov 2026 11:19:14 +0000 [thread overview]
Message-ID: <04ea4610-91ba-48ad-8b70-37d2fcc81df1@opensource.cirrus.com> (raw)
In-Reply-To: <20261127150101.48880-1-pmenzel@molgen.mpg.de>
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.
next prev parent reply other threads:[~2026-11-30 11:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:00 [PATCH 0/2] soundwire: Suspend and resume asynchronously Paul Menzel
2026-11-27 15:00 ` [PATCH 1/2] soundwire: Suspend and resume managers and peripherals asynchronously Paul Menzel
2026-11-27 15:00 ` [PATCH 2/2] soundwire: intel: Suspend and resume the links asynchronously Paul Menzel
2026-11-28 11:21 ` [PATCH 0/2] soundwire: Suspend and resume asynchronously Pierre-Louis Bossart
2026-11-30 11:19 ` Richard Fitzgerald [this message]
2026-11-30 14:16 ` Pierre-Louis Bossart
2026-11-30 11:35 ` Richard Fitzgerald
2026-11-30 14:12 ` Pierre-Louis Bossart
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=04ea4610-91ba-48ad-8b70-37d2fcc81df1@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=pmenzel@molgen.mpg.de \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.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