Skip to content

Commit

Permalink
sparse: remove notifier cache/uncache conversions
Browse files Browse the repository at this point in the history
as buffer pointer now is not swapping between cached
and uncached aliases, there's no need to convert pointers
in notifier events

Signed-off-by: Marcin Szkudlinski <[email protected]>
  • Loading branch information
marcinszkudlinski committed Sep 8, 2023
1 parent 94bec8a commit e6daade
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/audio/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,6 @@ void buffer_free(struct comp_buffer *buffer)
coherent_free_thread(buffer, c);
}

/*
* comp_update_buffer_produce() and comp_update_buffer_consume() send
* NOTIFIER_ID_BUFFER_PRODUCE and NOTIFIER_ID_BUFFER_CONSUME notifier events
* respectively. The only recipient of those notifications is probes. The
* target for those notifications is always the current core, therefore notifier
* callbacks will be called synchronously from notifier_event() calls. Therefore
* we cannot pass unlocked buffer pointers to probes, because if they try to
* acquire the buffer, that can cause a deadlock. In general locked objects
* shouldn't be passed to potentially asynchronous contexts, but here we have no
* choice but to use our knowledge of the local notifier behaviour and pass
* locked buffers to notification recipients.
*/
void comp_update_buffer_produce(struct comp_buffer __sparse_cache *buffer, uint32_t bytes)
{
struct buffer_cb_transact cb_data = {
Expand All @@ -240,8 +228,7 @@ void comp_update_buffer_produce(struct comp_buffer __sparse_cache *buffer, uint3

audio_stream_produce(&buffer->stream, bytes);

/* Notifier looks for the pointer value to match it against registration */
notifier_event(cache_to_uncache(buffer), NOTIFIER_ID_BUFFER_PRODUCE,
notifier_event((__sparse_force void *)buffer, NOTIFIER_ID_BUFFER_PRODUCE,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));

#if CONFIG_SOF_LOG_DBG_BUFFER
Expand Down Expand Up @@ -281,7 +268,7 @@ void comp_update_buffer_consume(struct comp_buffer __sparse_cache *buffer, uint3

audio_stream_consume(&buffer->stream, bytes);

notifier_event(cache_to_uncache(buffer), NOTIFIER_ID_BUFFER_CONSUME,
notifier_event((__sparse_force void *)buffer, NOTIFIER_ID_BUFFER_CONSUME,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));

#if CONFIG_SOF_LOG_DBG_BUFFER
Expand Down

0 comments on commit e6daade

Please sign in to comment.