perf_jit activated from a subinterpreter publishes JIT executors with the trampoline's unwind info
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- compilers, performance
调研方向
从 sys.activate_stack_trampoline()、perf_jit 选项以及 issue 中的 subinterpreter 复现开始;在设置 PYTHON_JIT=1 的 experimental-JIT Linux build 上运行,并检查生成的 /tmp/jit-.dump。跟踪 JIT executor 如何接收 unwind 信息,并在 executor frame 不再带有 8-byte perf trampoline 的 unwind data 时,认为该 issue 已解决。
由索引模型根据 Issue 内容生成。
描述
Bug report
Bug description:
sys.activate_stack_trampoline() refuses to run while the JIT is active, but it only checks the current interpreter, and the perf state is process-wide. A subinterpreter can activate perf_jit while the main interpreter keeps its JIT.
import sys
from concurrent import interpreters
interpreters.create().exec("import sys; sys.activate_stack_trampoline('perf_jit')")
def hot(n):
t = 0
for i in range(n):
t += i & 3
return t
for _ in range(50):
hot(100000)
With PYTHON_JIT=1 ./python buggy_stuff.py on a --enable-experimental-jit build, the resulting /tmp/jit-.dump holds the JIT's executors (records named py::jit:executor), and every one of them is tagged with the unwind information of the 8-byte perf trampoline. Executor frames look different, so perf produces wrong stacks for samples inside JIT code.
Found while working on https://github.com/python/cpython/pull/157246
CPython versions tested on:
CPython main branch, 3.16
Operating systems tested on:
Linux
Linked PRs
- gh-157258
- gh-157324
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 558
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/cpython 的其他 Issue
-
docs pending
难度 2/5 1-3 小时 新手友好度 78/100
-
stdlib type-feature
难度 2/5 1-3 小时 新手友好度 78/100
-
stdlib type-feature
难度 2/5 1-3 小时 新手友好度 72/100
-
build type-bug
难度 2/5 1-3 小时 新手友好度 76/100
-
stdlib topic-email type-feature
难度 2/5 1-3 小时 新手友好度 70/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 86/100
-
🐛 Bug 🔔 Pending processing
难度 2/5 1-3 小时 新手友好度 84/100
jumpserver/jumpserver#17584 ·