Re: [BUG] accel/amdxdna: Phoenix NPU unusable after a TDR, and unbinding it then deadlocks on dev_lock
From: Lizhi Hou
Date: Mon Nov 30 2026 - 14:37:52 EST
On 11/24/26 17:40, Andrei Rusu de Castro wrote:
Hi,
On 7.4-rc3 with a Ryzen 7 PRO 7840U (Phoenix NPU, 1022:1502, firmware
1502_00/npu_7.sbin), one command that ran past the 2 s TDR left the NPU
unusable until reboot, and unbinding the driver afterwards deadlocked.
The command's shim DMA waited on a FIFO that never filled. At the
timeout:
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_tdr_detect: TDR timeout detected
amdxdna 0000:65:00.1: [drm] *ERROR* xdna_send_msg_wait: Wait for completion timeout
amdxdna 0000:65:00.1: [drm] aie2_destroy_context_req: Destroy context failed, ret -62
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_hwctx_restart: Create hwctx failed, ret -19
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_set_runtime_cfg: Failed to set runtime config, ret -19
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_runtime_cfg: Set type 1 value 1 failed
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_suspend_fw: Failed to suspend fw, ret -19
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_mgmt_fw_fini: Suspend_fw failed
amdxdna 0000:65:00.1: [drm] *ERROR* smu cmd 4 failed, 0xff
amdxdna 0000:65:00.1: [drm] *ERROR* Power off failed, ret -22
We tried to resolve the similar issue on Phoenix recently. The fixes were merged to drm-misc-next (Not in upstream linux yet).
Could you get the latest drm-misc-next and see if it works?
If the driver does not handle the time out on Phoenix appropriately, it may cause the firmware hangs. In this case, nothing works.
After that, every DRM_IOCTL_AMDXDNA_CREATE_HWCTX and GET_INFO fails in
the runtime resume:
amdxdna 0000:65:00.1: [drm] *ERROR* smu cmd 4 failed, 0xff
amdxdna 0000:65:00.1: [drm] *ERROR* Access power failed, ret -22
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_hw_start: failed to init smu, ret -22
amdxdna 0000:65:00.1: [drm] *ERROR* aie2_hw_resume: Start hardware failed, -22
amdxdna 0000:65:00.1: [drm] *ERROR* amdxdna_pm_resume_get: Resume failed: -22
From the code, the destroy-context timeout makes aie_send_mgmt_msg_wait()
destroy the management channel, so SUSPEND_FW and every later message
fail with -ENODEV, and aie2_hw_stop() asks the SMU to power off with the
firmware still running. The SMU answers 0xff, and since every resume
starts with that same power-off in aie_smu_init(), the device stays
dead until a reboot. Is a power-off with the firmware still running
expected to be refused, and is there an intended way back short of a
reboot?
Then "modprobe -r amdxdna" hung in D state (over 40 minutes) with:
amdxdna_pm_resume+0x20/0x80 [amdxdna]
__rpm_callback+0x9b/0x330
rpm_resume+0x49b/0x680
pm_runtime_forbid+0x49/0x60
aie2_fini+0x12/0x30 [amdxdna]
amdxdna_remove+0xc4/0xf0 [amdxdna]
pci_device_remove+0x45/0xb0
device_release_driver_internal+0x18c/0x2e0
driver_detach+0x8f/0xd0
bus_remove_driver+0x102/0x190
pci_unregister_driver+0x1e/0xa0
__se_sys_delete_module+0x294/0x450
pci_device_remove() tries to resume the device before .remove(), which
fails as above and leaves it suspended. amdxdna_remove() then takes
dev_lock and reaches pm_runtime_forbid() through aie2_fini() and
amdxdna_pm_fini(); forbid resumes the suspended device synchronously,
and amdxdna_pm_resume() blocks on the dev_lock its own task holds. The
resume callback has taken dev_lock since commit 1aa82181a3c2
("accel/amdxdna: Fix dead lock for suspend and resume"). Because the
task also holds the device lock, a reboot afterwards hung in
device_shutdown() and the machine needed a hard power-off.
Yes, the driver remove locking issue is real. We will fix it later.
Thanks,
Lizhi
The same lock order is in linux-next (20261120) and drm-misc-next,
where aie4_classic_fini() calls amdxdna_pm_fini() the same way. I
haven't tested whether commit 8e2afcd2b579 ("accel/amdxdna: Fix SMU
command execution on platforms without interrupt trigger") changes the
first part.
Thanks,
Andrei