-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
The test_coop_resched_threads
test in kernel.multiprocessing.smp fails on 12-core systems for two reasons:
Priority Range Violation
The test uses K_PRIO_COOP(10) as the starting priority, which evaluates to -6. With the default CONFIG_NUM_COOP_PRIORITIES=16
, the allowed range: 14 to -16.
The spawn_threads function decrements the priority for each thread created, resulting in priorities -7, -8, -9, ..., -17 for 12 threads. The thread receives priority -17, which exceeds the valid range and triggers an invalid priority assertion.
Insufficient Timing
The test uses a fixed DELAY_US busy wait period to allow threads to execute before checking results. On 12-core systems, this delay is insufficient for all threads to complete execution, causing false failures such as "Comp cooperative thread 4 didn't run."
Regression
- This is a regression.
Steps to reproduce
west build -p -b nsim/nsim_hs5x/smp/12cores tests/kernel/smp -T kernel.multiprocessing.smp -t run
Relevant log output
===================================================================
START - test_coop_resched_threads
ASSERTION FAIL [((((prio)) == 15 && z_is_idle_thread_entry((entry))) || (((15 - 1) >= ((-16))) && ((prio)) >= ((-16)) && ((prio)) <= (15 - 1)))] @ WEST_TOPDIR/zephyr/kernel/thread.c:581
invalid priority (-17); allowed range: 14 to -16
E: r0: 0x4 r1: 0x245 r2: 0x1 r3: 0x8000a5a4
E: r4: 0x0 r5: 0x0 r6: 0x0 r7: 0x1
E: r8: 0xffffffff r9: 0x0 r10: 0x1f r11: 0x0
E: r12: 0xa r13: 0x80 pc: 0x8000144e
E: blink: 0x80006aca status32: 0x80082802
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Current thread: 0x8000bd18 (test_coop_resched_threads)
wrong error reason
===================================================================
Impact
Annoyance – Minor irritation; no significant impact on usability or functionality.
Environment
OS: Linux
Toolchain (e.g Zephyr SDK, ...): arcmwdt
Commit SHA or Version used: Main 1c15986
Additional Context
No response