Skip to content

Conversation

@lyakh
Copy link
Collaborator

@lyakh lyakh commented Apr 4, 2025

Fully automated module dependency tree generation isn't planned for SOF yet, so for now we do this manually. At the moment the sorting is completely random, relying on Python's os.scandir() output. This patch makes it possible to order auxiliary LLEXT modules explicitly. It supports up to 9 dependency levels with level 1 being the most shallow one, i.e. only end-user modules can depend on it. If any level 1 modules depend on further modules, those are called "level 2" modules etc. For this llext targets in respective CMakeLists.txt files have to be called, e.g. "aux1_iir" - see existing examples. This then guarantees correct ordering and successful run-time symbol resolution.

Recommendet reviewing mode with white space differences removed

Copy link
Contributor

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

Works great, thank you!

@lyakh
Copy link
Collaborator Author

lyakh commented Apr 4, 2025

fixes #9941

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Looks good! And good catch @ujfalusi for the original bug.

pattern_aux = re.compile(r'^aux\d_.+_llext$')
aux = sorted([d for d in dirlist if pattern_aux.match(d)], reverse=True)
llext_dirs = [d for d in dirlist if d.endswith('_llext') and d not in aux]
finallist = aux + llext_dirs
Copy link
Collaborator

Choose a reason for hiding this comment

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

final_list? looks a bit weird when other variables have underscores

Copy link
Contributor

Choose a reason for hiding this comment

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

Eurovision-easter egg?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kv2019i done :-)

Fully automated module dependency tree generation isn't planned for
SOF yet, so for now we do this manually. At the moment the sorting is
completely random, relying on Python's os.scandir() output. This
patch makes it possible to order auxiliary LLEXT modules explicitly.
It supports up to 9 dependency levels with level 1 being the most
shallow one, i.e. only end-user modules can depend on it. If any
level 1 modules depend on further modules, those are called "level 2"
modules etc. For this llext targets in respective CMakeLists.txt
files have to be called, e.g. "aux1_iir" - see existing examples.
This then guarantees correct ordering and successful run-time symbol
resolution.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lgirdwood lgirdwood merged commit d3e3fce into thesofproject:main Apr 4, 2025
44 of 49 checks passed
@lyakh lyakh deleted the aux branch April 5, 2025 08:34
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.

4 participants