-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SoundWire locking issues #5052
Comments
https://sof-ci.ostc.intel.com/#/result/planresultdetail/42223?model=LNLM_SDW_AIOC&testcase=check-playback-3times is also interesting, we can see a regular transfer starting before a bank switch completes
|
Edit: after talking with @bardliao this isn't really possible. |
I added 3 sec sleep after do_transfer_defer, and keep pressing button key while headphone playback. It looks like the sdw_transfer will be called after bank switch in normal case. Not sure what happens in the failed case.
|
Same test as #5052 (comment) with #5047
|
Are you referring to |
In theory yes, but there's a corner case as described above a) the bank switch starts and the bus takes the msg->lock b) is blocked by a) and c) is blocked by b) |
wait @bardliao are you saying that with a 3s sleep time you never see any bank switch errors? |
No, I tested it manually which can not reproduce the issue anyway. |
There are 2 theoretical cases where the current locking is broken.
stream locking
the use of sdw_acquire_bus_lock() can lead to an AB/BA deadlock.
If two streams use the same link and the the m_rt information is added in opposite order, this loop would dead-lock.
Example Stream A uses link0 and link1, and Stream B uses link1 and link0.
The following loop would result in
StreamA lock link0
Stream B link link1
Deadlock.
SyncArm/SyncGo locks on Intel platforms
On Intel platforms, the mechanism is to do a 'Sync Arm' in the pre-bank switch for all m_rt, then do a 'Sync Go' in the post_bank_switch callback of the first m_rt.
Assuming Stream A uses link 0 and link1, and stream B uses link2 and link3, it's theoretically possible to have the following sequence:
Stream A link0 sync arm
Stream A link1 sync arm
Stream B link2 sync arm
Stream A link0 sync go -> link 0, 1, 2 would start when only link0 and link1 should start...
Stream B link3 sync arm
Stream B link2 sync go
It's anyone's guess when might happen after the first sync go. At worst, link3 never starts. At best, link3 starts but wouldn't be synchronized with link2. Both are bad options.
It's not clear if these two cases explain the problems we're seeing in #4823 but it's rather of a concern that this locking looks rather broken.
@bardliao @ujfalusi let me know if this makes any sense.
The text was updated successfully, but these errors were encountered: