Skip to content
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

Introduce "ondemand" linker sections #77827

Merged
merged 2 commits into from
Sep 10, 2024
Merged

Conversation

npitre
Copy link
Collaborator

@npitre npitre commented Aug 30, 2024

This is needed when the firmware is significantly bigger than the available
RAM.

This can be seen in action with the ARM64 demand paging support in PR #74129.

Nicolas Pitre added 2 commits August 30, 2024 12:29
This provides __ondemand_func and __ondemand_rodata tags for annotating
functions and read-only data that should be loaded on demand so not to
exhaust all available RAM. The demand paging mechanism will be leveraged
to load so designated code/data as needed and to evict it from memory
when unused.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This sets initial unpaged mappings for __ondemand_func code and
__ondemand_rodata variables. To achieve this, we have to augment the
backing store API.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
@npitre
Copy link
Collaborator Author

npitre commented Aug 31, 2024 via email

@dcpleung
Copy link
Member

dcpleung commented Sep 3, 2024

Pinned sections can still be used, right?
Well, you have to choose. Either you have explicit pinned sections and everything else is implicitly evictable, or you have explicit on-demand (aka evictable) sections and everything else is implicitly pinned. Both tags may coexist of course.

Wonder if they should be make mutually exclusive by adding !LINKER_USE_ONDEMAND_SECTION to pinned section kconfig.

Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

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

FWIW I do kind of worry that we've now implemented two converse solutions to the same problem... Clearly the API can be different with how the defaults work, but surely the backend should be the same for "pinned" and "on demand", no?

Not a -1, but sort of a smell complaint.

@npitre
Copy link
Collaborator Author

npitre commented Sep 5, 2024 via email

@npitre
Copy link
Collaborator Author

npitre commented Sep 10, 2024

@andyross @peter-mitsis ping

Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

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

Oh, never actually +1'd. Still kind of worry about the bifurcation, but this is clean enough.

@nashif nashif merged commit 1e4fd23 into zephyrproject-rtos:main Sep 10, 2024
42 checks passed
@npitre npitre deleted the ondemand branch January 10, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants