Uh oh!
There was an error while loading. Please reload this page.
[WIP][RFC]codec adapter: move generic mem alloc to component - #4112
[WIP][RFC]codec adapter: move generic mem alloc to component#4112juimonen wants to merge 13 commits into
Conversation
Add support to the IPC pipeline logic to support creation of pipelines using generic IPC ABI. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add support to allocate memory at the pipeline level so that the all its processing components can use the same resource. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
WIP. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Port latest change to ipc4-handler Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Ipc3 only uses DIPCIDR to send dsp message, but ipc4 uses both DIPCIDR and DIPCIDD. Now get DIPCIDD data from msg tx_data. Signed-off-by: Rander Wang <rander.wang@intel.com>
Fw creates a dsp ipc message to send status of the last host ipc message. Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Add alh header file for ipc4. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Codec adapter has a devm_kzalloc type memory allocator to allocate multiple chunks of memory into a list, which can be then freed without explicit pointers in codec deletion. Move this generic mechanism to component class. Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
juimonen
commented
Apr 28, 2021
@lgirdwood heavily simplified... I don't know do we need at all the step by step free of memory individually or can we just always free all memory... usually if memory allocation fails the whole component is in very bad state. I can bring back the more refined method if needed. |
| cd = codec_allocate_memory(dev, sizeof(struct cadence_codec_data), 0); | ||
| cd = comp_devm_alloc(dev, sizeof(struct cadence_codec_data), 0); | ||
| if (!cd) { |
There was a problem hiding this comment.
I wonder if this shouldn't be better called devm_comp_alloc(dev, ..) similar with its Linux counterpart.
There was a problem hiding this comment.
yes sure. Can revisit the naming as I need to shuffle this around anyway...
lgirdwood
left a comment
There was a problem hiding this comment.
Thanks @juimonen. I would make two changes here.
- Move it to the allocator logic. i.e. all memory logic in one place.
- Associate it with the pipeline rather than a component. We only remove componets when we delete the pipeline and we now support dynamic pipeline so make more sense at this level.
lgirdwood
commented
Apr 28, 2021
@cujomalainey fyi |
lgirdwood
commented
Apr 28, 2021
@juimonen this should go into main branch. There are no dependencies. |
cujomalainey
commented
Apr 28, 2021
interesting, codeowners does not recurse into directories with |
cujomalainey
commented
Apr 29, 2021
Thanks for moving this, its an excellent piece of code that just needs to benefit everyone 😃 |
juimonen
commented
Apr 29, 2021
|
lgirdwood
commented
Apr 29, 2021
@ranj063 is doing some work here #4113, we will need this and a kernel patch to change the pipeline new order. So maybe part 1 is to align the allocations per module/components, and once kernel is ready we change from module to pipeline alignment, but lets get feedback from @ranj063 first wrt kernel timeline. @RDharageswari fyi. |
| */ | ||
| struct comp_dev_mem { | ||
| void *ptr; /**< A pointr to particular memory block */ | ||
| struct list_item mem_list; /**< list of memory allocated by codec */ |
There was a problem hiding this comment.
@lgirdwood would you have an issue if I built in a feature (behind a config flag) here to track amount allocated by each alloc? That way we call a function and query memory consumed by a component (and possibly identify what section each pointer is point to)
gkbldcig
commented
May 10, 2021
Can one of the admins verify this patch? |
78c3229 to
1ad177dCompare7ff3c3f to
b91ed92Comparee7a3d6a to
81bcfe5Comparecujomalainey
commented
Jun 9, 2021
ping on this patch, this is something i would like to base a feature off of |
lgirdwood
commented
Jun 10, 2021
@juimonen whats' the ETA for this patch ? What's still to do ? |
lyakh
left a comment
There was a problem hiding this comment.
It still seems to me, that this isn't a good use of "devm." It's a clear reference to the equally named Linux kernel API, but it doesn't do the same thing. If the automated resource management is planned, we should make sure it gets implemented soon enough, not to leave this namespace confusion for indefinite time...
| list_for_item_safe(mem_list, _mem_list, &dev->mem.mem_list) { | ||
| mem = container_of(mem_list, struct comp_dev_mem, mem_list); | ||
| rfree(mem->ptr); | ||
| list_item_del(&mem->mem_list); |
There was a problem hiding this comment.
maybe first delete from the list, then free?
juimonen
commented
Jun 11, 2021
let me work on this next week, was busy this week with other stuff. |
kv2019i
commented
Apr 20, 2022
@juimonen Over a year without activity, should this be closed? |
Codec adapter has a devm_kzalloc type memory allocator to allocate
multiple chunks of memory into a list, which can be then freed without
explicit pointers in codec deletion. Move this generic mechanism to
component class.
Signed-off-by: Jaska Uimonen jaska.uimonen@intel.com