Repository navigation
zephyr: enable and size vregions on ACE 1.5 and ACE 2.0 #11518
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
Draft
lgirdwood
wants to merge
5
commits into
thesofproject:main
Choose a base branch
from
lgirdwood:topic/vregion-ace15-ace20
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5d35f5a
vpage: make the physical L2 kept for loadable modules configurable
lrgirdwo bce59ef
vpage: size the vpage region from one physical L2 budget
lrgirdwo f72c5ca
alloc: back system heap allocations with vpages when the heap is full
lrgirdwo bc05088
zephyr: enable vregions on ACE 1.5 and ACE 2.0
lrgirdwo 618b276
zephyr: add MemoryMap.md
lrgirdwo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Two
sof_heappressure cases exist here even on current kernels that send pipeline memory data (wheremodule_adapterallocations go to pipelinevregions):rballoc()callers (notably KPB on WoV topologies):rballoc_align()(zephyr/lib/alloc.c:783-790) has no pipelinevregioncontext. WithVIRTUAL_HEAP=y, those allocations went tovirtual_buffers_heap(which had a dedicated{ 524288, 1 } /* buffer for kpb */pool atzephyr/lib/alloc.c:404). WithVIRTUAL_HEAP=n,rballoc()goes directly tosof_heap. Bothintel_adsp_ace15_mtpm.confandintel_adsp_ace20_lnl.confsetCONFIG_SAMPLE_KEYPHRASE=y(CONFIG_COMP_KPB=y), andsrc/audio/kpb.c:676allocates its2.1 shistory buffer viarballoc()(134.4 kBat16 kHz / 2 ch / S16, or268.8 kBat16 kHz / 2 ch / S32). On top of the~109 kBbase heap usage (~378 kBbefore heap overhead/fragmentation), a 32-bit DMIC + KPB topology will be very tight or fail-ENOMEMin384 kB(sof-mtl-nocodec.tplgdoesn't instantiate KPB).CONFIG_SOF_USERSPACE_USE_SHARED_HEAP=ycarve-out: Inzephyr/lib/alloc.c:117,heapmemis sized asHEAPMEM_SIZE - SHARED_BUFFER_HEAP_MEM_SIZE. WhenSOF_USERSPACE_PROXY/SOF_USERSPACE_LLselectsSOF_USERSPACE_USE_SHARED_HEAP,SOF_ZEPHYR_SHARED_BUFFER_HEAP_SIZE(0x1E000=120 kBon MTL/LNL) is subtracted from0x60000, leaving only264 kBinsof_heap.Worth testing a DMIC + KPB WoV topology on MTL/LNL before dropping draft status (or migrating
kpb.coffrballoc()as part of#11517).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.
Good catch. v2 adds "alloc: back system heap allocations with vpages when the heap is full". When an
rmalloc(),rballoc()orsof_heap_alloc()allocation does not fit in the system heap, it is backed by whole vpages, andrfree()releases them. This is the vpage replacement for the VMH fallback that those three functions use today. It covers the KPB history buffer and any other allocation outside a pipeline vregion. The Zephyr TLB driver already invalidates the cache on map and flushes it on unmap, so no extra cache maintenance is needed. The LL thread does not use the fallback, asvpage_alloc()is cold code.Tested on ARL-S (MTL firmware) with a deliberately undersized 96kB heap, below the measured peak:
multiple-pipeline.sh -f a -c 20 -l 5passes, with 97 allocations backed by vpages. These include the host DMA buffers (1.5kB and 3kB), so DMA into vpage-backed memory works too.On the shared buffer heap:
SOF_USERSPACE_USE_SHARED_HEAPis not set in the default MTL/LNL builds. It only comes with the userspace overlays, which already setVIRTUAL_HEAP=n, and the same fallback applies there.