sof
sof copied to clipboard
[DNM] llext_manager: Fix for multipipeline issue with llext
The module_data
structure is unique for each module instance. We will not be able to tell whether this is the first loading of the module based on the value of any of its fields. I moved the llext
structure to the module context and added an instance counter to protect against loading the module code into memory for subsequent instances. When releasing a module, we check whether it was the last instance of it.
@softwarecki one question: have you tested these patches with llext and in particular with the scenario that you are trying to fix - with multiple pipelines? If not, let's put some "Do Not Merge" indication in the PRs title. It's currently a draft, but would be safer to keep a reminder there too. Unfortunately we don't yet have LLEXT tests in the CI (yes, I'm working towards that) and without testing these changes are too intrusive to verify just by reading.
@lyakh Don't treat it like a real PR. I created it just to show my vision of where I thought the zephyr llext handle should be stored. The module_data
structure is created per instance and doesn't seem to be the right place.
@lyakh Don't treat it like a real PR. I created it just to show my vision of where I thought the zephyr llext handle should be stored. The
module_data
structure is created per instance and doesn't seem to be the right place.
Thanks, it wasn't quite clear, that this was just an "idea demonstration," not a real PR. With a "DNM" prefix now it's clearer.
Yes, you're right, the llext
context should be per driver, not per module. The library manager context might indeed be a good place for it, thanks for the idea.