Skip to content

Conversation

@cujomalainey
Copy link
Contributor

pipeline_comp_hw_params does 2 things, it fetches the hw_params from the
DAI and writes those parameters to buffers. The issue here is that we
walk from host to DAI, so any buffer we see along the way gets set with
uninitialized hw_params as we don't get the params till the end of the
walk. Typically this is not an issue in most pipelines that are linear
as the following call to pipeline_comp_params will overwrite any bad
values in the buffer params. Not good practice but not harmful. The
problem arises when components such as the demux or SRC which pass flags
into comp_verify_params receive these bad values. There are edge cases
as a result where the values are not cleared and the buffers end up with
bad data. The result is usually an xrun, in the case of identifying this
bug, the uncleared buffer had 4.6k channels.

Signed-off-by: Curtis Malainey cujomalainey@chromium.org

pipeline_comp_hw_params does 2 things, it fetches the hw_params from the
DAI and writes those parameters to buffers. The issue here is that we
walk from host to DAI, so any buffer we see along the way gets set with
uninitialized hw_params as we don't get the params till the end of the
walk. Typically this is not an issue in most pipelines that are linear
as the following call to pipeline_comp_params will overwrite any bad
values in the buffer params. Not good practice but not harmful. The
problem arises when components such as the demux or SRC which pass flags
into comp_verify_params receive these bad values. There are edge cases
as a result where the values are not cleared and the buffers end up with
bad data. The result is usually an xrun, in the case of identifying this
bug, the uncleared buffer had 4.6k channels.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
@cujomalainey cujomalainey added bug Something isn't working as expected P1 Blocker bugs or important features labels Mar 19, 2022
@cujomalainey
Copy link
Contributor Author

Also note an alternative solution I considered was reversing the walk, but I wasn't confident enough that the sink is always a DAI to suggest it.

Copy link
Contributor

@lkoenig lkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not expert in this part of the code. But the change seems sensible to me.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cujomalainey ! This looks correct to me.

@lgirdwood lgirdwood merged commit 06ee0fe into thesofproject:main Mar 21, 2022
@cujomalainey cujomalainey deleted the params branch March 21, 2022 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected P1 Blocker bugs or important features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants