-
Notifications
You must be signed in to change notification settings - Fork 349
rtos: alloc: Fix SOF_MEM_FLAG_* values #10227
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
|
@lgirdwood this is not an ideal fix, but it really unblocks lots of failed tests on IMX side. |
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.
Pull Request Overview
This PR fixes SOF_MEM_FLAG_* values to prevent overlap with existing SOF_BUF_* flags after a recent API change that merged capabilities into flags. The fix ensures compatibility by reserving the first two bit positions for SOF_BUF_* flags and shifting SOF_MEM_FLAG_* values to higher bit positions.
- Adds comments explaining the compatibility requirement and reserved bit positions
- Shifts all SOF_MEM_FLAG_* definitions to higher bit values to avoid overlap
- Updates both Zephyr and POSIX implementations consistently
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| zephyr/include/rtos/alloc.h | Shifts SOF_MEM_FLAG_* values starting from BIT(1) with reserved positions for compatibility |
| posix/include/rtos/alloc.h | Shifts SOF_MEM_FLAG_* values starting from BIT(2) with reserved positions for compatibility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
66cb904 to
3b70c59
Compare
Commit 5821682 ("heap: simplify heap API") changed the heap API to make it more like Linux kernel API. For example: -> rballoc_align(flags, caps, bytes, align) transformed into: -> rballoc_align(flags, bytes, align) So, caps was merged into flags! Causing overrun_permitted to be set and making a lots of test (e.g SRC, Compress) to fail. The original `flags` were the SOF_BUF_ flags mostly sent from Linux and read from topology (e.g SOF_BUF_OVERRUN_PERMITTED, SOF_BUF_UNDERRUN_PERMITTED). But the new `flags` SOF_MEM_FLAG_* did not take this into account and overlap with the older flags. For now, what we can do is just shift the new flags so that they do not overlap with the old flags. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
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.
@dbaluta think it may just be better removing the audio_stream->underrun_permitted as it looks like no one is using them in topology and no one is using the DMA based scheduling. Pls do shout if anyone is using.
| /* | ||
| * for compatibility with the initial `flags` meaning | ||
| * SOF_MEM_FLAG_ should start at BIT(2) | ||
| * the first two positions are reserved for SOF_BUF_ flags | ||
| */ | ||
|
|
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.
ok, looks like we need to split out the caps for buffers a tad more.
So @jsarha is working on removing rballoc() to align with a single low level allocator and we need some way for buffer API to handle.
@dbaluta btw - I dont think we have any users of the SOF_BUF_OVERRUN_PERMITTED and SOF_BUF_UNDERRUN_PERMITTED - at least from grepping the topologies - IIRC these were a legacy flag around DMA based scheduling of pipelines (where > 1 DMAs could trigger at the same time). I think we could remove.
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 I think this is a slightly better PR: #10228
with less invasive modification.
I prefer not to remove this as it looks very invasive. Lots of bad things could happen. Instead I have fixed the issue of modified flags here: #10228 |
kv2019i
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.
I'm good with this as well.
Commit 5821682 ("heap: simplify heap API") changed the heap API to make it more like Linux kernel API.
For example:
-> rballoc_align(flags, caps, bytes, align)
transformed into:
-> rballoc_align(flags, bytes, align)
So, caps was merged into flags! Causing overrun_permitted to be set and making a lots of test (e.g SRC, Compress) to fail.
The original
flagswere the SOF_BUF_ flags mostly sent from Linux and read from topology (e.g SOF_BUF_OVERRUN_PERMITTED, SOF_BUF_UNDERRUN_PERMITTED).But the new
flagsSOF_MEM_FLAG_* did not take this into account and overlap with the older flags.For now, what we can do is just shift the new flags so that they do not overlap with the old flags.