From: Andrei Rusu de Castro <arc@empyreal.works>
To: Min Ma <mamin506@gmail.com>, Lizhi Hou <lizhi.hou@amd.com>
Cc: Oded Gabbay <ogabbay@kernel.org>,
"Mario Limonciello (AMD)" <superm1@kernel.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [BUG] accel/amdxdna: Phoenix NPU unusable after a TDR, and unbinding it then deadlocks on dev_lock
Date: Wed, 25 Nov 2026 01:40:49 +0000 [thread overview]
Message-ID: <20261125-amdxdna-tdr-dev-lock-report-3b8e51c2@empyreal.works> (raw)
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
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.
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
reply other threads:[~2026-11-25 1:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261125-amdxdna-tdr-dev-lock-report-3b8e51c2@empyreal.works \
--to=arc@empyreal.works \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=mamin506@gmail.com \
--cc=ogabbay@kernel.org \
--cc=superm1@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®