Skip to content

Only heap size attribute#10842

Open
jsarha wants to merge 4 commits into
thesofproject:mainfrom
jsarha:only_heap_size_attribute
Open

Only heap size attribute#10842
jsarha wants to merge 4 commits into
thesofproject:mainfrom
jsarha:only_heap_size_attribute

Conversation

@jsarha
Copy link
Copy Markdown
Contributor

@jsarha jsarha commented Jun 3, 2026

This PR is base on #10831 and should go in after it. It is also an integral part of soon to be pushed new version #10783 and should go in only after we are convinced of #10783 changes, automating division between vregion lifetime and interim allocations, and in effect moving most of allocations to lifetime linear part of the vregion heap.

This is a separate PR because this should go in before we tag the next SOF release, to not to let our IPC and topology attribute wandering to contaminate our SOF releases. That is if we get convinced of #10783 approach.

This is a pair with the soon to be pushed new version of thesofproject/linux#5537

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates module allocation helpers into the RTOS allocation headers and simplifies IPC4 DP/pipeline “memory requirement” attributes to a single heap size field, aiming to prevent interim/lifetime/shared attribute proliferation ahead of the next SOF release (and in preparation for follow-up vregion work referenced in the PR description).

Changes:

  • Move mod_alloc_ctx + sof_ctx_{alloc,zalloc,free}() API into rtos/alloc.h (Zephyr + POSIX) and delete src/include/sof/ctx_alloc.h.
  • Simplify IPC4 DP/pipeline memory requirement structs to use only heap_bytes and update related decode logging.
  • Adjust vregion.h stubs for !CONFIG_SOF_VREGIONS to no longer allocate/free a dummy struct vregion and to return NULL for vregion ops.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
zephyr/include/rtos/alloc.h Adds mod_alloc_ctx and sof_ctx_* helpers (with vregion support) directly in RTOS alloc header.
posix/include/rtos/alloc.h Adds POSIX “heap-only” mod_alloc_ctx and sof_ctx_* helpers for API parity.
src/include/sof/lib/vregion.h Simplifies non-vregions stubs (no dummy allocation; vregion ops return NULL).
src/include/sof/lib/dai-zephyr.h Removes now-deleted sof/ctx_alloc.h include.
src/include/sof/audio/component.h Removes now-deleted sof/ctx_alloc.h include.
src/include/sof/ctx_alloc.h Deletes the standalone ctx allocation header (API moved to rtos/alloc.h).
src/include/ipc4/pipeline.h Replaces interim/lifetime/shared fields with heap_bytes in IPC4 pipeline mem data.
src/include/ipc4/module.h Replaces interim/lifetime/shared fields with heap_bytes in IPC4 DP mem data.
src/ipc/ipc4/helper.c Updates IPC4 pipeline ext object decode log to match heap_bytes.
src/audio/module_adapter/module_adapter_ipc4.c Updates IPC4 module ext init decode log to match heap_bytes.
src/audio/module_adapter/module/generic.c Drops sof/ctx_alloc.h include (uses moved API).
src/audio/buffers/ring_buffer.c Drops sof/ctx_alloc.h include (uses moved API).
src/audio/buffers/comp_buffer.c Drops sof/ctx_alloc.h include (uses moved API).

struct k_heap *sof_sys_heap_get(void);
struct k_heap *sof_sys_user_heap_get(void);

/* Posix version of struct mod_alloc_ctx without vregion support */
lyakh
lyakh previously requested changes Jun 4, 2026
Copy link
Copy Markdown
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.

use-counts are needed

Jyri Sarha added 4 commits June 4, 2026 22:04
…build

Remove need to include rtos/alloc.h in !CONFIG_SOF_VREGIONS build. We
do not need the dummy vregion objects for anything, so get rid of
them. From now on creating a vregion object when CONFIG_SOF_VREGIONS
is not defined will fail.

Also make sure the vregions is not tried to be used if its not
enabled. Even before this change the failure would have happened
couple of lines later.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Remove the ctx_alloc.h header and move the implementation into
rtos/alloc.h.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Simplify the IPC4 memory data structs by replacing separate
interim_heap_bytes, lifetime_heap_bytes, and shared_bytes fields with a
single heap_bytes field, matching the Linux driver side changes.

Affects both ipc4_module_init_ext_obj_dp_data and
ipc4_pipeline_ext_obj_mem_data structs, and their corresponding log
messages.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the only_heap_size_attribute branch from c00d82c to c3abdd3 Compare June 4, 2026 21:53
@jsarha jsarha changed the title [DNM] Only heap size attribute Only heap size attribute Jun 4, 2026
@jsarha
Copy link
Copy Markdown
Contributor Author

jsarha commented Jun 4, 2026

There really is no reason to keep the [DNM] tag. This is really only back stepping one unnecessary change that has not been released in any SOF release.

@lyakh lyakh dismissed their stale review June 5, 2026 06:12

misunderstanding on my part

@lyakh
Copy link
Copy Markdown
Collaborator

lyakh commented Jun 5, 2026

@jsarha yep, sorry again - was too quick reacting to the use-count removal yesterday. You now have 2 PRs with some common commits - this one and #10831. Looks like this one supersedes the the latter. Let me approve both then

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.

3 participants