rt-thread/components
GuEe-GUI 6fc3e18912 fix: stabilize smp_bind_affinity_tc on SMP CI
This change fixes intermittent failures of the `core.smp_bind_affinity`
utest across SMP CI targets. The original failure was a flaky assertion on
unbound threads (`thread_inc[x] != thread_tic[x]` in thread_entry), not
incorrect bind_cpu behavior. CI logs already showed T0 binding worked
(thread_inc[0] == thread_tic[0] == 100) while the not_equal check failed.
The root issue is that unbound-thread CPU placement is platform-dependent
and outside the bind_cpu contract. On dual-core RISC-V/ARMv7 CI, an
unbound thread may legitimately run all iterations on core 0 while T0
delays on the same core, so any assertion requiring cross-core migration
(thread_inc != thread_tic, or core_mask with multiple bits) remains flaky.
This patch narrows the test to what bind_affinity actually verifies: T0
bound to core 0 must always execute on core 0. Unbound threads only add
scheduling pressure; their core_mask is printed for observation but not
asserted.
Changes:
- Sample `rt_hw_cpu_id()` and update counters under `rt_sched_lock` to
  avoid migration skew between counting and CPU sampling.
- Track `thread_core_mask` for diagnostics; assert only T0 binding via
  `thread_inc[0] == thread_tic[0]` and `thread_core_mask[0] == 1`.
- Remove flaky unbound-thread assertions (`thread_inc != thread_tic` and
  multi-core core_mask checks).
- Move T0 assertions to the main test thread after all workers finish.
- Use atomic `finsh_flag`; reset counters and `threads[]` in `utest_tc_init`.
- Spin in worker loops after `run_num` until cleanup deletes them (do not
  return from thread_entry or use `RT_WAITING_FOREVER` with `rt_thread_delay`).
- Guard `rt_thread_delete` in cleanup with non-NULL checks.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2026-06-17 09:51:13 +08:00
..
dfs utest: move tmpfs testcases to components/dfs 2026-06-12 14:22:53 +08:00
drivers doc: add Doxygen comments to DMA driver subsystem #11477 2026-06-16 10:21:41 +08:00
fal Update fal_flash.c 2026-06-16 09:56:23 +08:00
finsh fix(finsh): reset line state on overflow 2026-05-07 18:18:08 +08:00
legacy [dm][virtio] support virtio dm 2026-06-15 10:00:57 +08:00
libc 为posix_signal.c文件中的signal函数进行注释 2026-05-26 14:01:02 +08:00
lwp fix: move tty_ptmx regression test to utest framework 2026-06-16 15:43:44 +08:00
mm utest: move mm testcases to components/mm 2026-06-12 14:22:53 +08:00
mprotect 实现MPU抽象层 (#8080) 2023-10-30 08:24:55 -04:00
net fix: V-001 security vulnerability 2026-05-25 10:15:11 +08:00
rust [rust] Tidy core defaults and migrate docs to README 2025-12-15 12:50:49 +08:00
utilities fix: stabilize smp_bind_affinity_tc on SMP CI 2026-06-17 09:51:13 +08:00
Kconfig Adding Rust Language Support for RT-Thread #10910 2025-12-08 18:34:25 +08:00
SConscript Adding Rust Language Support for RT-Thread #10910 2025-12-08 18:34:25 +08:00