Skip to content

subsys: llext: relocating symbols is too slow for large llext module #99223

@checkupup

Description

@checkupup

Summary

I found this performance issue when developing Sound Open Firmware module on Chromebook device.

Environments
Zephyr Version: e876dee, manifest-rev branch
Sound Open FIrmware Version: 106747004ac0da162017f5e61187c6d87f5ec435, main branch
Chromium OS Version: release-R138-16295.B
Linux Kernel Version: 6.6.76
Platform: Intel MTL
LLEXT Module: See thesofproject/sof#10331

Description
When llext_link_plt parses and relocates a code segment containing a large number of entries, the process takes approximately 4 seconds. This duration significantly exceeds the 500ms IPC timeout threshold, preventing the DSP from booting normally. See below:

[ 23.221480] <inf> llext: do_llext_load: Linking ELF...
[ 23.221500] <inf> llext: llext_link_plt: Found 0xa13849ef in PLT 4 size 12 cnt 25182 text 0xa1276040
[ 27.046163] <inf> llext: llext_link_plt: Found 0xa1384a0a in PLT 4 size 12 cnt 4 text 0xa1276040
...
[ 27.721045] <inf> llext: llext_load: Loaded extension DAX
[ 27.721055] <err> lib_manager: llext_manager_link: .text: start: 0xa0688000 size 0x6ed29
[ 27.721060] <err> lib_manager: llext_manager_link: .rodata: start: 0xa06f7000 size 0x2bb7c
[ 27.721081] <err> lib_manager: llext_manager_link: .data: start: 0xa0723000 size 0x990
[ 27.721088] <err> lib_manager: llext_manager_link: .bss: start: 0xa0723990 size 0x684

Describe the solution you'd like

We aim to optimize the symbol relocation speed of llext so that large llext modules can load properly. According to SOF's llext time constraints, the entire llext loading process must complete within 200 milliseconds.

Alternatives

If this optimization is constrained by the hardware limitations of the MTL platform, we hope to achieve optimization on future hardware platforms such as PTL.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

EnhancementChanges/Updates/Additions to existing featuresarea: llextLinkable Loadable Extensions

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions