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 6, 2023
1 parent b3d9845 commit 413950b
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 @@ -205,18 +205,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 *buffer, uint32_t bytes)
{
struct buffer_cb_transact cb_data = {
Expand All @@ -239,8 +227,7 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes)

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(buffer, NOTIFIER_ID_BUFFER_PRODUCE,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));

#if CONFIG_SOF_LOG_DBG_BUFFER
Expand Down Expand Up @@ -280,7 +267,7 @@ void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes)

audio_stream_consume(&buffer->stream, bytes);

notifier_event(cache_to_uncache(buffer), NOTIFIER_ID_BUFFER_CONSUME,
notifier_event(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 413950b

Please sign in to comment.