-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[docs][utest]: Add comment description for SMP Threads Auto Assign to Idle Cores Test #10965
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
Conversation
Add comments for smp_affinity_pri1 Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
Add comments for smp_affinity_pri2 Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: kernelReviewers: GorrayLi ReviewSun hamburger-os lianux-mm wdfk-prog xu18838022837 Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-11-25 10:02 CST)
📝 Review Instructions
|
|
@Rbb666 麻烦review一下呢🌹 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds detailed comment descriptions for three SMP (Symmetric Multi-Processing) test cases in the RT-Thread utest framework. The additions follow a consistent documentation template that includes test objectives, scenarios, verification metrics, dependencies, and expected results.
Key Changes:
- Enhanced documentation for
smp_bind_affinity_tc.ctest covering thread core affinity binding - Enhanced documentation for
smp_affinity_pri1_tc.ctest covering low-priority thread behavior with bound cores - Enhanced documentation for
smp_affinity_pri2_tc.ctest covering priority-based thread preemption scenarios
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/utest/smp/smp_bind_affinity_tc.c | Added structured test documentation describing thread core binding verification test with detailed scenarios and expected results |
| src/utest/smp/smp_affinity_pri1_tc.c | Added structured test documentation describing low-priority bound thread behavior and high-priority unbound thread preemption scenarios |
| src/utest/smp/smp_affinity_pri2_tc.c | Added structured test documentation describing medium-priority unbound thread behavior with low-priority bound thread creation scenarios |
src/utest/smp/smp_affinity_pri2_tc.c
Outdated
| * - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with each thread bound to its respective core. Among them, | ||
| * - the thread on core 0 has a medium priority (THIGH_PRIORITY), while the other threads have the highest priority (THREAD_PRIORITY). |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Documentation/文档]: Inconsistent description of T0 binding / T0 绑定状态描述不一致
English: Line 17 in the original @note states "thread 0 is not bound to core 0", but the new documentation at line 28 states "with each thread bound to its respective core". Examining the code (lines 108-114), T0 is created but is NOT explicitly bound to any core - there's no RT_THREAD_CTRL_BIND_CPU call for T0. Only threads T1~T(RT_CPUS_NR-1) are bound to their respective cores (lines 117-127). The new documentation is incorrect.
中文: 原始 @note 的第 17 行说明"thread 0 is not bound to core 0"(线程 0 未绑定到核心 0),但新文档第 28 行声称"with each thread bound to its respective core"(每个线程都绑定到各自的核心)。检查代码(第 108-114 行),T0 被创建但并未显式绑定到任何核心 - 没有对 T0 调用 RT_THREAD_CTRL_BIND_CPU。只有线程 T1~T(RT_CPUS_NR-1) 被绑定到各自的核心(第 117-127 行)。新文档不正确。
Suggested Fix / 建议修复:
* Test Scenarios:
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created. T0 is unbound with medium priority (THIGH_PRIORITY),
* - while threads T1~T(RT_CPUS_NR-1) are each bound to their respective cores with the highest priority (THREAD_PRIORITY).| * - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with each thread bound to its respective core. Among them, | |
| * - the thread on core 0 has a medium priority (THIGH_PRIORITY), while the other threads have the highest priority (THREAD_PRIORITY). | |
| * - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created. T0 is unbound with medium priority (THIGH_PRIORITY), | |
| * - while threads T1~T(RT_CPUS_NR-1) are each bound to their respective cores with the highest priority (THREAD_PRIORITY). |
src/utest/smp/smp_bind_affinity_tc.c
Outdated
| * - If thread_inc[x] is equal to thread_tic[x], it indicates that thread Tx is correctly bound to core x. | ||
| * | ||
| * Verification Metrics: | ||
| * - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_bind_affinity) |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Spelling/拼写]: Extra spacing in output message format / 输出消息格式中存在多余空格
English: Line 33 shows extra spaces in the output message format: [ PASSED ] and [ result ]. This should match the standard utest output format which uses single spaces.
中文: 第 33 行显示的输出消息格式中存在多余空格:[ PASSED ] 和 [ result ]。这应该与使用单个空格的标准 utest 输出格式保持一致。
Suggested Fix / 建议修复:
* - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_bind_affinity)| * - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_bind_affinity) | |
| * - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_bind_affinity) |
src/utest/smp/smp_bind_affinity_tc.c
Outdated
| * - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with only T0 bound to core 0. When thread Tx is running, | ||
| * - thread_tic[x] increments by 1; if x is equal to the core ID, thread_inc[x] also increments by 1. After the | ||
| * - program runs for a period of time, observe the value relationship between the thread_inc and thread_tic arrays. | ||
| * - If thread_inc[x] is equal to thread_tic[x], it indicates that thread Tx is correctly bound to core x. |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Documentation/文档]: Inaccurate test scenario description / 测试场景描述不准确
English: The description in lines 27-30 states "If thread_inc[x] is equal to thread_tic[x], it indicates that thread Tx is correctly bound to core x." However, examining the code (lines 70-73), only T0 is bound to core 0. Other threads (T1 to T(RT_CPUS_NR-1)) are NOT bound to any core. The assertion at line 73 verifies thread_inc[para] != thread_tic[para] for threads other than T0, which means they should NOT always run on their corresponding core numbers.
中文: 第 27-30 行的描述声称"如果 thread_inc[x] 等于 thread_tic[x],则表明线程 Tx 正确绑定到核心 x"。然而,检查代码(第 70-73 行)可知,只有 T0 绑定到核心 0。其他线程(T1 到 T(RT_CPUS_NR-1))并未绑定到任何核心。第 73 行的断言验证了对于非 T0 线程 thread_inc[para] != thread_tic[para],这意味着它们不应该总是在其对应的核心编号上运行。
Suggested Fix / 建议修复:
The description should be corrected to clarify that only T0 is bound to core 0, and other threads are unbound and will migrate across cores:
* Test Scenarios:
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with only T0 bound to core 0. When thread Tx is running,
* - thread_tic[x] increments by 1; if x is equal to the core ID, thread_inc[x] also increments by 1. After the
* - program runs for a period of time, observe the value relationship between the thread_inc and thread_tic arrays.
* - If thread_inc[0] equals thread_tic[0], it indicates T0 is correctly bound to core 0. For other threads (T1~T(RT_CPUS_NR-1)),
* - thread_inc[x] will NOT equal thread_tic[x] as they are unbound and will migrate across different cores.| * - If thread_inc[x] is equal to thread_tic[x], it indicates that thread Tx is correctly bound to core x. | |
| * - If thread_inc[0] equals thread_tic[0], it indicates T0 is correctly bound to core 0. For other threads (T1~T(RT_CPUS_NR-1)), | |
| * thread_inc[x] will NOT equal thread_tic[x] as they are unbound and will migrate across different cores. |
src/utest/smp/smp_affinity_pri2_tc.c
Outdated
| * Test Case Name: [smp_affinity_pri2] | ||
| * | ||
| * Test Objectives: | ||
| * - Verify that threads with low-priority unbound cores do not preempt high-priority threads. |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Documentation/文档]: Incorrect test objective description / 测试目标描述错误
English: Line 25 states "Verify that threads with low-priority unbound cores do not preempt high-priority threads." However, examining the code (line 82), thread Tn is bound to core 0 using rt_thread_control(temp_thread, RT_THREAD_CTRL_BIND_CPU, (void *)0). The thread Tn is NOT unbound. The test verifies that a low-priority thread bound to the same core does not preempt a higher-priority thread on that core.
中文: 第 25 行声称"验证低优先级未绑定核心的线程不会抢占高优先级线程"。然而,检查代码(第 82 行)可知,线程 Tn 通过 rt_thread_control(temp_thread, RT_THREAD_CTRL_BIND_CPU, (void *)0) 被绑定到核心 0。线程 Tn 并非未绑定。该测试验证的是绑定到同一核心的低优先级线程不会抢占该核心上的高优先级线程。
Suggested Fix / 建议修复:
* Test Objectives:
* - Verify that a low-priority thread bound to a core does not preempt a higher-priority thread running on the same core.| * - Verify that threads with low-priority unbound cores do not preempt high-priority threads. | |
| * - Verify that a low-priority thread bound to a core does not preempt a higher-priority thread running on the same core. |
Add comments for smp_bind_affinity, And fixed some comment issues in smp_affinity_pri2_tc. Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
566995f to
6bb7094
Compare
|
已修改 |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
Add comment description for SMP Threads Auto Assign to Idle Cores Test
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up