-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Decide if we keep a single thread support (CONFIG_MULTITHREADING=n) in Zephyr #27415
Comments
MeasurementsAll measurements taken using Only booting
MCUBoot
*around 504 bytes of those are caused by the addition of |
Passing comment about semaphores, as this has been a pain point and the subject of a few discussions at least in the past. More than a few drivers have their ISR give a semaphore on some event, taken by something running in thread context waiting for the event to occur. Or if the driver doesn't do it, an installed callback would. We could possibly do something that would work in a lot of cases if there's no threading or scheduling:
This would allow for the main execution context to block until we get event that triggers an ISR. I think this would allow more (definitely not all) drivers to be used in this configuration. |
While your comment is indeed valuable if we decide to keep |
I think what I'm discussing is more or less orthogonal to that. Currently I don't think you can use semaphores at all if multi threading is disabled. This would allow that (or something similar) using atomic operations for the specific case where we need to block the main execution until we get some external event from an interrupt. |
Agreed, it is orthogonal. The question is whether it's worthwhile going down the road you propose given that raw multithreading today is barely 1.1KB of ROM. |
Ah, now I see. Yes that is the real question! My feeling is "no" if that's all we save and we are confident we're not pulling in any code we don't need. |
need to move forward with this, @MaureenHelm should the finding above be presented to the TSC? Do we need to vote on removing this feature and shift focus on improving footprint in general? |
As just mentioned in the TSC meeting: another use-case that we are considering for ARC is use the no-multithreading version for a simple Secure binary (handling boot and secure services like Crypto). Multi-threading on the secure side could make things more complex than required for most cases. And simple typically also means more secure... |
@ruuddw, what latencies are introduced to non-secure handling (ISRs, meta-ISRs, and threads) while executing a secure service (e.g. Crypto)? |
Good question - don't have a complete answer yet. But, I think we would like the Secure services to be preemptible/cooperative: no multithreading within Secure mode, but the Secure 'context' can be swapped out to Normal, e.g. also while Secure context is waiting for a HW crypto engine result. The additional footprint is probably less of an issue, it's the complexity with scheduling on both sides why I'd like to stick to a single thread on the secure side. |
Decision in the TSC: Deprecate in the 2.4 release for this to be removed in the 2.6 release unless someone steps up to maintain the feature. |
great to see the ram/rom footprint comparison anyone done any performance tests with a "single threaded multi thread" app vs a non multithreaded one, basicaly doing the same thing, ie hw timer firing an irq -> process stuff -> write to uart -> wait |
Deprecate the Kconfig option for the time being. Unless a contributor volunteers to take over the work to maintain the option, it will be removed after 2 releases. Relates to zephyrproject-rtos#27415. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Deprecate the Kconfig option for the time being. Unless a contributor volunteers to take over the work to maintain the option, it will be removed after 2 releases. Relates to #27415. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
If Single Thread mode (CONFIG_MULTITHREADING=n) will be deprecated then: |
Just my 2 cents here. |
I would like to keep single thread support in zephyr. I started to work towards it (see #34279). |
Closing this since this is now complete. |
This issue contains the information required in order for us to make an informed decision on whether we should keep supporting a non-multithreaded mode (
CONFIG_MULTITHREADING=n
) in Zephyr for the foreseeable future.If we decide to keep it, then the scope of the non-multithreaded mode shall be:
main()
irq_lock()
andirq_unlock()
k_busy_wait()
andk_uptime_get()
The requirements for maintaining support for this mode in the tree are:
Related issues:
Remove single thread support (now obsolete, closed)Bugs:
CONFIG_MULTITHREADING=n
builds callmain()
with interrupts lockedInterrupts on Cortex-M do not work with CONFIG_MULTITHREADING=n[Fixed by ARM Cortex-M: Fix booting in no-multithreading mode #27343]Related PRs:
The text was updated successfully, but these errors were encountered: