pm: pm_idle() ignores a positive non-zero prepare() veto
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
调研方向
The bug is in the three ret < 0 checks in drivers/power/pm/pm_idle.c, one in the non-SMP path and two in the SMP path. Read pm_changestate.c to confirm that it reverts the domain and returns any non-zero prepare value, and check the prepare contract in include/nuttx/power/pm.h. Build the host reproducer from the issue's src/ and shim/ and run it. Done means that a +1 veto leaves the idle handler at PM_NORMAL, the SMP and system-domain fallbacks are unchanged, and the reproducer prints VETO_HONORED.
由索引模型根据 Issue 内容生成。
描述
Mechanism. The prepare() contract aborts a transition on any non-zero return, and pm_changestate() reverts the domain state and returns that value. The non-SMP pm_idle() tests only ret < 0, so a +1 veto is swallowed: the domain reverts to PM_NORMAL while the idle handler still receives the refused PM_SLEEP.
Location. drivers/power/pm/pm_idle.c:160,187,243 (three ret < 0 sites: non-SMP plus two SMP); drivers/power/pm/pm_changestate.c; include/nuttx/power/pm.h (non-zero means abort). Affected NuttX 13.1.0 (commit 2b5c0de5), confirmed by source inspection; measured on a hosted harness with the real pm_changestate.c, not sim:nsh.
Trigger. pm_checkstate() selects PM_SLEEP, a registered driver's prepare() returns +1, and pm_changestate() returns +1. Only the non-SMP branch is exercised; the SMP sites were checked by source inspection only, not run.
Expected. Any non-zero pm_changestate() return vetoes the transition, so the idle handler receives the reverted state (PM_NORMAL), not PM_SLEEP.
Evidence. Measured: before domain_state=0, idle_handler_state=3 (VETO_SWALLOWED); after idle_handler_state=0 (VETO_HONORED).
Patch. Change the three checks to ret != OK, keeping fallbacks (oldstate for the SMP CPU branch, PM_NORMAL for system and non-SMP), consistent with upstream 46d555e (identified by source inspection).
- 主要语言
- C
- 星标
- 4.1k
- 派生
- 1.8k
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 852
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/nuttx 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 60/100
维护者通常 1 天内回复
-
Arch: all Arch: arm Area: Build system OS: Linux Type: Bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Arch: all OS: Linux Type: Bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
new issue
难度 2/5 1-3 小时 新手友好度 62/100
llvm/llvm-project#245835 ·
维护者通常 1 天内回复
-
needs-triage
难度 1/5 1 小时以内 新手友好度 72/100
InauguralSystems/EigenScript#2537 · 1 条评论 ·
维护者通常 1 天内回复
-
Fix a typo in H5Centry.c可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
taosdata/TDengine#35812 · 1 个 reaction ·
维护者通常 1 天内回复