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=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796366105; b=saG60bPMd77EXUFqJehZsJaH+3oohpZ6PFoNJk7gldMkvjKucQo5hqJH0vuvXNEbAhp3 UGZPXuDSFz2rQgPrUn+iaSYwtgpWZz6yjm+QMlpS1ryUaXpaHfYuCYrDcPYbPLz5l/iES QCxrGwI7Gj4M7j0/rmIJnuFQ2WOmnGKj8tgh/lw14LNT7EYdq89pv9mNtuPPEyJROvnO7 saslOTin/iAdmNwjhZrRtHqIOmVdjsP5kKqJStpP3uoe15fIwFk1bm2nl+gMWEcJL/ELY nFeKTDXa/Ay/rcOjaav+kk6BB/K6nPUe69QuKS0fpm3dz6hHIvZK2ctF2c6TSpQYLWg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796366105; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=lEKlpyRi93W7+J15IIzkC8WqZTFvAAQXY5Pi7aVVE7M=; b=VFVbE4KPethCL+dVPHIxleOHbAgk2///Z6ZoZ3MukVKxEEmPKCe3zzKZwiojwMLSGKYm XNNOlQTooe4s9g7u0gfq3P477YUZTrZQJGApX1w9UwHeOX4dpgZlPzHDAB+R6jkHgvntP ofex57yu/TnSTwq4gTrhDAxZckPWmnDT3CyBKzxG2U95zjLcguOcUG/Sh1AxdDvjMJTmO xHMQD2oJs872EzxyC8bBedeXIsneaxozjE4ro9FiKJn/aCknlHPJF39g2c1QAcYMSUnnA QU1ySypDBhO7Q0Hu94CjqZJ1QJvkzLPs4e2zUXf6zNLvodQNh5ARtyJC+862vmxAmWw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Axsplwhb; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5118606A32C; Fri, 4 Dec 2026 06:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Axsplwhb Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796366105; b=ipBu9iKyQpK8hYWL9ISeSZBwPb246FWSl8rqOvbkpc/A4Ql/lG0jvQWzzE9+RkHrFTUg WGV6jRRHg6roBA0Mj3K3dVRd6PB0VcdmMjw0WC0YC7mvP6l3sxsOtg3CdcYSo+DSvYE1Y dAuLY3Q2fp5xE29ZApAcPEaMrEwMPw5lXwzR8A0OOuLXqh87v0NKipLDLye51Cv1F3IuI YXhoEjNkF9ZqF5NZMqWYni1CC9glUQ8PxqfBBx0B5ecZ0TBUco5kd2iNj6gd4+wJkfTKy zNeQeaSdCdcUA3pGZsp9i8eW3ZYc+pLPvTjv9iOEzgifGe/TsKJfjQrmAUWVEqmWRmw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796366105; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=lEKlpyRi93W7+J15IIzkC8WqZTFvAAQXY5Pi7aVVE7M=; b=EVlMD3Fid+KpYok38v5EqGRoALIRKtCGLKK5c+g+gaIE+9LfGI+OF8d9+EeGnuS1ELA3 SKxbwzns3TDo/8y0TDmTen4Sr3psa5Y5YR/gZ7aUpsxC6BKQO3FuQlsQ1CuU1UMOL0rMI uLWR6eyqnhmmjvVX4hBbqgDTxBSGRGyJs7BWJmIwtJVIkXGr2dc8EVysNgep4nf11RkSf qjBQ4fq/TgGUXlDzICU4pHJxeVOHK2JBZzRako9kRfTAH+1hZ1U+MWwwRP5cPr7GSehyt g8jR3sQ1UpViyBPbWYzTLIt++dJM2F722UN2EbE4JIOQyZAnNRPGNQcVNgEyo6+ZX3w== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id E63361F000CE; Fri, 4 Dec 2026 06:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796366105; bh=lEKlpyRi93W7+J15IIzkC8WqZTFvAAQXY5Pi7aVVE7M=; h=From:Subject:Date:To:Cc:Reply-To; b=Axsplwhb3Q1srtDJ/Qt3QmR0YvgTpJWkEfYpBLenKqnT2K33XWX6LtEoaYSSurXgz PDEK0cTd3xaTMQe8UK34b7U9mbP4EhXr0bCnHNIbUf36t+y0p35QPMLUyis3slDoKV RhtShW8Ge79x8fqKDaoh22D3jC3y82dp3vk11zpfFAMTEMK9WOVY4AElOQYyEjOsWg +uTzxlOum0A6qwBJRETQpzT+fVE8iGv5cwwwhGYmIYrRGa8IuTKaljqwiEgxIsiFGv HzWCLi9UN4aGEqqHwDQde8l6ZxVTSL92/nZMQ9F37H8O7MybENk6AWw4MhTwEl30QX 7LaZhqnDwvDfw== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 76C7B4D95D; Fri, 4 Dec 2026 06:35:04 +0000 (UTC) From: Arun Iyengar via B4 Relay Subject: [PATCH v2 0/4] accel/rocket: Fix teardown with a job on the NPU Date: Fri, 04 Dec 2026 06:35:03 +0000 Message-Id: <20261204-rocket-fixes-v2-0-e9f9bb6f1304@gmail.com> X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/1WNzQ6CMBCEX4Xs2Zr+SdCT72E4wLrCqlDTVqIhv LstnDx+mZlvZgjkmQKcihk8TRzYjQn0rgDsm7EjwdfEoKUulTJSeIcPiuLGHwqClDUVNtq0RJA mL09rkBaXeuPwbu+EMTtyo+cQnf+uf5PKvU2tpfpXT0pIcaxKNHRAaq09d0PDzz26AeplWX5aS iDFugAAAA== X-Change-ID: 20261130-rocket-fixes-e1438ca23bee To: Tomeu Vizoso , Oded Gabbay Cc: Heiko Stuebner , Jeff Hugo , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Philipp Stanner , Midgy BALON , Jiaxing Hu , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, stable@vger.kernel.org, Arun Iyengar X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796366104; l=2564; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=mkA6pecDk6VclhQ2YAXyK4UorcCeYT1uusqsNCPmszY=; b=cEpF3ZNU5efjugV2xCP9vuuLgzkjgxm/ZdC2FBd/+MKx15pGdc0FUMUDrRhAAdZLoxqRi22OY t3loX4APmQWDM+5jkoDTuv/0Tn1ws+ShrAEog0qXxCbbFzWo4cYY9dz X-Developer-Key: i=aiyengar1990@gmail.com; a=ed25519; pk=zXpRgUTrhaFe6jLyPqbBy3ccfkj04w0g2690Wv3mg+0= X-Endpoint-Received: by B4 Relay for aiyengar1990@gmail.com/20261110 with auth_id=1480 X-Original-From: Arun Iyengar Reply-To: aiyengar1990@gmail.com Four fixes for teardown with a job on the NPU: at file close, in the timeout reset and at core unbind. 1: wait for the file's jobs before its BOs are released. 2: reset the core before detaching its IOMMU (same change as Midgy Balon's RK3568 RFC, linked in the patch). 3: stop the scheduler before releasing the IOMMU group. 4: reset the core at unbind, which also cancels the job on the NPU. Tested on an Orange Pi 5 (RK3588), 7.3, KASAN. Patches 1-2: 70 SIGKILLs during inference, no job timeout (before: 12 in 10 kills); 10 faulting jobs, no IOMMU stall timeout or warning (before: 75 and 10), also with the next-20261127 rockchip-iommu.c. Patch 3: core unbound while its timeout handler ran (forced by a test delay): no oops, core rebound, inference unchanged (before: NULL dereference in iommu_detach_group()). Patch 4: core unbound with a job running (5 runs), with a hung job (5) and idle (3): no oops, file close returns, core rebound, inference unchanged (before: file close hangs on a hung job; the NULL detach from the interrupt handler follows from the code, I could not trigger it). Not fixed: a file that stays open across a core unbind keeps a scheduler entity on the torn-down scheduler (freed run queue, queued jobs never run). That needs the entity lifetime reworked. Developed with Claude (Anthropic), which wrote the code and the commit messages. Signed-off-by: Arun Iyengar --- Changes in v2: - New patch 3: stop the scheduler before releasing the IOMMU group (Sashiko). - New patch 4: reset the core at unbind. - Patch 1: drop a comment that repeated the commit message. - Patch 2 unchanged. - Link to v1: https://patch.msgid.link/20261201-rocket-fixes-v1-0-986c3e5ceb44@gmail.com --- Arun Iyengar (4): accel/rocket: Wait for in-flight jobs before releasing the file's BOs accel/rocket: Reset the core before detaching its IOMMU accel/rocket: Stop the scheduler before releasing the IOMMU group accel/rocket: Reset the core at unbind drivers/accel/rocket/rocket_core.c | 2 +- drivers/accel/rocket/rocket_core.h | 2 ++ drivers/accel/rocket/rocket_drv.c | 24 ++++++++++++++++++++++-- drivers/accel/rocket/rocket_drv.h | 2 ++ drivers/accel/rocket/rocket_job.c | 37 +++++++++++++++++++++++++++++++------ 5 files changed, 58 insertions(+), 9 deletions(-) --- base-commit: 502ea48d0d8fa5dd0c31dc449efb3d82deef8efe change-id: 20261130-rocket-fixes-e1438ca23bee Best regards, -- Arun Iyengar