-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Enforce COOP priorities for networking subsystem #8386
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
Changes from all commits
f72c3de
a57572a
8dcae2c
072afc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -419,4 +419,11 @@ static int net_init(struct device *unused) | |
| return status; | ||
| } | ||
|
|
||
| /* The networking subsystem requires the main thread to execute at a | ||
| * cooperative priority to function correctly. If this build assert triggers | ||
| * verify your configuration to ensure that cooperative threads are enabled | ||
| * and that the main thread priority is negative (cooperative). | ||
| */ | ||
| BUILD_ASSERT(CONFIG_MAIN_THREAD_PRIORITY < 0); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invalid configurations should be detected during configuration instead I believe that adding the below at an appropriate net Kconfig location would achieve this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see that this is going to do much anyway. The fact that the main thread is or is not preemptible says nothing about users of the network APIs which may or may not be running in the main thread. Not, for example, that ztest always spawns a new thread for every test, so none of the existing tests would be caught by this check if they happened to be hitting the network out of a preemptible thread. I'd suggest a runtime __ASSERT(k_thread_prioroity_get(k_current_get() < 0) at the relevant API entry points.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This will give error if the default MAIN_THREAD_PRIORITY is 0. In which case user needs to add the proper value into prj.conf file. This PR tries to avoid this. |
||
| SYS_INIT(net_init, POST_KERNEL, CONFIG_NET_INIT_PRIO); | ||
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.
I don't think this actually does anything useful.
You can test this by trying to come up with a situation where this select prevents an invalid configuration from occuring.