Repository navigation
mux: add missing buffer locks - #2545
Conversation
|
@tlauda Should we have similar locks for Demux? Mux and Demux have separate copy functions, so that might need some adjustments there also. |
mux_copy has been the only function missing them (see commit description). |
There was a problem hiding this comment.
where is the corresponding buffer_lock for this? Code looks strange.
There was a problem hiding this comment.
@dbaluta I think it's the one on line 403 (it's in the same function).
There was a problem hiding this comment.
Yeah, I'm not seeing this, I can see lock(source) and unlock(sources[i]) which seem unaligned as they are different objects. Some inline comments may help here.
There was a problem hiding this comment.
I wonder if simplification would be better here. i.e.
/* align source streams with their respective configurations */
list_for_item(clist, &dev->bsource_list) {
source = container_of(clist, struct comp_buffer, sink_list);
buffer_lock(source, &flags);
if (source->source->state == dev->state) {
num_sources++;
i = get_stream_index(cd, source->pipeline_id);
sources[i] = source;
sources_stream[i] = &source->stream;
} else {
buffer_unlock(source, flags);
}
}Means we only have certain source buffers locked, i.e only the buffers that out configuration is telling us to copy from. Would it make more sense to just lock all sources and then unlock all sources ?
Another thing that we should do is to change the buffer locks to reader and writer locking.
buffer_rlock(buffer, flags);
buffer_wlock(buffer, flags);
This way we only lock a buffer for reading or writing (i.e.reader lock updates r_ptr and avail, writer lock updates w_ptr and free). This would allow cross core buffers that would not block a core that the current implementation might.
There was a problem hiding this comment.
@lgirdwood It's definitely candidate for future improvement. This patch is about aligning with rest of the components. mux_copy function is the only one missing locks currently.
There was a problem hiding this comment.
Ok, great for the r/w buffer locking update.
Adds missing buffer locks to mux_copy function. demux_copy has already had them before. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2737e48 to
908b9d0
Compare
Adds missing buffer locks to mux_copy function.
demux_copy has already had them before.
Signed-off-by: Tomasz Lauda tomasz.lauda@linux.intel.com