zephyr: it8xxx2_evb: tests/kernel/sched/schedule_api fail due to k_sleep(K_MSEC(100)) not correct
Describe the bug The daily test case tests/kernel/sched/schedule_api failed due to k_sleep(K_MSEC(100)) not correct, k_sleep is expected to wait 100ms, but actually it never ends.
Please also mention any information which could help others to understand the problem you’re facing:
- What target platform are you using?: it8xxx2_evb
- What have you tried to diagnose or workaround this issue? Add log before and after k_sleep(K_MSEC(100)), the log after it is never seen
To Reproduce Two ways to reproduce the behavior: Method 1
- twister -v -p it8xxx2_evb --device-testing --west-flash=“…/…/itetool/loader.sh” --device-serial=/dev/ttyUSB0 -T tests/kernel/sched/schedule_api Method 2
- west build -p always -b it8xxx2_evb tests/kernel/sched/schedule_api -DCONFIG_TIMESLICE_PER_THREAD=y -DCONFIG_TIMESLICING=y
- sudo -S ~/itetool/ite -f build/zephyr/zephyr.bin -s check
Expected behavior The test can pass
Impact Blocks all the daily tests under tests/kernel/sched/schedule_api
Logs and console output Logs for west:
*** Booting Zephyr OS build zephyr-v3.1.0-514-gf232db463078 (delayed boot 1ms) ***
Running TESTSUITE threads_scheduling
===================================================================
START - test_bad_priorities
PASS - test_bad_priorities in 0.1 seconds
===================================================================
START - test_priority_cooperative
Environment (please complete the following information):
- OS: (e.g. Linux, MacOS, Windows): ubuntu
- Toolchain (e.g Zephyr SDK, …): 0.14.1
- Commit SHA or Version used: f875d027a04374fcf07661809f81a42c2c646629
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- kernel: Init the base.slice_ticks for dummy_thread Fixes #46324 Set dummy_thread->base.slice_ticks to 0 when CONFIG_TIMESLICE_PER_THREAD is set. To avoid _current_cpu->slice_ticks be a big number. S... — committed to hunterhu3000/zephyr by hunterhu3000 2 years ago
- kernel: Init the base.slice_ticks for dummy_thread Fixes #46324 Set dummy_thread->base.slice_ticks to 0 when CONFIG_TIMESLICE_PER_THREAD is set. To avoid _current_cpu->slice_ticks be a big number. S... — committed to zephyrproject-rtos/zephyr by hunterhu3000 2 years ago
z_tick_sleep->z_add_thread_timeout->z_add_timeout->next_timeout->_current_cpu->slice_ticks
The _current_cpu->slice_ticks is not initialized in the test of test_priority_cooperative(). So the swap of the thread got problem. I’ll provide a PR to fix it.
The test failed due to the k_sleep hang. The call stack of the k_sleep is:
riscv_idle stuck at the do/while loop. It is waiting for an interrupt(function ite_intc_no_irq) which never come. @RuibinChang Could you please help to check? The function “riscv_idle” is in soc/riscv/riscv-ite/it8xxx2/soc.c. Thanks
OK, I’ll remove this test case on it8xxx2_evb. Thank you.
@RuibinChang can you investigate that why we can’t enable the CONFIG_TIMESLICE_PER_THREAD option on it8xxx2_evb?
@RuibinChang Sorry for late reply Twist and west are different. When using twister to do the test, it will test many different configurations, but for west, it conly contains 1 most common config. For example the test case of tests/kernel/sched/schedule_api, there are 8 test cases defined in tests/kernel/sched/schedule_api/testcase.yaml. There are 7 test cases suitable for it8xxx2_evb. Among these 7, only 1 is failed. I copy the failed test below
As you can see, this case defined two more macros, so if you want to test it in west you need to add these macros, like this:
If you think any of these macros does not fit for it8xxx2_evb, or we do not need to test these macros, we can skip this test for it8xxx2_evb.