-
Notifications
You must be signed in to change notification settings - Fork 349
[WIP][RFC]codec adapter: move generic mem alloc to component #4112
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
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>
|
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
@cujomalainey fyi |
|
@juimonen this should go into main branch. There are no dependencies. |
interesting, codeowners does not recurse into directories with |
|
Thanks for moving this, its an excellent piece of code that just needs to benefit everyone 😃 |
|
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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)
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.
@cujomalainey sound good to me.
|
Can one of the admins verify this patch? |
78c3229 to
1ad177d
Compare
7ff3c3f to
b91ed92
Compare
e7a3d6a to
81bcfe5
Compare
|
ping on this patch, this is something i would like to base a feature off of |
|
@juimonen whats' the ETA for this patch ? What's still to do ? |
7d2075b to
022ea8c
Compare
lyakh
left a comment
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe first delete from the list, then free?
|
let me work on this next week, was busy this week with other stuff. |
25412d0 to
0393ee6
Compare
|
@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