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

reel_board: tests/kernel/sched/schedule_api/ fails on multiple boards #29705

Closed
s-kelvin opened this issue Nov 2, 2020 · 5 comments · Fixed by #30916
Closed

reel_board: tests/kernel/sched/schedule_api/ fails on multiple boards #29705

s-kelvin opened this issue Nov 2, 2020 · 5 comments · Fixed by #30916
Assignees
Labels
area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@s-kelvin
Copy link
Collaborator

s-kelvin commented Nov 2, 2020

EDIT: Affects multiple Nordic boards and mec15xxevb_assy6853

Describe the bug
Running tests/kernel/sched/schedule_api/ on reel board. Assertion in test_slice_reset failed in both kernel.scheduler and kernel.scheduler.multiq testcases.

To Reproduce
Steps to reproduce the behavior:

  1. west build -p auto -b reel_board tests/kernel/sched/schedule_api/
  2. west flash

Expected behavior
Test should pass.

Impact
Test suite fails.

Logs and console output

*** Booting Zephyr OS build zephyr-v2.4.0-1133-ge4e3ab3cc315  ***
Running test suite threads_scheduling
===================================================================
START - test_bad_priorities
PASS - test_bad_priorities
===================================================================
START - test_priority_cooperative
PASS - test_priority_cooperative
===================================================================
START - test_priority_preemptible
PASS - test_priority_preemptible
===================================================================
START - test_priority_preemptible_wait_prio
PASS - test_priority_preemptible_wait_prio
===================================================================
START - test_yield_cooperative
PASS - test_yield_cooperative
===================================================================
START - test_sleep_cooperative
PASS - test_sleep_cooperative
===================================================================
START - test_sleep_wakeup_preemptible
PASS - test_sleep_wakeup_preemptible
===================================================================
START - test_pending_thread_wakeup
PASS - test_pending_thread_wakeup
===================================================================
START - test_time_slicing_preemptible
PASS - test_time_slicing_preemptible
===================================================================
START - test_time_slicing_disable_preemptible
PASS - test_time_slicing_disable_preemptible
===================================================================
START - test_lock_preemptible
PASS - test_lock_preemptible
===================================================================
START - test_unlock_preemptible
PASS - test_unlock_preemptible
===================================================================
START - test_unlock_nested_sched_lock
PASS - test_unlock_nested_sched_lock
===================================================================
START - test_sched_is_preempt_thread
PASS - test_sched_is_preempt_thread
===================================================================
START - test_slice_reset
Assertion failed at WEST_TOPDIR/zephyr/tests/kernel/sched/schedule_api/src/test_sched_timeslice_reset.c:91: thread_time_slice: (t <= expected_slice_max is false)
timeslice too big, expected 6555 got 7208
Assertion failed at WEST_TOPDIR/zephyr/tests/kernel/sched/schedule_api/src/test_sched_timeslice_reset.c:88: thread_time_slice: (t >= expected_slice_min is false)
timeslice too small, expected 6553 got 617
FAIL - test_slice_reset
===================================================================
START - test_slice_scheduling
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
PASS - test_slice_scheduling
===================================================================
START - test_priority_scheduling
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
ABCDEFGHI
PASS - test_priority_scheduling
===================================================================
START - test_wakeup_expired_timer_thread
PASS - test_wakeup_expired_timer_thread
===================================================================
START - test_user_k_wakeup
PASS - test_user_k_wakeup
===================================================================
START - test_user_k_is_preempt
PASS - test_user_k_is_preempt
===================================================================
Test suite threads_scheduling failed.
===================================================================
PROJECT EXECUTION FAILED

Environment (please complete the following information):

  • OS: Linux Ubuntu 18.04.4 LTS
  • Toolchain Zephyr SDK 0.11.2
  • Zephyr version zephyr-v2.4.0-1133-ge4e3ab3cc315
@s-kelvin s-kelvin added the bug The issue is a bug, or the PR is fixing a bug label Nov 2, 2020
@maksimmasalski
Copy link
Collaborator

maksimmasalski commented Nov 2, 2020

Fails on the mec15xxevb_assy6853 too. In multiq configuration and in standard without it.
kernel.scheduler.kernel.scheduler.slice_reset Fails
kernel.scheduler.kernel.scheduler.multiq.slice_reset Fails

@carlescufi carlescufi added the area: Tests Issues related to a particular existing or missing test label Nov 3, 2020
@pabigot pabigot assigned andyross and unassigned pabigot and ioannisg Nov 3, 2020
@pabigot
Copy link
Collaborator

pabigot commented Nov 3, 2020

This is specific to CONFIG_TIMESLICING=y, was introduced at 0875740, and is reproducible on multiple Nordic boards.

Given that the previous sync waited for a "millisecond" boundary I'm wondering if the test has an implicit assumption that milliseconds can be precisely represented, which is not true on Nordic hardware.

@pabigot pabigot changed the title reel_board:tests/kernel/sched/schedule_api/ failed tests/kernel/sched/schedule_api/ fails on multiple boards Nov 3, 2020
@MaureenHelm MaureenHelm added the priority: medium Medium impact/importance bug label Nov 3, 2020
@andyross
Copy link
Contributor

Was just pointed to this. Indeed, this test looks to me like it's doing ms math on its timeouts.

@maksimmasalski
Copy link
Collaborator

Was just pointed to this. Indeed, this test looks to me like it's doing ms math on its timeouts.

What time you can expect to submit a PR? Do you need any help?

andyross pushed a commit to andyross/zephyr that referenced this issue Nov 18, 2020
Adjusting the tick alignment of this test caused it to start breaking
on nRF5 platforms, which use a 32768 Hz clock that doesn't divide
evenly into the millisecond precision used by the test.  The "half
slice" math ended up being wrong by a bit.

Convert to ticks first before computing the cycle delay needed.

Fixes zephyrproject-rtos#29705

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
@chen-png chen-png changed the title tests/kernel/sched/schedule_api/ fails on multiple boards reel_board: tests/kernel/sched/schedule_api/ fails on multiple boards Dec 7, 2020
@rljordan rljordan assigned ceolin and unassigned andyross Dec 9, 2020
ceolin pushed a commit to ceolin/zephyr that referenced this issue Dec 17, 2020
Adjusting the tick alignment of this test caused it to start breaking
on nRF5 platforms, which use a 32768 Hz clock that doesn't divide
evenly into the millisecond precision used by the test.  The "half
slice" math ended up being wrong by a bit.

Convert to ticks first before computing the cycle delay needed.

Fixes zephyrproject-rtos#29705

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
@ceolin ceolin linked a pull request Dec 20, 2020 that will close this issue
@ABOSTM
Copy link
Collaborator

ABOSTM commented Jan 15, 2021

On STM32 boards, I found that this test fails depending on clock frequency,
and I propose a fix by increasing SLICE_SIZE:
#30791

ceolin pushed a commit to ceolin/zephyr that referenced this issue Jan 22, 2021
Adjusting the tick alignment of this test caused it to start breaking
on nRF5 platforms, which use a 32768 Hz clock that doesn't divide
evenly into the millisecond precision used by the test.  The "half
slice" math ended up being wrong by a bit.

Convert to ticks first before computing the cycle delay needed.

Fixes zephyrproject-rtos#29705

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
nashif pushed a commit that referenced this issue Jan 27, 2021
Adjusting the tick alignment of this test caused it to start breaking
on nRF5 platforms, which use a 32768 Hz clock that doesn't divide
evenly into the millisecond precision used by the test.  The "half
slice" math ended up being wrong by a bit.

Convert to ticks first before computing the cycle delay needed.

Fixes #29705

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
9 participants