From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.38 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796067463; b=AySdB7djnmqYDyv7n5af3rOqaZWKiM4rK8bsaC2sV/WgumzKNTqcj2GDEzZU5SuLKgnZ rhL25cu8jaRehqlzPBqloXIb0B2W3CGNIqC5JcaM6llCpxb6i9bzUMiGdrI+bP9k/iNre uskpXXjsSvsIcBBrzq9FDQNDtmttRxBM2h9WqfGU7nBE7IYp8jHFfRO/2y/o4d2AAC6vN klicP/tZUbRLIoIUmrSjZ1oLA0OEYGqU1lFraxTo4s4gGVKLAtPctV9qnytnDnpLP07DX /iJw3Qw5TAGUrQA6zN1by4jtUnnLZZhyJexI9IUwZt/NIkTlYWi58ffAk3VR6aj7cCA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796067463; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject: Content-Language:To:CC:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=U4zeagXSzHBskXJcfVjzL4w1MhMvQVrTHYxjUaz/d8w=; b=Xx+yxX8xRhVCRArbGJV1gaie5IuPQWQGKcQ+gCLLvgdmpIeIdwdct4MKoASFQ23W8qT7 5vyqNPHPHumBeq/r5aoW0JkUAk9LhbtpMs9ygN9Rw9OUKr8zWsAOUW7IEu1ZpOl32EzW6 V8HRwN4m3S6OfWTZAFkmeuY71TCEd2H+5zJS9rMNTOgO5w6mpXNtNc4IQN7DAxcuMzsA/ wf2UXxRypJaa+wCFO6l3wXP3xjgEbh5KIe5tJ4o+8SjrRF0+j4+AT9tMvbVWofNu9rJon mn9t32B9tnAR1CknKyMD2RmwBvtfyY6tRC5J1BSUdIOkdS6j4q1sKLcU2LxwfesjY6g== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=cjpnIbqC; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.38 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012038.outbound.protection.outlook.com [52.101.53.38]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D64C606A320 for ; Mon, 30 Nov 2026 19:37:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4D64C606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=cjpnIbqC ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pklxR+wNljC0HSNmFSva4DJ1iVRGXGhhbZgmWwWTlmmBA8TGUjxKPTcY/GDnhPc0u/rbReW918gqdz8nutRGTgsT72L6mMKLqnwN1xIY8jOC44wP5BnYChJSX1AFImt0iwxZh0dMc7rrmaC77yJGOGoiQdv0zSBjAlcntrMzW4ISckD7SFl+q2HHyLxH7Z3l2A4+/HfsePfUb55ek7tI5OtXph4C2ashWzIOcYzEO2bZviCU4fU7JCK9vHJunudfEEJly9o7VXrhQLaqt3gQudH6RBUDXdP2vMepWp5SJQpbLN30TZlYi61+VuK5cPcm4l5keQnt/+LDnes4NyXe4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U4zeagXSzHBskXJcfVjzL4w1MhMvQVrTHYxjUaz/d8w=; b=N9kgJQwo0Hwb0JVnaQ99QSSJmLegL1h8nOnWYZM3+v1Fee846tv9V8lzuhEsP4sB4HPaqZ7+QvzkJvV4rWLfcTj18H1zsIvnhliq9RsCSHdkYDfpQti3L7oa0zZmHYyNK9MYtsU1lQzbHcx2r1C+vfdLeIxQY6NygrZNWjXCFBBTR4kitwbCXa1ORAkc4KEmnpuDBC0X34MLbaTRu5VS1lQXTuYV3i/wCXPNPVNrjVd2z4hqSw5s5jGo7VHA2KwKsACSJrsgrqV/Mz/+j64FjW0jvzuEGaUEI2lZtK2h77qRE1dsm3OhK5wNsJIGVSpE/xsE8vRSVEjnG78uR3n2Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=empyreal.works smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U4zeagXSzHBskXJcfVjzL4w1MhMvQVrTHYxjUaz/d8w=; b=cjpnIbqCVBQpjPnhEaqxTCghn1HV/xMR2HvplRpE/Z9lT3Z+JQ26YrC1XYOBDBG54GePy2No2vY3LZN8s1NdnIK2buSrD/UR6xsNia3w42vPRfQeamAL/P+WpIWYBUUZsHhQt1xfqHCr4aJyxdK2FlNiwkSRn8HfRz6M+u8OFTg= Received: from DM6PR04CA0015.namprd04.prod.outlook.com (2603:10b6:5:334::20) by LV3PR12MB9411.namprd12.prod.outlook.com (2603:10b6:408:215::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 19:37:38 +0000 Received: from DS8PEPF000000E1.namprd05.prod.outlook.com (2603:10b6:5:334:cafe::65) by DM6PR04CA0015.outlook.office365.com (2603:10b6:5:334::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Mon, 30 Nov 2026 19:37:37 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS8PEPF000000E1.mail.protection.outlook.com (10.167.23.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Mon, 30 Nov 2026 19:37:36 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 13:37:36 -0600 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 13:37:36 -0600 Received: from [172.19.71.207] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 13:37:35 -0600 Message-ID: Date: Mon, 30 Nov 2026 11:37:35 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [BUG] accel/amdxdna: Phoenix NPU unusable after a TDR, and unbinding it then deadlocks on dev_lock Content-Language: en-US To: Andrei Rusu de Castro , Min Ma CC: Oded Gabbay , "Mario Limonciello (AMD)" , , References: <20261125-amdxdna-tdr-dev-lock-report-3b8e51c2@empyreal.works> From: Lizhi Hou In-Reply-To: <20261125-amdxdna-tdr-dev-lock-report-3b8e51c2@empyreal.works> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS8PEPF000000E1:EE_|LV3PR12MB9411:EE_ X-MS-Office365-Filtering-Correlation-Id: 09c6e12c-d13c-40c3-c017-08df4f196361 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|23010399003|36860700016|82310400026|376014|10067099003|56012099006|261026121527099003|261026140227099003|261028144727099003|261102123227099003|261021121427099003|261021123027099003|261022105027099003|261022075727099003|261009221727099003|261009220027099003|261009221227099003|261009223327099003|22082099003|18002099003|11063799006|5023799004|6133799003|261009223027099003; X-Microsoft-Antispam-Message-Info: IeOOnEce9ZsO3WfdcNV8PwGmTCCw9keXwRQd/vFBXVptvQBt8ruo6n7TVnq221mvHXn7duq0V2xWQbKDK7KCZVwrIuOkGtmtaJXs8TT52gXrQi5V5VzJV6GCGtI/KiXnL1KK06t7nUljrRTlfxoADm9iuz5PUOrh/cs20sWoTDiA/6SCsuXF/bETEmO0i3rAZOwteQLXw6BkYmdDJrIueDfO9ZnMFG3W0B6SZn1EP7vs4S3vsGrSsDsOPCCyzMHaKpr944KQOf+tlqfxsz1rmhHW4PkaG4nMXfOCCywB2+ziv8mSFHEC6xHqRQxzfeUFOOTbsT8c1Gxk7Zfvr13EaPW4QAiH68Ga8DMHDFjI4DffZugKXp6bDCRiDxufyXCSi+WzgO52FIJ2b4qVC8SVJ/+n/8Xc0ClmfVL65XYW0s4UTMfPvIaEXGEcLMyzUAYHKvUasNDDKo1rV4ntAeWLmxA1FAsgqc3HUoM+tOr5kvYv+0/pRBnLPAraIFQFmTdY+x1ZOVMfOWNvAmQDbdfeYmjOTOvSO+0+XXhZnQphGEL33lYsH3aUHuK/Z4Tt2gK0/v20i4eVPWrdcNGQihkiCjVRI5MDSUm2UJDkDN6a9m4+sm5/oWHACsF/PGHo2VxHIg/g1skUgf2cirjH85R1BiX8CjtRZHJH7QqNwPZ1Ee+1XQ2m9j4Y7oT+ylJZdTfxOdhIA9vOPqE/KiUGaXnqWA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(23010399003)(36860700016)(82310400026)(376014)(10067099003)(56012099006)(261026121527099003)(261026140227099003)(261028144727099003)(261102123227099003)(261021121427099003)(261021123027099003)(261022105027099003)(261022075727099003)(261009221727099003)(261009220027099003)(261009221227099003)(261009223327099003)(22082099003)(18002099003)(11063799006)(5023799004)(6133799003)(261009223027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SN7v4TpRIj/POe4uqi/3ui4LYtY6AILnt1iK7sxweL6wBIzmjVdQBwT7wVxN460i/rAzaxNEQdfSdWrxyMGX6dj+xcmhv52cd0vZ7Fs3PvbzfJhhO6XDsoJZts1e3lkaN7/+h3IC+JeobjSCjxj5rNTYBXem1DgT5kJ1OXJSB6dBdHtvxldfe+ElrEecW2MDCkHNI4/ffYW/28yXJPxyzkWsDEUzs0g/LTQ8s165vi867vDvFoDwl/Q8eIBILcr+gTHzdfp5YOep40IZ3qzUDt40vSWKZtYx49aSYRQ5QbTOB55C95CyENF+4VaBTlnlpWhHaONBjCuK5e64xtMfeC0qyBQRrXxXQz8f1IEOw2OJSUgXRd2Ebqra8iKwmt005lnEH7BrKxFZ2fHMdJb5CVlA3EEp2WpjG6j+7VzJm/GSKPYVsRDd7fHGcbqRriWt X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 19:37:36.9272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09c6e12c-d13c-40c3-c017-08df4f196361 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS8PEPF000000E1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9411 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? > > 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? If the driver does not handle the time out on Phoenix appropriately, it may cause the firmware hangs. In this case, nothing works. > > 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 >