Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
description of repo status
Open Source
>
Other
>
Operation System
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
458
Star
1.7K
Fork
1.9K
GVP
openEuler
/
kernel
Closed
Code
Issues
1271
Pull Requests
991
Wiki
Insights
Pipelines
Service
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
padata: Reset next CPU when reorder sequence wraps around
Done
#ID3Y90
内核缺陷
Tao W
Opened this issue
2025-10-29 10:38
seq_nr 回绕逻辑:当 seq_nr 溢出回绕到 0 时,padata_do_serial() 会将 seq=0 的任务哈希到 第一个 CPU(cpumask 中的首个 CPU)的重组队列; 重组阶段 CPU 选择逻辑:重组函数 padata_reorder() 中,pd->cpu(下一个要处理的 CPU)通过 cpumask_next_wrap() 循环遍历 cpumask,未处理 pd->processed(已重组的任务数)回绕场景。pd->processed 是无符号整数,当它溢出回绕到 0 时(表示一轮重组完成、开始新轮次),pd->cpu 仍保持上一轮的最后一个 CPU 值,未重置为第一个 CPU。 死锁触发路径:当 pd->processed 回绕后,若使用的 CPU 数量 非 2 的幂(cpumask_next_wrap() 循环步长与哈希逻辑不兼容),padata_reorder() 会继续从错误的 CPU 开始遍历,导致无法找到 seq=0 对应的重组队列(该队列在第一个 CPU 上)。最终任务堆积在队列中,重组流程卡住,引发死锁。 修复:当 pd->processed 回绕到 0 时(新轮次重组开始),强制将 pd->cpu 重置为 cpumask 中的第一个 CPU,与 seq_nr=0 对应的哈希目标 CPU 保持一致,避免查询错误队列导致的死锁。
seq_nr 回绕逻辑:当 seq_nr 溢出回绕到 0 时,padata_do_serial() 会将 seq=0 的任务哈希到 第一个 CPU(cpumask 中的首个 CPU)的重组队列; 重组阶段 CPU 选择逻辑:重组函数 padata_reorder() 中,pd->cpu(下一个要处理的 CPU)通过 cpumask_next_wrap() 循环遍历 cpumask,未处理 pd->processed(已重组的任务数)回绕场景。pd->processed 是无符号整数,当它溢出回绕到 0 时(表示一轮重组完成、开始新轮次),pd->cpu 仍保持上一轮的最后一个 CPU 值,未重置为第一个 CPU。 死锁触发路径:当 pd->processed 回绕后,若使用的 CPU 数量 非 2 的幂(cpumask_next_wrap() 循环步长与哈希逻辑不兼容),padata_reorder() 会继续从错误的 CPU 开始遍历,导致无法找到 seq=0 对应的重组队列(该队列在第一个 CPU 上)。最终任务堆积在队列中,重组流程卡住,引发死锁。 修复:当 pd->processed 回绕到 0 时(新轮次重组开始),强制将 pd->cpu 重置为 cpumask 中的第一个 CPU,与 seq_nr=0 对应的哈希目标 CPU 保持一致,避免查询错误队列导致的死锁。
Comments (
3
)
Sign in
to comment
Status
Done
Backlog
已挂起
Doing
Declined
Done
Assignees
Not set
CTC-Xibo.Wang
CTC-XiboWang
Assignee
Collaborator
+Assign
+Mention
Labels
sig/Kernel
Not set
Projects
Unprojected
Unprojected
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(2)
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register