ASoC: SOF: sof-client: Use event-handler mutex consistently - #5803
ASoC: SOF: sof-client: Use event-handler mutex consistently#5803ujfalusi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns locking for SOF client event handler lists by using client_event_handler_mutex consistently across register/unregister and dispatch paths, matching the intent documented for protecting the handler lists.
Changes:
- Switch IPC RX handler unregistration to use
client_event_handler_mutex. - Switch FW state handler dispatch and unregistration to use
client_event_handler_mutex.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev); | ||
| struct sof_ipc_event_entry *event; | ||
|
|
||
| guard(mutex)(&sdev->ipc_client_mutex); | ||
| guard(mutex)(&sdev->client_event_handler_mutex); | ||
|
|
There was a problem hiding this comment.
@ujfalusi seems valid. Fwiw not sure if this matters today, but this also made me think about the pcm and kcontrol using different locks since they are async, eventually a sof client could hold either pcm/kcontrol lock.
There was a problem hiding this comment.
this is not valid, rx handlers are not unregistering the event while they are handling it.
| guard(mutex)(&sdev->client_event_handler_mutex); | ||
|
|
||
| list_for_each_entry(event, &sdev->fw_state_handler_list, list) | ||
| event->callback(event->cdev, sdev->fw_state); |
jsarha
left a comment
There was a problem hiding this comment.
Reading the sof_client.c through, the change looks correct and necessary.
26f7ade to
c1e1739
Compare
|
Changes since v1:
|
Protect IPC RX and FW state handler list unregister/dispatch paths with client_event_handler_mutex to match list registration and locking comments. Fixes: 5c19da3 ("ASoC: SOF: Use guard()/scoped_guard() for mutex locks where it makes sense") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Protect IPC RX and FW state handler list unregister/dispatch paths with client_event_handler_mutex to match list registration and locking comments.
Fixes: 5c19da3 ("ASoC: SOF: Use guard()/scoped_guard() for mutex locks where it makes sense")