From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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.subspace.kernel.org (Postfix) with ESMTPS id 3F68D606A33B for ; Tue, 1 Dec 2026 07:33:13 +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=ECd0NQ7K Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A73E610E1FF; Tue, 1 Dec 2026 07:33:07 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8F2110E1FF for ; Tue, 1 Dec 2026 07:33:00 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5E7E862170; Tue, 1 Dec 2026 07:32:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B8E1F00919; Tue, 1 Dec 2026 07:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796110379; bh=Kxz6V64Nqg9lmvfRgl8odMYboZP55F4GxvHAT0e6tQI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ECd0NQ7KJO2QaIyxZ2HWghVnGO9Bbuhp93ixPba23oo47S8X7tsXpdyYD6npjscDs HmsrI1+d1PguekY3mGO0rR2oC6NZsFbUwZl6keTtau3UlIPB56qtbHUfmAsvZvC3Kc LFPzg9mKIEK8gJqGnECHCoaNeBR3IZ58btG/sU+EXVUtVSQ8Dx8mEHRWcQQ905IAQK vK8NW7jVe6ob3FEUUhrLoYswwM5HcJ017T1XFO6hm4vN4hJ3PjbRTaGME8GCtLO2V0 43jOZ5StnYNmEmf77mEEWsnSe26A8fK9IsEThSliJqde2m6Df9iu5afETlYEPROCpa m9BK1rdMIT5Ag== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] accel/rocket: Reset the core before detaching its IOMMU To: "Arun Iyengar" Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org In-Reply-To: <20261201-rocket-fixes-v1-2-986c3e5ceb44@gmail.com> References: <20261201-rocket-fixes-v1-0-986c3e5ceb44@gmail.com> <20261201-rocket-fixes-v1-2-986c3e5ceb44@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 07:32:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] accel/rocket: use-after-free and NULL pointer dereference in rocket_core_fini() [1] -- commit 3c0ae1c947c1bfa587406e1f23468f81ff1b2fca Author: Arun Iyengar accel/rocket: Reset the core before detaching its IOMMU This commit moves the rocket_core_reset() call in rocket_reset() ahead of iommu_detach_group() so that a hung NPU job does not block the IOMMU from entering stall mode during detach. Link: https://lore.kernel.org/r/20260613070116.438906-5-midgy971@gmail.com = [1] > diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/roc= ket_job.c > index 32926afb0144c..8bc0b80d9190b 100644 > --- a/drivers/accel/rocket/rocket_job.c > +++ b/drivers/accel/rocket/rocket_job.c > @@ -427,15 +427,17 @@ rocket_reset(struct rocket_core *core, struct drm_s= ched_job *bad) > */ > scoped_guard(mutex, &core->job_lock) { > put_job_ref =3D core->in_flight_job; > - > - iommu_detach_group(NULL, core->iommu_group); > - > core->in_flight_job =3D NULL; > } > =20 > - /* Proceed with reset now. */ > + /* > + * Reset before detaching: the IOMMU cannot stall while a hung job > + * keeps the bus busy, and then the detach fails. > + */ > rocket_core_reset(core); > =20 > + iommu_detach_group(NULL, core->iommu_group); > + > if (put_job_ref) > pm_runtime_put_autosuspend(core->dev); [Severity: Critical] This problem wasn't introduced by this patch, but can rocket_reset() hit a NULL pointer dereference in iommu_detach_group() and operate on disabled runtime PM during teardown [1]? In rocket_core_fini(), runtime PM is disabled and core->iommu_group is released and cleared before rocket_job_fini() stops the scheduler: drivers/accel/rocket/rocket_core.c:rocket_core_fini() { pm_runtime_dont_use_autosuspend(core->dev); pm_runtime_disable(core->dev); iommu_group_put(core->iommu_group); core->iommu_group =3D NULL; rocket_job_fini(core); } If an in-flight job times out before or during rocket_job_fini(), rocket_reset() passes a NULL core->iommu_group to iommu_detach_group() and calls pm_runtime_put_autosuspend() after runtime PM has been disabled. Calling rocket_job_fini() first in rocket_core_fini() would avoid this. [1] https://sashiko.dev/#/bug/linux-ef3ef432-292a-4ee1-addd-1b0440571e2d --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-rocket-fix= es-v1-0-986c3e5ceb44@gmail.com?part=3D2