Skip to content

ASoC/SoundWire: fix race conditions on remove (Pr4838 simplified) - #4849

Merged
plbossart merged 4 commits into
thesofproject:topic/sof-devfrom
plbossart:pr4838-simplified
Mar 8, 2024
Merged

plbossart merged 4 commits into
thesofproject:topic/sof-devfrom
plbossart:pr4838-simplified

Conversation

@plbossart

Copy link
Copy Markdown
Member

No description provided.

plbossart and others added 4 commits March 6, 2024 15:02
The SoundWire interrupts can be masked at two levels
a) in the Cadence IP
b) at the HDaudio controller level

We have an existing mechanism with cancel_work_sync() and status flags
to make sure all existing interrupts are handled in the Cadence IP,
and likewise no new interrupts can be generated before turning off the
links.

However on remove we first use the higher-level mask at the controller
level, which is a sledgehammer preventing interrupts from all
links. This is very racy and not necessary. We can disable the
SoundWire interrupts after all the cleanups are done without any loss
of functionality.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
…uest_resume()

We need to wait for each child to fully resume. pm_request_resume() is
asynchronous, what we need is to wait synchronously to avoid race
conditions.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
We will resume each child in the next patch, and
intel_resume_child_device() will be used.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
When the manager becomes pm_runtime active in the remove procedure,
peripherals will become attached, and do the initialization
process. We have to wait until all the devices are fully resumed
before the cleanup, otherwise there is a possible race condition where
asynchronous workqueues initiate transfers on the bus that cannot
complete. This will ensure there are no SoundWire registers accessed
after the bus is powered-down.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>

@bardliao bardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on LNL and TGL.

@plbossart
plbossart marked this pull request as ready for review March 7, 2024 14:47
@plbossart
plbossart requested a review from ujfalusi March 7, 2024 14:48
@bardliao

bardliao commented Mar 8, 2024

Copy link
Copy Markdown
Collaborator

Failures reported https://sof-ci.01.org/linuxpr/PR4849/build1698/devicetest/index.html. Rerun test.

@bardliao

bardliao commented Mar 8, 2024

Copy link
Copy Markdown
Collaborator

SOFCI TEST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants