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 0DB64606A322 for ; Sat, 5 Dec 2026 07:17:12 +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=EujPTedN Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B1FB10E08A; Sat, 5 Dec 2026 07:17:06 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CF7E10E08A for ; Sat, 5 Dec 2026 07:17:00 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id A92894373F; Sat, 5 Dec 2026 07:16:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7616C1F0092B; Sat, 5 Dec 2026 07:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796455019; bh=KDYHHUremVvPe0jswguBwoEB4oPFIf354UT5cn4l+eg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=EujPTedNPDgFKqQ+2+Gs1If58wdgmErkLLwcmTm8qpFEbDVfRD+dw3rskPsHABIXS or8ufXdR9Fjxnlq2C7hYP0MRY4mNW632rofVC5PzC3lrQ7V2/Tu7OvB3Ra4wdnrbP+ TvsqL4cploFhNjiDgwZcBGEFxRnD/nL+a5IX1YE1/FR970kloUuqPsHGoac4tngYv5 t9tn5b+LmqvlhUBPSATPyUMY+j0UuplIEMTtXGywICoMI7l5QC7zaqyR4MRntOBNlG /wEs2CsuD7sq9GazO8KCATbQWNoPhYEYZPAY8kD+BFvSvjz6CL0AtjAdkqTq4LdW5g IQUtWjvaLyiwA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 4/7] accel/rocket: Serialise core probe and removal To: "Arun Iyengar" Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org In-Reply-To: <20261205-rocket-fixes-v3-4-e5032fa408a3@gmail.com> References: <20261205-rocket-fixes-v3-0-e5032fa408a3@gmail.com> <20261205-rocket-fixes-v3-4-e5032fa408a3@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 07:16:57 +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=-11.1 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 1 potential issue to consider: - [Low] accel/rocket: data race on cores[].dev in find_core_for_dev() -- commit 6ee33960d02b264188a1fc48c67da8a831b94644 Author: Arun Iyengar accel/rocket: Serialise core probe and removal This commit allocates the first free core slot on probe, clears it on removal or probe failure, picks a bound core in rocket_open(), and serialises probe, removal, and open with rocket_cores_lock. Link: https://lore.kernel.org/all/20260922080114.44662-5-royalnet026@gmail.= com/ > diff --git a/drivers/accel/rocket/rocket_drv.c b/drivers/accel/rocket/roc= ket_drv.c > index e45b3c22b31e6..bf8d118b932e7 100644 > --- a/drivers/accel/rocket/rocket_drv.c > +++ b/drivers/accel/rocket/rocket_drv.c [ ... ] > @@ -246,12 +269,16 @@ static int find_core_for_dev(struct device *dev); > static void rocket_remove(struct platform_device *pdev) > { > struct device *dev =3D &pdev->dev; > - int core =3D find_core_for_dev(dev); > + int core; > + > + guard(mutex)(&rocket_cores_lock); > =20 > + core =3D find_core_for_dev(dev); > if (core < 0) > return; > =20 > rocket_core_fini(&rdev->cores[core]); > + rdev->cores[core].dev =3D NULL; [Severity: Low] Can clearing and reusing rdev->cores[core].dev here race with unlocked reads in find_core_for_dev()? rocket_device_runtime_suspend() and rocket_device_runtime_resume() call find_core_for_dev() without rocket_cores_lock, and cannot take it without deadlocking against rocket_probe() -> rocket_core_init() -> pm_runtime_resume_and_get(). When a lower-indexed core is unbound or rebound while a higher-indexed core suspends or resumes, the plain stores in rocket_remove() and rocket_probe() race with the plain loads in find_core_for_dev(): CPU0 CPU1 rocket_remove(core0) rocket_device_runtime_suspend(core1) guard(mutex)(&rocket_cores_lock) find_core_for_dev(core1) rdev->cores[0].dev =3D NULL; if (dev =3D=3D rdev->cores[0].dev) <-- data race This is an unmarked data race under the kernel memory model and will trigger KCSAN reports. Using READ_ONCE() and WRITE_ONCE() on rdev->cores[core].dev would avoid it. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-rocket-fix= es-v3-0-e5032fa408a3@gmail.com?part=3D4