Claude review: accel/amdxdna: Check for device hang on job timeout

Claude Code Review Bot
2026-04-12T00:41:19Z

Overall Series Review

Subject: accel/amdxdna: Check for device hang on job timeout
Author: Lizhi Hou <lizhi.hou@amd.com>
Patches: 2
Reviewed: 2026-04-12T10:41:19.407531

---

This is a single patch that adds Timeout Detection and Recovery (TDR) forward-progress checking to the amdxdna accelerator driver. The core idea is sound: instead of treating every scheduler timeout as a device hang, the driver checks whether the device has made forward progress (submitted or completed any job) since the last timeout check. If it has, the timeout handler returns `DRM_GPU_SCHED_STAT_NO_HANG` rather than resetting the context.

However, the implementation has several significant issues that should be addressed before merging:

1. **Global-level tracking for per-context schedulers** — the `tdr_status` field lives on the global `amdxdna_dev_hdl`, but each hardware context has its own `drm_gpu_scheduler`. A job completing in context A will prevent context B from ever detecting a hang.
2. **Module parameter type mismatch** — declared `uint` but registered as `int`.
3. **Non-static global variable** pollutes the module namespace.
4. **Missing initialization** of `tdr_status`.
5. **The timeout change from 60s to 2s is smuggled into this patch** with minimal justification.

---
Generated by Claude Code Patch Reviewer