Skip to content
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

Networking stack crashes when run in cooperative scheduling mode only #32375

Closed
mnkp opened this issue Feb 16, 2021 · 0 comments · Fixed by #32384
Closed

Networking stack crashes when run in cooperative scheduling mode only #32375

mnkp opened this issue Feb 16, 2021 · 0 comments · Fixed by #32384
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@mnkp
Copy link
Member

mnkp commented Feb 16, 2021

Describe the bug

When networking stack is run in the cooperative scheduling mode only, enabled by setting CONFIG_NUM_PREEMPT_PRIORITIES=0, it crashes during the initialization.

In cooperative scheduling mode only any threads have to use priorities <= -2. Networking stack erroneously sets CONFIG_NET_MGMT_EVENT_THREAD_PRIO to -1. The change was introduced in f02fd19.

To Reproduce

  1. Run
west build -b sam_e70_xplained -- -DCONFIG_ASSERT=y -DCONFIG_NUM_PREEMPT_PRIORITIES=0 samples/net/sockets/echo
west flash
  1. Check the terminal output, it will display
ASSERTION FAIL [((((prio)) == -1 && z_is_idle_thread_entry((entry))) || (((-1 - 1) >= ((-16 - 1))) && ((prio)) >= ((-16 - 1)) && ((prio)) <= (-1 - 1)))] @ WEST_TOPDIR/zephyr/kernel/thread.c:550
        invalid priority (-1); allowed range: -2 to -17

Expected behavior
The networking stack used to work when run in cooperative scheduling mode only.

Environment

  • Using toolchain: zephyr 0.12.2
  • Zephyr version: 2.5.0
@mnkp mnkp added bug The issue is a bug, or the PR is fixing a bug area: Networking labels Feb 16, 2021
@nashif nashif added the priority: low Low impact/importance bug label Feb 17, 2021
jukkar added a commit to jukkar/zephyr that referenced this issue Feb 17, 2021
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>
@carlescufi carlescufi added priority: high High impact/importance bug and removed priority: high High impact/importance bug labels Feb 17, 2021
jukkar added a commit that referenced this issue Feb 17, 2021
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 #32375

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
zephyrbot pushed a commit that referenced this issue Feb 17, 2021
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 #32375

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
nashif pushed a commit that referenced this issue Feb 24, 2021
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 #32375

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants