From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796291151; b=EP/9vxVNuQ8SmbjCxD0SJqGQU2gpZyJNWY5nFmFY9+wdIZQr1rg8zLcgYzJbV97gV3+7 QhPTNJNJ93pwdkWX1+1WGymcCxdlzXqt/46uzv6bALOFhKPgkVUVOzG9q8KKyNL+1yoUd i5Z7CR8d0J1gbK441OnzPUCC5B1UJxmhwi77H61tQSrdyLCALfwY8rERVBJsgOi81+WM9 AF4BwcIw2o6tMI5Mbm6QoOjks3SZjIObzsFmAJUIAlOr7fQt6hexg/yLdTFTJMlcd7QS3 RzVba3mRlJvGtfTl3UGT00lOFtuN5B0C8GkXLyNfBSQvstTA/Jt/5hgEtUtehDHLVbQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796291151; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=0Ck7oM+lUo7pQVv8D3ovHf3hraFUknpm4Zflp4lIVkc=; b=v9jFmtcbDyIUbXKkPX9bN+GJ7hpOKnlDrhFpIr7sudW6ujVsAh+jOxt5UUiricSF5AUr 1vnafiKxya8/nA3fAsWJPt0IPqwVQUpqP/57zXNb+15qMqtL8hI5iwtv2g3BKYVD5mH6i tG/rvohCfMd2jM3DOovrG1prAjJSCF07eQ+S9aY9CD0A3IphvYA7YeplHjaL2S8Dn7tyT s309MBo+dBMwcD0HbvoZXRFpRlegt5GosjMIvvSkTGWLq7TGk/oNoBPKDvMg4jS3ic0uL WX9miqjlrrbzN7WWJuQKE8GPrOOah8vBV9TnBLn+sQuRp8BJSXAUSQiGM4isaXeDt9w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hMa7EkHx; arc=none 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 4FD7D606A322 for ; Thu, 3 Dec 2026 09:45:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hMa7EkHx Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BFE71F000C1; Thu, 3 Dec 2026 09:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796291151; bh=0Ck7oM+lUo7pQVv8D3ovHf3hraFUknpm4Zflp4lIVkc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hMa7EkHxfrmAAnU+Fk3Yc5hgYLpjJNSgS/QsgtyriCj+oiCGankE5EggmjADe2dAG Lnfw4UZSPK3z40fLtsRI8DNSMXIKcXs+iIsYMrSpDcRb3q3RCBB1Q5A8lY5sBN/AW+ tGIJ34ihQC/n2MDAYZmAwEtFJMifb6d/zSxwbDzlDs3Xndlg+UVegUtDZlHXTxNEAl ARmeWtgi2UAFbDE64S19AtGpVvlxzi0XbU/JOGL8G4FObjCWzubr1WOBltQwc++YsA xsZIqntxvaqNH0ArqlzEwQKJyMFA3iNRJg1WWJP10HnmElzbEpUP4g3Tfb/p0TskVh 4ITQ9AC668U8g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] lib/sbitmap: test that free() clears alloc_hint and ws Reply-To: sashiko-reviews@lists.linux.dev To: "Wang Yibo" Cc: linux-scsi@vger.kernel.org In-Reply-To: <20261203093139.283431-1-wangyibo@kylinos.cn> References: <20261203083549.257985-1-wangyibo@kylinos.cn> <20261203093139.283431-1-wangyibo@kylinos.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:45:50 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] lib/sbitmap: KUnit tests fail without prerequisite commit ddca9a368588 -- commit 44070cee85e0c098e00fe8a98688018abe397d58 Author: Wang Yibo lib/sbitmap: test that free() clears alloc_hint and ws This commit extends the sbitmap KUnit suite to check that sbitmap_free() clears alloc_hint, sbitmap_queue_free() clears ws, and repeated free calls are safe. Link: https://lore.kernel.org/r/20261202112938.a596225d374bdf002bd1ad81@lin= ux-foundation.org > diff --git a/lib/tests/sbitmap_kunit.c b/lib/tests/sbitmap_kunit.c > index 284dcb5d7188b..98a544e4898a2 100644 > --- a/lib/tests/sbitmap_kunit.c > +++ b/lib/tests/sbitmap_kunit.c > @@ -45,6 +45,7 @@ static void sbitmap_test_init(struct kunit *test) > KUNIT_EXPECT_FALSE(test, sbitmap_any_bit_set(&sb)); > KUNIT_EXPECT_EQ(test, sbitmap_weight(&sb), 0U); > sbitmap_free(&sb); > + KUNIT_EXPECT_FALSE(test, sb.alloc_hint); > =20 > /* An explicitly requested shift is honoured. */ > ret =3D sbitmap_init_node(&sb, depth, 3, GFP_KERNEL, NUMA_NO_NODE, > @@ -285,6 +286,47 @@ static void sbitmap_test_iterate_set(struct kunit *t= est) > sbitmap_free(&sb); > } > =20 > +static void sbitmap_test_free_clears_alloc_hint(struct kunit *test) > +{ > + struct sbitmap sb; > + > + KUNIT_ASSERT_EQ(test, sbitmap_init_node(&sb, BITS_PER_LONG, -1, > + GFP_KERNEL, NUMA_NO_NODE, > + false, true), 0); > + KUNIT_EXPECT_TRUE(test, sb.alloc_hint); > + > + sbitmap_free(&sb); > + > + /* > + * alloc_hint is a __percpu pointer, so test it as a boolean, as in > + * sbitmap_test_init(). Clearing it makes repeated teardown safe, > + * which is what the scsi error-cleanup path relies on. Assert > + * before freeing again: EXPECT would continue on failure and pass > + * the stale alloc_hint to free_percpu() on a tree without > + * ddca9a368588. > + */ > + KUNIT_ASSERT_FALSE(test, sb.alloc_hint); > + sbitmap_free(&sb); > + KUNIT_EXPECT_FALSE(test, sb.alloc_hint); > +} > + > +static void sbitmap_test_queue_free_clears_ws(struct kunit *test) > +{ > + struct sbitmap_queue sbq; > + > + KUNIT_ASSERT_EQ(test, sbitmap_queue_init_node(&sbq, BITS_PER_LONG, -1, > + false, GFP_KERNEL, > + NUMA_NO_NODE), 0); > + KUNIT_EXPECT_TRUE(test, sbq.ws); > + > + sbitmap_queue_free(&sbq); > + > + /* Assert before freeing again so a stale ws never reaches kfree(). */ > + KUNIT_ASSERT_NULL(test, sbq.ws); > + sbitmap_queue_free(&sbq); > + KUNIT_EXPECT_NULL(test, sbq.ws); > +} [Severity: Medium] Will these KUnit tests fail in this tree because prerequisite commit ddca9a368588 ("sbitmap: Clear alloc_hint and ws pointers after freeing") is not present? In include/linux/sbitmap.h, sbitmap_free() does not clear sb->alloc_hint and sbitmap_queue_free() does not clear sbq->ws yet. Running the suite fails all three tests, breaking KUnit runs (enabled via KUNIT_ALL_TESTS) and git bisect until this is queued on top of that prerequisite. Also, the comment in sbitmap_test_free_clears_alloc_hint() hardcodes the unmerged commit hash, which can go stale if that commit is rebased and is unnecessary once this patch is ordered after it. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203093139.2834= 31-1-wangyibo@kylinos.cn?part=3D1