-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
net: mgmt: Use proper coop thread priority value #32384
net: mgmt: Use proper coop thread priority value #32384
Conversation
If user sets CONFIG_NUM_PREEMPT_PRIORITIES=0, then the priority of the net_mgmt thread will be -1 which is the same as idle thread. This will trigger assert in kernel as then the minimum coop priority is -2 in this case. Remove the net_mgmt thread priority setting from Kconfig file as it is low value and set the coop thread priority the same way as other network threads are doing it. Fixes zephyrproject-rtos#32375 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
f4c2112
to
18ecdce
Compare
k_thread_create(&mgmt_thread_data, mgmt_stack, | ||
K_KERNEL_STACK_SIZEOF(mgmt_stack), | ||
(k_thread_entry_t)mgmt_thread, NULL, NULL, NULL, | ||
CONFIG_NET_MGMT_EVENT_THREAD_PRIO, 0, K_NO_WAIT); | ||
THREAD_PRIORITY, 0, K_NO_WAIT); |
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.
There is a predefined K_LOWEST_APPLICATION_THREAD_PRIO
in include/kernel.h
which could be used here. The define is used by e.g. logger subsystem.
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 did this change same way as the other networking threads are done so not using this define. The name of the define talks about application and we have no applications here but a thread which is part of a subsystem. But it is certainly possible to use that define if needed, but I would do that change in a separate PR if we really want to do it.
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.
From the kernel perspective subsystem is an application. There is no thread priority range that is reserved for subsystems. So the name K_LOWEST_APPLICATION_THREAD_PRIO
carries in fact the right meaning. Though I agree that seeing such a define in a networking stack might be confusing. From the user perspective subsystem is certainly not an application. Using the define was just a suggestion.
If user sets CONFIG_NUM_PREEMPT_PRIORITIES=0, then the priority
of the net_mgmt thread will be -1 which is the same as idle thread.
This is will assert in kernel as then the minimum coop priority is -2
in this case. Remove the net_mgmt thread priority setting from
Kconfig file as it is low value and set the coop thread priority
the same way as other network threads are doing it.
Fixes #32375
Signed-off-by: Jukka Rissanen jukka.rissanen@linux.intel.com