Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Cross core Virtual heaps, invalidation of cross core buffers in unbind call#10044
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
37385b34a0a6e4e47ec84d1ae4480ea41456aabe88ff22137767a836f7d9991419f90cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -96,6 +96,7 @@ static void ring_buffer_free(struct sof_audio_buffer *audio_buffer) | ||
| container_of(audio_buffer, struct ring_buffer, audio_buffer); | ||
| rfree((__sparse_force void *)ring_buffer->_data_buffer); | ||
| rfree(ring_buffer); | ||
| } | ||
| static void ring_buffer_reset(struct sof_audio_buffer *audio_buffer) | ||
| @@ -239,6 +240,21 @@ static int ring_buffer_release_data(struct sof_source *source, size_t free_size) | ||
| return 0; | ||
| } | ||
| int ring_buffer_module_unbind(struct sof_sink *sink) | ||
| { | ||
| struct ring_buffer *ring_buffer = ring_buffer_from_sink(sink); | ||
| CORE_CHECK_STRUCT(&ring_buffer->audio_buffer); | ||
| /* in case of disconnection, invalidate all cache. This method is guaranteed be called on | ||
| * core that have been using sink API | ||
| */ | ||
| ring_buffer_invalidate_shared(ring_buffer, ring_buffer->_data_buffer, | ||
| ring_buffer->data_buffer_size); | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be possible to also free the buffer here? might need to unbind it from the other side too if not done yet ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea. Now free is performed when a module is deleted. OOOh! just got an idea! It has always been a memory leak! ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @marcinszkudlinski No, I don't think it's called at all. In IPC3, there's just a call to pipeline_disconnect() (for both buffers connected to a component) and this internally calls buffer_detach(). ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I checked, buffer free is called in unbind. | ||
| return 0; | ||
| } | ||
| static struct source_ops ring_buffer_source_ops = { | ||
| .get_data_available = ring_buffer_get_data_available, | ||
| .get_data = ring_buffer_get_data, | ||
| @@ -249,6 +265,7 @@ static struct sink_ops ring_buffer_sink_ops = { | ||
| .get_free_size = ring_buffer_get_free_size, | ||
| .get_buffer = ring_buffer_get_buffer, | ||
| .commit_buffer = ring_buffer_commit_buffer, | ||
| .on_unbind = ring_buffer_module_unbind, | ||
| }; | ||
| static const struct audio_buffer_ops audio_buffer_ops = { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1173,9 +1173,9 @@ __cold static int copier_get_hw_params(struct comp_dev *dev, struct sof_ipc_stre | ||
| return dai_common_get_hw_params(dd, dev, params, dir); | ||
| } | ||
| __cold static int copier_bind(struct processing_module *mod, void *data) | ||
| __cold static int copier_bind(struct processing_module *mod, struct bind_info *bind_data) | ||
| { | ||
| const struct ipc4_module_bind_unbind *const bu = (struct ipc4_module_bind_unbind *)data; | ||
| const struct ipc4_module_bind_unbind *const bu = bind_data->ipc4_data; | ||
| const uint32_t src_id = IPC4_COMP_ID(bu->primary.r.module_id, bu->primary.r.instance_id); | ||
| const uint32_t src_queue_id = bu->extension.r.src_queue; | ||
| struct copier_data *cd = module_get_private_data(mod); | ||
| @@ -1202,7 +1202,7 @@ __cold static int copier_bind(struct processing_module *mod, void *data) | ||
| return -ENODEV; | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, Something odd with all the commit messages. They are line-wrapped to under 50 columns...? Look a bit odd in git history compared to other commits in SOF. | ||
| } | ||
| __cold static int copier_unbind(struct processing_module *mod, void *data) | ||
| __cold static int copier_unbind(struct processing_module *mod, struct bind_info *unbind_data) | ||
| { | ||
| struct copier_data *cd = module_get_private_data(mod); | ||
| struct comp_dev *dev = mod->dev; | ||
| @@ -1212,7 +1212,7 @@ __cold static int copier_unbind(struct processing_module *mod, void *data) | ||
| if (dev->ipc_config.type == SOF_COMP_DAI) { | ||
| struct dai_data *dd = cd->dd[0]; | ||
| return dai_zephyr_unbind(dd, dev, data); | ||
| return dai_zephyr_unbind(dd, dev, unbind_data); | ||
| } | ||
| return 0; | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of this function is actually somewhat confusing: usually in SOF "shared" means "uncached"