Skip to content

Conversation

@juimonen
Copy link

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

lrgirdwo and others added 13 commits April 27, 2021 15:07
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>
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
Copy link
Author

@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) {
Copy link
Collaborator

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.

Copy link
Author

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...

Copy link
Member

@lgirdwood lgirdwood left a 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.

  1. Move it to the allocator logic. i.e. all memory logic in one place.
  2. 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
Copy link
Member

@cujomalainey fyi

@lgirdwood
Copy link
Member

@juimonen this should go into main branch. There are no dependencies.

@cujomalainey
Copy link
Contributor

@cujomalainey fyi

interesting, codeowners does not recurse into directories with * thanks for the FYI

@cujomalainey
Copy link
Contributor

Thanks for moving this, its an excellent piece of code that just needs to benefit everyone 😃

@juimonen
Copy link
Author

Thanks @juimonen. I would make two changes here.

  1. Move it to the allocator logic. i.e. all memory logic in one place.
  2. 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.
  1. ok
  2. I'm not sure I can do that as our driver creates the pipeline component after the components themselves have been created -> I don't necessarily have a pipeline where to store the memory...

@lgirdwood
Copy link
Member

Thanks @juimonen. I would make two changes here.

  1. Move it to the allocator logic. i.e. all memory logic in one place.
  2. 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.
  1. ok
  2. I'm not sure I can do that as our driver creates the pipeline component after the components themselves have been created -> I don't necessarily have a pipeline where to store the memory...

@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 */
Copy link
Contributor

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)

Copy link
Member

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.

@gkbldcig
Copy link
Collaborator

Can one of the admins verify this patch?

@juimonen juimonen requested review from bardliao and ranj063 May 12, 2021 16:02
@lgirdwood lgirdwood force-pushed the lrg/topic/ipc4 branch 3 times, most recently from 78c3229 to 1ad177d Compare May 17, 2021 16:13
@lgirdwood lgirdwood force-pushed the lrg/topic/ipc4 branch 5 times, most recently from 7ff3c3f to b91ed92 Compare June 2, 2021 10:50
@lgirdwood lgirdwood force-pushed the lrg/topic/ipc4 branch 2 times, most recently from e7a3d6a to 81bcfe5 Compare June 9, 2021 19:33
@cujomalainey
Copy link
Contributor

ping on this patch, this is something i would like to base a feature off of

@lgirdwood
Copy link
Member

@juimonen whats' the ETA for this patch ? What's still to do ?

Copy link
Collaborator

@lyakh lyakh left a 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);
Copy link
Collaborator

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?

@juimonen
Copy link
Author

let me work on this next week, was busy this week with other stuff.

@kv2019i
Copy link
Collaborator

kv2019i commented Apr 20, 2022

@juimonen Over a year without activity, should this be closed?

@lgirdwood lgirdwood closed this Apr 20, 2022
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.

10 participants