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

Automating initialization entries ordering #76937

Open
5 tasks
tbursztyka opened this issue Aug 12, 2024 · 0 comments
Open
5 tasks

Automating initialization entries ordering #76937

tbursztyka opened this issue Aug 12, 2024 · 0 comments
Assignees
Labels
area: Device Model Enhancement Changes/Updates/Additions to existing features

Comments

@tbursztyka
Copy link
Collaborator

tbursztyka commented Aug 12, 2024

Current problem

Initialization entry priorities (along with levels, but let's not consider it here for simplification) are meant to sort which entry has to start before/after another one. Such entries can be about a device instance or a "software" instance (SYS_INIT(...)).

Most device instances are DTS based, and the priority is thus inferred from DTS directly. However this is not the case for SYS_INIT(...) instances. This creates a weird half-way backed system where users still may have to tweak manually the priority numbers, either in code or via Kconfig when possible, to get a proper initialization entries ordering.

All of this should be automated. There is no reason not to. Also taking into account that:

  • It should also keep the possibility to instantiate a device out of DTS (manual instantiation)
  • deprecation of existing macros should go along properly. I.e. these macros should not break during that time (only the priority parameter might have to be tweaked on some instances to keep a sane ordering.)
  • It should enable the possibility of adding new features related to initialization entries without changing the new macros

Solution

Following a proposal #73836 and following discussions, here are the steps to full-fill:

  • Find new macro names that will be used to replace the ones that are going to be deprecated: SYS_INIT but also all DEVICE_DEFINE_* ones (since priority parameter is going to disappear)
  • Add built-time called script that will automatically generate priorities from relevant information ([RFC] Init entries: Automatically computing priorities #73836 proposed to add YAML files but it could be different)
  • Add the new macros taking advantage of these generated priorities
  • Switch all former macros found upstream to the new ones (ideally RFC: platform hooks to replace SYS_INIT in soc/board code #75907 should be fixed first but it is not mandatory, it would make things easier though)
  • Proceed with old macros deprecation (related scripts also, like check_init_priorities.py)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Device Model Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

1 participant