Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asrc module convert #8416

Merged
merged 3 commits into from
Nov 10, 2023
Merged

Conversation

andrula-song
Copy link
Contributor

convert ASRC to module interface with IPC4.

@@ -0,0 +1,1027 @@
// SPDX-License-Identifier: BSD-3-Clause
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we extract common code?

Copy link
Contributor Author

@andrula-song andrula-song Nov 1, 2023

Choose a reason for hiding this comment

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

Is there any else to extract? Thanks for pointing out in detail.

Copy link
Contributor

Choose a reason for hiding this comment

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

@lyakh , we can use another PR to do the extraction and ipc3/ipc4 isolation, this PR can only focus on module convertion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@lyakh , we can use another PR to do the extraction and ipc3/ipc4 isolation, this PR can only focus on module convertion.

@btian1 sorry, I don't think it's a good approach to first duplicate the code to then merge it again

@andrula-song andrula-song force-pushed the asrc-module-convert branch 3 times, most recently from 40c21c2 to 128f2b3 Compare November 1, 2023 04:38
src/audio/asrc/asrc_ipc4.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_common.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_common.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_common.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_common.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_ipc3.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_ipc3.c Outdated Show resolved Hide resolved
src/audio/asrc/asrc_ipc3.c Outdated Show resolved Hide resolved
@andrula-song andrula-song force-pushed the asrc-module-convert branch 2 times, most recently from 9151025 to cceaaa4 Compare November 7, 2023 05:01
src/audio/asrc/asrc.c Outdated Show resolved Hide resolved
Add IPC4 DAI timestamp ops for ASRC.

Signed-off-by: Andrula Song <[email protected]>
Add trigger ops in module_interface.

Signed-off-by: Andrula Song <[email protected]>
Convert ASRC to module API and support ASRC IPC3 test
with test bench.

Signed-off-by: Andrula Song <[email protected]>
Copy link
Contributor

@btian1 btian1 left a comment

Choose a reason for hiding this comment

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

@andrula-song , please change status to open, this PR should be done now.

@andrula-song andrula-song marked this pull request as ready for review November 8, 2023 07:50
@andrula-song
Copy link
Contributor Author

SOFCI TEST

src_obj->ring_buffers32[ch] = NULL;
rfree(buf_32);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting, was this a memory violation fix? Please explain and move to a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, it is because the comment from @lyakh #8416 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK fair enough!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@singalsu the original order keeps a theoretical race window open: while you still have a pointer to a freed memory in a globally accessible persistent object, someone might access it at that time, causing a use-after-free bug scenario. Although we don't know any such specific possibilities here, but since we already have a temporary variable with that pointer, we could as well use it to protect against that race possibility. I.e.

free(obj->mem);
// if someone now accesses obj->mem, it's a use-after-free bug
obj->mem = NULL;

that one has a race window, whereas

x = obj->mem;
obj->mem = NULL;
free(x);

this one doesn't

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for elaborating @lyakh !

@kv2019i kv2019i merged commit 00e7bc0 into thesofproject:main Nov 10, 2023
42 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants