]> git.ipfire.org Git - thirdparty/linux.git/commit
accel/amdxdna: Fix command timeout race
authorWendy Liang <wendy.liang@amd.com>
Sat, 18 Jul 2026 08:34:09 +0000 (01:34 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Mon, 20 Jul 2026 01:23:40 +0000 (18:23 -0700)
commit488f4902e1deba4d507b4b8c25547a366f5dac63
tree7ead3aea8c2d41cd8b7d812ca4169abb3212707f
parenta3fdf74ffa5966e5b4a17f1e9c5687f73bb0d536
accel/amdxdna: Fix command timeout race

When two commands enter aie2_sched_job_timedout() concurrently, both
check the timeout detection state. The first scheduler thread observes
tdr_status as SIGNALED and updates it to WAIT. The second thread then
observes the updated state instead of the original SIGNALED state, which
may cause the command timeout to be handled incorrectly.

Replace tdr_status with last_signal_ts, which records the timestamp of
the last driver signal. Timeout detection now only reads
last_signal_ts and never modifies it, allowing multiple serialized
detect() calls under dev_lock to evaluate the same signal timestamp
independently. If there is not any new job scheduled or completed
within tdr_timeout_ms, the command will timeout.

Fixes: 9022f010977f ("accel/amdxdna: Check for device hang on job timeout")
Signed-off-by: Wendy Liang <wendy.liang@amd.com>
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260718083409.1825940-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_ctx.c
drivers/accel/amdxdna/aie2_pci.c
drivers/accel/amdxdna/aie2_pci.h