第八章 GPU Scheduler 分析:8.7 超时检测与 GPU 恢复(TDR)

发布时间:2026/11/1 1:35:03
第八章 GPU Scheduler 分析:8.7 超时检测与 GPU 恢复(TDR)

GPU 是独立于 CPU 运行的协处理器。一旦命令发射到硬件 ring,CPU 只能等待完成信号。如果 GPU 停止响应,硬件 fence 永远不会信号,调度链路永久阻塞。TDR(Timeout Detection and Recovery)是 scheduler 对此的系统性解决方案:检测超时 → 判定责任 → 恢复调度。


1. 全景

三阶段全景图如下:

┌──────────────────────────────┐ │ delayed_work: work_tdr │ ← drm_sched_init() 初始化 │ timeout: sched->timeout │ └──────────┬───────────────────┘ │ 超时到期 ▼ drm_sched_job_timedout() │ ▼ sched->ops->timedout_job(job) ← 驱动回调 │ ├── RESET: GPU reset + 恢复调度