-
Notifications
You must be signed in to change notification settings - Fork 3k
Add option to make Nanostack use global event queue #7107
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
Conversation
@TeroJaasko - untested, but do you think this would work for you? Should just need to switch your big stack allocation to the global event queue, along with setting it to "dispatch from from main", and then do so. |
fa38e8e
to
31e46fd
Compare
This needs lot of testing before I would turn this option on, hoever, if off by default, its safer to go in and enter longer testing runs. |
@@ -0,0 +1,86 @@ | |||
/* | |||
* Copyright (c) 2016 ARM Limited, All Rights Reserved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't these new files have licenses as the rest of t he files (apache) ?
Which release could this make? |
@JanneKiiskila This is an interesting PR. It can definitely be seen as a fix as @kjbracey-arm mentioned, however it could also be seen as a new feature, because it's adding new functionality that wasn't previously there. If this is deemed closer to a feature than a fix, it will be released in 5.10. I'm more inclined to lean towards a fix, since this particular changeset appears to not require users to change their applications. @ARMmbed/mbed-os-maintainers thoughts? By the way, the new files still need full license headers. |
Based on the changes and feedback above (about having it off and testing it for longer), I would use minor version for this one. However as noted, if there is an issue that this is addressing, considering patch would be fine. @JanneKiiskila @kjbracey-arm please advise I would like to run CI, but waiting for the license fix |
@kjbracey-arm @JanneKiiskila Any update on the PR? |
Looks good to me. This works on my K64F & ESP8266. Tested after rebasing with current Mbed OS master. Verified also with the MBED_CONF_EVENTS_SHARED_DISPATCH_FROM_APPLICATION option. One could even modify eventOS_scheduler_run() to have
so this would be a drop in replacement and one could select the underlying event dispatching model by mbed_app.json. But that might be too evil. This still creates larger code than Mbed OS 5.8, where one could get event based application with networking stack running in a single thread (ie. from main() function) without most of RTOS code for semaphore and threads. If the high priority event queue could also be optionally dispatched from the application thread, the amount of RTOS primitives and RAM usage could be minimized. |
|
31e46fd
to
898ca13
Compare
Inserted Apache licence |
@@ -0,0 +1,58 @@ | |||
/* | |||
* Copyright (c) 2016 ARM Limited, All Rights Reserved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 files are still not having the proper license (+header file)
extern "C" { | ||
#endif | ||
|
||
void ns_event_loop_mutex_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have doxygen doc (I noticed a comment in the code file, can be moved here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so - it's internal API. Only exists because of a split between two C files here.
Ultimately gets called a couple of layers down inside public APIs that do have Doxygen (ns_hal_init
for Nanostack HAL-using apps like mbed client, else the constructor of a Nanostack-based NetworkInterface
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use /internal and still move that comment here. Not certain if this is our practice (I searched platform/drivers for internal keyword, not found it in the docs) but would encourage that.
@ARMmbed/mbed-docs documentation for internal functions? we have doxygen internal flag set to NO so will be excluded. No internal flag mention in https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/API_Documentation/
* Copyright (c) 2016 ARM Limited, All Rights Reserved | ||
*/ | ||
|
||
#include <mbed_assert.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why assert is having <>
for inclusion?
898ca13
to
a25fba3
Compare
@@ -2,18 +2,20 @@ | |||
* Copyright (c) 2016 ARM Limited, All Rights Reserved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we are changing this file, also license should fixed (can we make sure have proper license headers in nanostack) ?
f73d1b9
to
e8ceedd
Compare
Popped in some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work fine, at least when both events.shared-dispatch-from-application and nanostack-hal.event-loop-use-mbed-events are enabled.
I want this to a patch release, we can't wait for 5.10 with this one. |
This adds a new functionality, can't be part of the patch release unfortunately. |
/morph build |
It's not a new feature really. It's changing the internals of how nanostack works to fix an issue with the size of the system. I don't see a reason why that wouldn't go into a patch release. |
Thank @bulislaw , I agree 100% with you. |
@bulislaw @JanneKiiskila |
No it doesn't, it changes internals of Nanostack and exposes a config option so that MCC can tweak it. |
So anyone can use this option and tweak the configuration, potentially breaking something ? Sounds like a change in behaviour of the code which is also only supposed to go to feature releases. It is a very grey area. |
Any change can break things, even bug fix can break something so I don't think that's specific to features. On the side note @kjbracey-arm @JanneKiiskila why do we give people choice? It's just more configuration to support and tests, could we only support the shared event queue? |
I made my comment without realizing my earlier comment:
👍 |
I am generally inclined to approve, but could you clarify one item? Does it change functionality for existing projects? i.e. if I have designed a product already and update to this patch, will I have to change any code for compatibility? |
Build : SUCCESSBuild number : 2570 Triggering tests/morph test |
@ChiefBureaucraticOfficer no, you won't need to change anything for cases that used to work. This change adds an optimisation that can be switched on to save some memory. Before we merge that we should understand why do we need to have this choice and not just use the optimised version. |
Marking DNM for the time being to make sure this doesn't get merged without @bulislaw question is asnwered. |
Exporter Build : SUCCESSBuild number : 2214 |
Test : SUCCESSBuild number : 2324 |
Ok, based on bulislav's comments above, I see no reason to hold up this PR any further. Lets move forward with integration. |
From internal discussion:
That makes sense to me, we should proceed with merging that with patch release tag. |
Add option to make Nanostack use global event queue
Description
As a potential memory saving, offer the option to let Nanostack run its event loop in the global event queue context.
Pull request type
Could arguably be a "fix" for the increased memory usage of 5.9.0. for mini client.