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=40.107.200.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796149281; b=ilzmnXgoA+eIZey8kxn5/+m0Or9pg4OnwDeFMnsIaMGrIfnmIimul4lmcL2tVMTbZy/u vgQ1TQBs9fZchWKG6+1Q6M9K7GXTpABUiya7WHrrOWBdo8asZj/EiY+LvsQtfzj1HGzOz PwEiXeNJ2QxrwQrfWWRk80HkXvbbdHe64gQ/lgGLp+ou017bVyUO4TXjfUk513OnNECvQ 4T6s2e600By5uFKtW82IcO/3NaPRxERfjBmJakzhUkimC4jMaN9s0IunNftlmKdLOIDQW 868zSYEGAYVmlcTtxdnFKZ3snWtt+osGzP6eSMzpizV7kqcv6v2qaxS2UEKpH6l0KVA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796149281; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding:Content-Type: 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=xiD/nCLrluSAHAfAN5WTHvyHWAtsc8lWycZc3+eZpWA=; b=0cD3aE1tOcI2ZjxZkM93GX3Eip6wgKXfbtHrApPd3kwznIXn8YanNfm3EIpROxtOBEej z8Jj/QW54FvqXN4NJ1orohmHwYdAGu6W+zYo6kUo0/YLCf8Brsc/sxZWgjxHUf5bLaki+ k8XPBbjK+yytV4YnNZFX5/u3/FX/8MErL1T23AFulIS0bfDDx40HF08O4+Y8pxIpA+xDw nHLAv18M9A0nHx2606e5HzTFF/DS4CFRQoSjQQAfaGDovzeqN7csSsVz+wnhx4gaitFhf U/k146gbs9uGwJdaZqYgRTB3N0jLFLuaTWUMc8dEaVwJRX3+bO3GEndIGqQrWCMOy5g== 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=rAx4Dh1p; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.200.18 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012018.outbound.protection.outlook.com [40.107.200.18]) (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 95C47606A31A for ; Tue, 1 Dec 2026 18:21:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 95C47606A31A 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=rAx4Dh1p ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UkpyijoRYrEviFj7NasFQsnW6DF4DL+gkmqaZe/W+gfBCe+EqoXYkImdeh2TRwfXROH5mnyw3Dzt2AWRbZRH1cUMS5LNUnVN8Dw3ybribQhHBaMels+GpsIJNkgcMAmiPruoAteY74avKuSLhvcc8Rw2seGN7Ujb6X3G484qGYW89wLh5VTgK0LjDHiT2wC2hwP4f1G2j0fRMnFk1CWtnTpyMGLcWZ9st+k6OR2ayCc7oOKabOAj8b2EQqNMuvKo7UdFdTK2VCtvp1Spa+ZtTMSHj7KpKGh8o+d6OzimkCUrWRm8/AgbNwpWqgzbA0aBXaTGYM5ikXY7OwIWffREcw== 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=xiD/nCLrluSAHAfAN5WTHvyHWAtsc8lWycZc3+eZpWA=; b=kui1QY6jrYIpxhxlVcGUSPoFzm+HdWNERsOGPmtEu+gtfuV6RU4XOtdXiR0X5bFdKExliO0VkfsROY13PhIST2OxaTlMhVXqRy0mTY/vMGR5fgQ6urEo0r96QlIC8QILa3nnkaVYX9BueeaoNEncgrZPPFcNEC5vHSujE+KQfiBKWP2muXPwi3BHNafVfGL9T8jC36jSRfnWv3dLfs2iX4jY11TNRa6/PVOcw13V17QXHu/iWhXLzJ3SQOdyZ4aSjGDSBr/HwDV1HGetpiPpRW0bpI7oZILnppzgshNeKWmSTnismG1y6SMXQaPOp7jvtBo12DdI60+ccqBUT1ePAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=xiD/nCLrluSAHAfAN5WTHvyHWAtsc8lWycZc3+eZpWA=; b=rAx4Dh1pr0EjmQ0jEKzaBbfj+Z+FYM4L75IQ71jLTlrp3hZtVPVHaQ7yd+OagJlQ/2swuuTJ/FaP+etIHhYmYOH/yabIr8z1YzyyKbcYYPnvtidR3yvxv9Gcz6YkHxBAjEYZtujcBk4kjMW/MjC05LFrzYf+Q7kcIPv8fSNIwmc= Received: from PH8PR05CA0008.namprd05.prod.outlook.com (2603:10b6:510:2cc::19) by IA0PR12MB8863.namprd12.prod.outlook.com (2603:10b6:208:488::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Tue, 1 Dec 2026 18:21:13 +0000 Received: from MW3PEPF00001654.namprd21.prod.outlook.com (2603:10b6:510:2cc:cafe::2c) by PH8PR05CA0008.outlook.office365.com (2603:10b6:510:2cc::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Tue, 1 Dec 2026 18:21:13 +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=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by MW3PEPF00001654.mail.protection.outlook.com (10.167.249.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.639.0 via Frontend Transport; Tue, 1 Dec 2026 18:21:11 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 12:21:07 -0600 Received: from satlexmb07.amd.com (10.181.42.216) 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; Tue, 1 Dec 2026 12:21:06 -0600 Received: from xsjlizhih51.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Tue, 1 Dec 2026 12:21:06 -0600 From: Lizhi Hou To: , , , , , CC: Lizhi Hou , , Subject: [PATCH V1] accel/amdxdna: Use mmput_async() in the job run error path Date: Tue, 1 Dec 2026 10:20:59 -0800 Message-ID: <20261201182059.3046774-1-lizhi.hou@amd.com> X-Mailer: git-send-email 2.34.1 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PEPF00001654:EE_|IA0PR12MB8863:EE_ X-MS-Office365-Filtering-Correlation-Id: ae0b8726-e1ad-411a-6c37-08df4fd7e09d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700016|1800799024|23010399003|82310400026|10067099003|56012099006|5023799004|11063799006|261009223027099003|261102123227099003|261022105027099003|261022075727099003|261028144727099003|261026121527099003|261021123027099003|261021121427099003|261026140227099003|18002099003|6133799003; X-Microsoft-Antispam-Message-Info: zXHR/64SqyqXo+7dm3rXzB8SBOmJhDlRaTJPqKHZz6Ggz7rRgzgx+i2a+Hi3URonvdQOLcW60eeSVr71WIEov7DCG2zIjZfJocyne/wRoJlBXhVeLHF/3T2BjlaStjW8yvcfaAYEveHivQVXw53sY3oMxt5czBdkfaUBluchROPGafo8ikWUzykZOQFRau1I47LJzqGHCp9B6RAECusXpg21YiqGtTHifIzXldBFZDFscicsO7XpJjvOzm5bT1YNGgiBbXOOBN6JqYnKcoIjl3cmA8rbTD4uLsUiZJhd1+bJ6YdsI5oTWaJAsdQx21X+HujlmANUMfjYowdZVaOZdyvu5z0apcMbmNtU7beB1loRSM0P0MqzZ8f1kJRiB2c3NKxgXFYQa/N3oEDlExu4Bor6fwFgWrLqNeZCFzhac2jm4oyUCg5jfyTxNupIexHU/5mlZqvoPSG7jeyNwImynQtpRrO41N2LNqvJgJEZ6eHv4hH91l9f18YJ/VJMoNtIotdX0hYQYYFo6FpNzu3K79Q/d+m59nOj7yO04+z/ShhdAa6KAA5F0rhYgKIX2MImiaTuvKT7LQlGPBt1pieh8ZDjv+3KbJHjxHuGikDtuSgSw17Lc19BaBnuzrXy/of8SX5Fk7/EGmSi1WOEkthAfNnD4YEuU0wezNPdnIsUdGrjWfciIoE/u59T2/yCfGCL9aWdw1tbgodX5LoYwXh3fw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700016)(1800799024)(23010399003)(82310400026)(10067099003)(56012099006)(5023799004)(11063799006)(261009223027099003)(261102123227099003)(261022105027099003)(261022075727099003)(261028144727099003)(261026121527099003)(261021123027099003)(261021121427099003)(261026140227099003)(18002099003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UckbdtHes9cgxHsX7+elgzFFqqJShRquO00CfQm6FrTfeBCApFOS8n7R55bfSKU22kr0jS6LpDBr5gBFp89LFKDVERf5UTLpbFPs6RTw3O6n4RfAS5jABCBsXJ203lXM8p9d02vnAV3VyyAQhTe+Wxo4nlV+I2OqNDJN3jN8zK5kyMNYAjofnMU0ZrXkVZ3MNpGsBhQtaJBDAzEhFkwvlTsXZSM+9dQbhTq5Q8Swy6dplVE+hCl9WUXtwGldB5Ik1yxeCro1q0mzfEyhe7QPqwbwab8mormRHE6dEHrSCV0SB28arJyHfgl5y054zQrZpeB5B0Miru7urHBmGa7hqr4yiraL1rgpZp5+mVJujZWvOajzS4BMi7dTYgAUVMrnEGfof1Z8Rt8V3ySY3ls3MdqNeIIvQ8ebkSWhQ1kbeDWy/O3uMqdBt4TXT2Ys5w47 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 18:21:11.3408 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae0b8726-e1ad-411a-6c37-08df4fd7e09d 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=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MW3PEPF00001654.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8863 aie2_sched_job_run() runs from the DRM scheduler worker, not from the submitting process, and the job only holds an mmgrab() reference to the address space. If the process exits after the mmget_not_zero() at the top of the function, the mmput() in the error path drops the last mm_users reference and calls __mmput() -> exit_mmap() -> mmu_notifier_release(), which invokes amdxdna_hmm_invalidate(). That handler waits with MAX_SCHEDULE_TIMEOUT for the fences of the BO. The fence attached to the BO reservation object is the finished fence of this very job, which the scheduler only signals once run_job() has returned. The scheduler worker therefore blocks forever waiting for a fence that only it can cause to be signalled, and stalls every other context sharing the scheduler work queue. Use mmput_async() so that the address space teardown is deferred and run_job() can return. Calling mmput_async() after aie2_job_put() is safe today because the submit reference is still held until aie2_sched_job_free(). Swapping the two lines makes it easier to read. Fixes: aac243092b70 ("accel/amdxdna: Add command execution") Signed-off-by: Lizhi Hou --- drivers/accel/amdxdna/aie2_ctx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index 582e171b5fd7..0a6be8ba8e3c 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -453,8 +453,8 @@ aie2_sched_job_run(struct drm_sched_job *sched_job) if (ret) { amdxdna_io_stats_job_done(job->hwctx->client); dma_fence_put(job->fence); + mmput_async(job->mm); aie2_job_put(job); - mmput(job->mm); fence = ERR_PTR(ret); } else { /* -- 2.34.1