From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF8472EB5BF; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; cv=none; b=k/OhEoQlMlT+WLfpm2WCMJEk+MK5MMSofWGPhoIL/fq+s8nUbsjUiJ9J7plU+Kw8szu64dpq8J5SZmfLWr+c8FmFza+z1tsPqk6ClwcrQxpG1Kc7LsNmo0GJcAMAoA3S917syJWaIygOS2lBghnxr6JArLpJYGyuTh68nJ6/HMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; c=relaxed/simple; bh=Mp9NGrJWUWVhDqtHZIZvK7J6EzBqIIE/DcFZ0dsLmlI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cWK6SO19Y8czUnhDdRW7390zRI5l0uMmHVnEVqXbXyYpZ6qR62JvZ9AIg1tl3/w051X0D2nmXONNPz/gX7akwI65nheV2asdJPajvQQb4CSVx9B/AE3vDcweHO++vJuKl65Uu9G0dtZHqJSjW+cQ655O0CSXgMR/D9Gp4qETPq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MyvYsFVF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MyvYsFVF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840CAC4CEFB; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191394; bh=Mp9NGrJWUWVhDqtHZIZvK7J6EzBqIIE/DcFZ0dsLmlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MyvYsFVF++doDfDmql4rI45Ly/L4C6sSTlPhwMehw3YmWvFJxJ/BhN+uKI+7b51Ao ouhcbmsQQvbjDsAmP1FUTyIoANwHI4wrUG0qPSfG9ZOHnzHgcZAkap3SQi4pOqg4fC yS47Di4SMEkXElmAB0GPq9VNafK2lKv8MV9Ju+fgArO0h62zYyFwuCa/9owN+sEWxU /2ORzpAE3i1bm728Bf4H2m4IYlN1c4WGcI0cDSo5Yp5GTqrrevwQVexvhlNMzAqcmc kJADyuO7ZH3hP/KuIScc2oh2bVV/ppdndc4EuH3v/ZIc74k5fEoTVs+xoSXsUrN3wt 72bTFrO6VS48A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id CD70CCE0B32; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 01/11] rcutorture: Fix jitter.sh spin time Date: Thu, 18 Sep 2025 03:29:42 -0700 Message-Id: <20250918102952.2593045-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" An embarrassing syntax error in jitter.sh makes for fixed spin time. This commit therefore makes it be variable, as intended, albeit with very coarse-grained adjustment. Signed-off-by: Paul E. McKenney --- .../selftests/rcutorture/bin/jitter.sh | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh b/tools/testi= ng/selftests/rcutorture/bin/jitter.sh index fd1ffaa5a1358e..3c1e5d3f88058c 100755 --- a/tools/testing/selftests/rcutorture/bin/jitter.sh +++ b/tools/testing/selftests/rcutorture/bin/jitter.sh @@ -39,6 +39,22 @@ do fi done =20 +# Uses global variables startsecs, startns, endsecs, endns, and limit. +# Exit code is success for time not yet elapsed and failure otherwise. +function timecheck { + local done=3D`awk -v limit=3D$limit \ + -v startsecs=3D$startsecs \ + -v startns=3D$startns \ + -v endsecs=3D$endsecs \ + -v endns=3D$endns < /dev/null ' + BEGIN { + delta =3D (endsecs - startsecs) * 1000 * 1000; + delta +=3D int((endns - startns) / 1000); + print delta >=3D limit; + }'` + return $done +} + while : do # Check for done. @@ -85,15 +101,20 @@ do n=3D$(($n+1)) sleep .$sleeptime =20 - # Spin a random duration + # Spin a random duration, but with rather coarse granularity. limit=3D`awk -v me=3D$me -v n=3D$n -v spinmax=3D$spinmax 'BEGIN { srand(n + me + systime()); printf("%06d", int(rand() * spinmax)); }' < /dev/null` n=3D$(($n+1)) - for i in {1..$limit} + startsecs=3D`date +%s` + startns=3D`date +%N` + endsecs=3D$startns + endns=3D$endns + while timecheck do - echo > /dev/null + endsecs=3D`date +%s` + endns=3D`date +%N` done done =20 --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7022287242; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; cv=none; b=u41atmO6ztHMG8x6SPytJN/Tn1+yCgfhkhV/AIXpvpvUVP9gaRhYt26BfMli8IGLxH8txrMbKmrBFX2U0PY1d8syUuyvxKdNFRzywtHE46y1HMLiEQP6ctajnFg3lrU5C9K7+TovbosKc2VJkvSxVi4tBZvLQjFcjJmrSezv6Co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; c=relaxed/simple; bh=Cz/f8Ty/4zEpoYFihblKVOHBZS+Lk96uBujFwo+m+CE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ADl3c0lIwl2dwI6FtRl2LCMGEe2bozkEkJlbjbFQU5Fu1PCnvY75tMmOqA5wMEirq2PhBeH5VhqzORJC0GmDmmTwb8+AtgT7RrTBUPBZxL9dIxvDM/BvjGsTruN+VVZ2tyx0PW/Rrhy4TiRDeLS0sv5xYsrOaLdC/XE6YKfwF/8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Fum2RgkG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Fum2RgkG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7635EC4CEE7; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191394; bh=Cz/f8Ty/4zEpoYFihblKVOHBZS+Lk96uBujFwo+m+CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fum2RgkGRWgBJRmwKxED4fccQBDTOLQ4f7p/y8rgEEt0s/GudsVc3YzgsSdc2150z oAvB8oqQgUhalWzlQT0i4/NvTg9p7VyGALURQmQhhoDR7AEjKGoJdtdCLqARu2wLkm /gFedysQgmoqoAhSW7DVIUMwA//rxxKxbWmvqIef3PPxyKoAVbdib7EefdE0kbaVMM gzQ2C2FUwLGQb7eQljO+8smXVgeC09oyXZE4Xd2tvISLy9QYyqw4bGpDvGNzQgrI/N PZVc5GSCjIf/bqakEcvitRNnD+XStbY+xKOJTDB7WAoRh/tUiwM23VLJoB45qX0Pa+ a9cf1S+chvUiQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D054CCE0D66; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 02/11] torture: Add --do-normal parameter to torture.sh help text Date: Thu, 18 Sep 2025 03:29:43 -0700 Message-Id: <20250918102952.2593045-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The --do-normal parameter was missing from the torture.sh script's help text, so this commit adds it. Hopefully better late than never! Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/torture.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/test= ing/selftests/rcutorture/bin/torture.sh index 611bc03a8dc705..a33ba109ef0b7f 100755 --- a/tools/testing/selftests/rcutorture/bin/torture.sh +++ b/tools/testing/selftests/rcutorture/bin/torture.sh @@ -94,6 +94,7 @@ usage () { echo " --do-kvfree / --do-no-kvfree / --no-kvfree" echo " --do-locktorture / --do-no-locktorture / --no-locktorture" echo " --do-none" + echo " --do-normal / --do-no-normal / --no-normal" echo " --do-rcuscale / --do-no-rcuscale / --no-rcuscale" echo " --do-rcutasksflavors / --do-no-rcutasksflavors / --no-rcutas= ksflavors" echo " --do-rcutorture / --do-no-rcutorture / --no-rcutorture" --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C70AA2E54D7; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; cv=none; b=hznGG/sEyfFnRRNJod5ryp9/3G2VaJytTSXxdZ7r0kVQvRc6oxW/nJPnVe8hPYYhvgllFLLe78ekfRqlOZpTfdDhG9mBnzR/qAXHTZSEp19pa34KBY3YKUXqWbg5gC8pBw2mlRRkp4KdjiykmmSVkePqWnkTNMtyXy0xnf+8KWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; c=relaxed/simple; bh=o0RHpAqGikfODESDcNqT7pVVwVOSWbUKhTNHQn++MVw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l+tFth0hOnM+dYF+VTM7+3z7yH6rYaN6albwVxWpQD0eDkAKTMAJR9EA4GwZDKBz5WPHcoYJorRtEAWwIQdNUsvNk9j9ATXXDSq08Zf9vrw/OpAumAa6wjVtauD9oHlBF+OSyeW0gwUc0bmnhCCBW2XHmoX8JCcnfxqu8AKm5ao= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fCXJfzoY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fCXJfzoY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E64C4CEF7; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191394; bh=o0RHpAqGikfODESDcNqT7pVVwVOSWbUKhTNHQn++MVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCXJfzoYKrKFZMs0Lo8zdGGEHsVVsyem4sEjV+ubWxUpPsyXf1HwZqzblPhl0Ynsa G+8R4LPqX+U2YhB9DdyneKkFfY+MUCJFg/vBBnoLPPyGmhUpcWt7fidY0PSdbl9ISb KPvizJN7Lj6Gai3qjyJ24qbOhk9MufiKHYZW+WfhnYiPlJmRarKx5+EBq9JpCOkwEP 42h/mFZBCAB9FhAnMYYQ3kTRr6fn8tgnbyeNikE829y+uXs3qlQSMVAyK7qWVZ562g tnulNNOYzJ0aWwQcYZBm3GKGEqKXbkz6VWpgq9AqHmP7Gu/zz76zXo/Mq++b0RE5xk CmVGIqG9FdFFA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D2F1BCE0EFF; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 03/11] torture: Announce kernel boot status at torture-test startup Date: Thu, 18 Sep 2025 03:29:44 -0700 Message-Id: <20250918102952.2593045-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Sometimes a given system takes surprisingly long to boot, for example, in one recent case, 70 seconds instead of three seconds. It would be good to fix these slow-boot issues, but it would also be good for the torture tests to announce that the system was still booting at the start of the test. Especially for tests that have a greater probability of false positives when run in the single-CPU boot-time environment. Yes, those tests should defend themselves, but we should also make this situation easier to diagnose. This commit therefore causes torture_print_module_parms() to print "still booting" at the end of its printk() that dumps out the values of its module parameters. Signed-off-by: Paul E. McKenney --- kernel/torture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/torture.c b/kernel/torture.c index 3a0a8cc604010a..5abb4b25d971cc 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -797,8 +797,9 @@ static unsigned long torture_init_jiffies; static void torture_print_module_parms(void) { - pr_alert("torture module --- %s: disable_onoff_at_boot=3D%d ftrace_dump_= at_shutdown=3D%d verbose_sleep_frequency=3D%d verbose_sleep_duration=3D%d r= andom_shuffle=3D%d\n", - torture_type, disable_onoff_at_boot, ftrace_dump_at_shutdown, verbose_s= leep_frequency, verbose_sleep_duration, random_shuffle); + pr_alert("torture module --- %s: disable_onoff_at_boot=3D%d ftrace_dump_= at_shutdown=3D%d verbose_sleep_frequency=3D%d verbose_sleep_duration=3D%d r= andom_shuffle=3D%d%s\n", + torture_type, disable_onoff_at_boot, ftrace_dump_at_shutdown, verbose_s= leep_frequency, verbose_sleep_duration, random_shuffle, + rcu_inkernel_boot_has_ended() ? "" : " still booting"); } =20 /* --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C712C2E9ED7; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; cv=none; b=Wq2YOkQOWSjTfeLNwbuOj3v7HkE5svTK8x8KZpX6zq8Y8XmrBiYP3q9pXdHXx+MVZ73Gnhfgg8uIcsdSH0VFJYKkQ2o9A1URUQesWiQR5Lb4apdriWKdq3rESnEzeIZPHONU604weC8BpEJCBc8aapRVOPV6hd/MN9fGD9TxmeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; c=relaxed/simple; bh=QRMj3cfejFshQ8gBkMpPIHQRTiBKhfo6s4NoeWXO8TE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FT3Lj1HhNaisprRKvNy6RyAMPsBVdWrKnNglhPrbP7tr2k9sA4gh7Mffh0mMH75AooNQbvQ9u6E+ClQ3dQ2jF57UJHNruDbCOrWc0vHxCrDmeDefEn2uhRrN5U/KFhslaZi1JSPxOIK3G75bBlV9c02+YyCHT8qDJPyQWMxs0t8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OIJvkAvH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OIJvkAvH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF6FC4CEEB; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191394; bh=QRMj3cfejFshQ8gBkMpPIHQRTiBKhfo6s4NoeWXO8TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIJvkAvH8rPumN5z/8xjTX2R+xqJC+7qXGplarnKLEj8zXTN/3d6QGRxnUo4/4SbL 2EUOFj20i23hIhO6e2nJ+1Bc9QK5/RN/B3a2OExPNha3KAmrnzf09EW3V6D7u7gEjF hmCaxMI+n30NULEKDASzaVx0Qtjo4gxDZXk5VYtEIV1egrseVX9NGgKMDimEHudxO9 wOaAhL0svMkhgiqZMhIZshLQvNEIATl6J5DWgWUOaQZLjadcKSLu+hNbziecrra+8J Q/3RDx9J7AywxCrzmrWpsXA/dWel6ykkp0njwfotUULStBZs3mgLRlmr97AaDyYa93 Uskr1bJJXeVgQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D56FACE0F82; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 04/11] rcutorture: Suppress "Writer stall state" reports during boot Date: Thu, 18 Sep 2025 03:29:45 -0700 Message-Id: <20250918102952.2593045-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When rcutorture is running on only the one boot-time CPU while that CPU is busy invoking initcall() functions, the added load is quite likely to unduly delay the RCU grace-period kthread, rcutorture readers, and much else besides. This can result in rcu_torture_stats_print() reporting rcutorture writer stalls, which are not really a bug in that environment. After all, one CPU can only do so much. This commit therefore suppresses rcutorture writer stalls while the kernel is booting, that is, while rcu_inkernel_boot_has_ended() continues returning false. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 7a893d51d02b6a..49e048da4f6810 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2756,7 +2756,8 @@ rcu_torture_stats_print(void) cur_ops->stats(); if (rtcv_snap =3D=3D rcu_torture_current_version && rcu_access_pointer(rcu_torture_current) && - !rcu_stall_is_suppressed()) { + !rcu_stall_is_suppressed() && + rcu_inkernel_boot_has_ended()) { int __maybe_unused flags =3D 0; unsigned long __maybe_unused gp_seq =3D 0; =20 --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF7712EAB61; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; cv=none; b=t/X5Ee1zCIwYrkd7P42bhLMOexGsjIIvfPgs1RQX93OSeR9ObtZZInd7+oKF2iofqxTtgXLb2ib16P2vljNGElR6bnMK8B0HR8BznLbAYp8DUdAfH+Mw0Ip3R3XdwuLQA4YklzB5bo/enICrHKCyf/Bd1DKXoClIwFoTz6Kmsdk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191394; c=relaxed/simple; bh=b9sPRChOApZiUr0xwL3sxPCf4tYxxEx0JLu49QV5rt0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=INs8fNrgvlrxBSunQnq5ZR611WJn8eK8Ttefb7zgAA+n5tviVp5X2VeeieBQOkLmSJHAvQWILqgX0h4ePXGea9cvJ5wPsbwYnhZb3o4Kb1fV6Notie5Mi7pvoN2pBkp+2IZjVhNSNBS5mlUlb0SFCGlFS9dW6RyBU/nzfFJSWuU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DmF9nrC7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DmF9nrC7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BFEBC4CEFA; Thu, 18 Sep 2025 10:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191394; bh=b9sPRChOApZiUr0xwL3sxPCf4tYxxEx0JLu49QV5rt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DmF9nrC7jx76D0QchYlJ7NNph2K4+VOs1dglNydEdlLbNELwQ5QKHVY7/hsOIkAC9 bYcudcVB5ftvEoDBNt9Oy6SeLuxim877t7Gqj7bN7lsWG+hpvFIN6YpO/dFmOMoZtj RcFZpdYOa+ZXPDAoD29xJ912gN9HNklneNmfDYH2eX/ywn3BpdUXa5Ib/d1aD4rou8 wGniZf60qJ3Av+hmE7L5Kx51LhMpX/Yj1fjqNRZjwWQ59NJkd7/4a8+o90afzsuahG yKwYjDQVLpWNOfqSHhICbfbYIps4EkTSN/GPrjFMWA5iBrV7WgypI09HCASAx0ZRJy H+umF3JNn2B9g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D7C99CE10B6; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 05/11] rcutorture: Delay rcutorture readers and writers until boot completes Date: Thu, 18 Sep 2025 03:29:46 -0700 Message-Id: <20250918102952.2593045-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The rcutorture writers and (especially) readers are the biggest CPU hogs of the bunch, so this commit therefore makes them wait until boot has completed. This makes the current setting of the boot_ended local variable dead code, so while in the area, this commit removes that as well. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 49e048da4f6810..1578d330565752 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1528,7 +1528,7 @@ static void do_rtws_sync(struct torture_random_state = *trsp, void (*sync)(void)) static int rcu_torture_writer(void *arg) { - bool boot_ended; + bool booting_still =3D false; bool can_expedite =3D !rcu_gp_is_expedited() && !rcu_gp_is_normal(); unsigned long cookie; struct rcu_gp_oldstate cookie_full; @@ -1539,6 +1539,7 @@ rcu_torture_writer(void *arg) struct rcu_gp_oldstate gp_snap1_full; int i; int idx; + unsigned long j; int oldnice =3D task_nice(current); struct rcu_gp_oldstate *rgo =3D NULL; int rgo_size =3D 0; @@ -1581,6 +1582,16 @@ rcu_torture_writer(void *arg) rgo_size =3D cur_ops->poll_active_full; } =20 + // If the system is still booting, let it finish. + j =3D jiffies; + while (!torture_must_stop() && !rcu_inkernel_boot_has_ended()) { + booting_still =3D true; + schedule_timeout_interruptible(HZ); + } + if (booting_still) + pr_alert("%s" TORTURE_FLAG " Waited %lu jiffies for boot to complete.\n", + torture_type, jiffies - j); + do { rcu_torture_writer_state =3D RTWS_FIXED_DELAY; torture_hrtimeout_us(500, 1000, &rand); @@ -1769,13 +1780,11 @@ rcu_torture_writer(void *arg) !rcu_gp_is_normal(); } rcu_torture_writer_state =3D RTWS_STUTTER; - boot_ended =3D rcu_inkernel_boot_has_ended(); stutter_waited =3D stutter_wait("rcu_torture_writer"); if (stutter_waited && !atomic_read(&rcu_fwd_cb_nodelay) && !cur_ops->slow_gps && !torture_must_stop() && - boot_ended && time_after(jiffies, stallsdone)) for (i =3D 0; i < ARRAY_SIZE(rcu_tortures); i++) if (list_empty(&rcu_tortures[i].rtort_free) && @@ -2437,7 +2446,8 @@ rcu_torture_reader(void *arg) torture_hrtimeout_us(500, 1000, &rand); lastsleep =3D jiffies + 10; } - while (torture_num_online_cpus() < mynumonline && !torture_must_stop()) + while (!torture_must_stop() && + (torture_num_online_cpus() < mynumonline || !rcu_inkernel_boot_ha= s_ended())) schedule_timeout_interruptible(HZ / 5); stutter_wait("rcu_torture_reader"); } while (!torture_must_stop()); --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A16E2F5A1A; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; cv=none; b=QvRQaEQIIKyGsrM5R9pw+kILbto3sLHx1MUF+6GDM9FkLPemJU4CE/IytUOMCD4FLZR/8eJOHkrIXb25IaldIYHKX+Rh9FP9Z9z8kB0rd1zCOZOGGSOIHiTGiG6/Eczn6i0zLYj3ePGnERGY2+hnXxEV91i2Wm2QKE0cc6Zywsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; c=relaxed/simple; bh=jJfIUtEDWjKmTQ75RA/L6ODvVHBRzgs6f1hgAtKNxGY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EYo/wHe5/PFLgGNnFpO4SXkgAc4UqBfCSmWWS0Wo7tgXbPd4gkV+Jlt7bNlcvlokA5Qw/2IZn59vEXOEmD5JypTOxyoaV626NAMOM6qqEU27EXUMVTraDU8MvRunzbzuBYhI9eaOo6PQRq7PH3mg1RU3mIkWdnS9vPtFjLwvECM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YJwhXw4B; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YJwhXw4B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 027DDC4CEE7; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191395; bh=jJfIUtEDWjKmTQ75RA/L6ODvVHBRzgs6f1hgAtKNxGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJwhXw4BB+lXH9Ljrw+98NSWWqZhKXL1lI1rZW+EfrwrBPJKpBX5zpWqOGR3NHyEd cmTY2+hFcGiec0k5QagH/5EzA6bxn0W0e55cmdZsr3hyEzm6d/TjZKibOBVhJoZkfo 29FF8ZwLgmtWXOE6Qffq49WfU/VvmSbKUv07XqjefMQ0P2fsFOb8rVUWq5plGoWyfL JOj+2CBp+JflMaW40W0WCVRoqp1zHW7WUc4zCbhs6sDPQQf7jZetv5BhEsJnungKxV V518Apn+R1nVl5huqSvAfgqiI46ALVu2/wjzAEEzQosHrf7qQZ2a8FQ8DdsN6Kr4I+ VeC2SXJpYwYVQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DA23ECE10DB; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 06/11] torture: Delay CPU-hotplug operations until boot completes Date: Thu, 18 Sep 2025 03:29:47 -0700 Message-Id: <20250918102952.2593045-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" CPU-hotplug operations invoke stop-machine, which can hog CPUs, which is not a great thing to do before boot has completed. This commit therefore makes the CPU-hotplug operations hold off until boot has completed. Signed-off-by: Paul E. McKenney --- kernel/torture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/torture.c b/kernel/torture.c index 5abb4b25d971cc..1ea9f67953a766 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -359,6 +359,8 @@ torture_onoff(void *arg) torture_hrtimeout_jiffies(onoff_holdoff, &rand); VERBOSE_TOROUT_STRING("torture_onoff end holdoff"); } + while (!rcu_inkernel_boot_has_ended()) + schedule_timeout_interruptible(HZ / 10); while (!torture_must_stop()) { if (disable_onoff_at_boot && !rcu_inkernel_boot_has_ended()) { torture_hrtimeout_jiffies(HZ / 10, &rand); --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28B1E2F547D; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; cv=none; b=MmdpVWiALG60/KnIIxIs/1DxrhboLylFMMoYtdYCdStb9XcNq58X5Qp2KW7OZ/VTSaFFL9chXAWxc3WE0tea7Qpob5mddfUhg9XO1tUfC3las0XLMPb78eGPMJOnxeqRtFPZxH6Cdn/x9PjqcUbFtdhcj/x57ZqOWQkPVCFnXeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; c=relaxed/simple; bh=gE4Rji/8SJ+UEZVXQUf6+/Ok6DOW5KtjWyQ+ski3jFY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pOeAXstMAeSavKa3FG3MdHYIglROuUMllub2wouzeiyVW+spYvhM7pEehJJuWJHa/x9lrxkfXP1utaMQN+tbWMVn4HEzGn8wmA9I10HxpS7ycPDLB29GrqmDWlR6rkcSYbejHkdsCZ+knuQYTfkls8zfKRae3wvCvLv09iHOdE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YIViwuEX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YIViwuEX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A61DC4AF09; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191395; bh=gE4Rji/8SJ+UEZVXQUf6+/Ok6DOW5KtjWyQ+ski3jFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YIViwuEXmwdCNUF+WLGTO3++WKGxHnF2I8VkZv8VX9wgn7ZAz3H2F73YBrBaTtay7 FpL+V7DxRRoqFA38MFKOQ282aols4vyUPBO6fqHUZphltERqiNHGxA4jOU1t1JAFrv yYsvvFquQUgE8a2hg8VbCVzXUqv/AZlUHygmV+Qg6yH7VPokS1JI1Ju8v/Fep7+o4n JsSXL1OJq5U/zupqxRKr3Lr5nxGJuDRwLPVzVBoSzx17cN1wjjyFDEeH3b1iPiuF/Y mdgq9b6ikpqVLTJYlVzEt/IjezuN38Awz7Y6riiPpAkmLw4cR0S0zAZU/jglkzSiBz eAgBsRcpXmjAg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DCA85CE10F9; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 07/11] rcutorture: Delay forward-progress testing until boot completes Date: Thu, 18 Sep 2025 03:29:48 -0700 Message-Id: <20250918102952.2593045-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Forward-progress testing can hog CPUs, which is not a great thing to do before boot has completed. This commit therefore makes the CPU-hotplug operations hold off until boot has completed. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 1578d330565752..b8a684459381f2 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -3457,6 +3457,8 @@ static int rcu_torture_fwd_prog(void *args) int tested_tries =3D 0; =20 VERBOSE_TOROUT_STRING("rcu_torture_fwd_progress task started"); + while (!rcu_inkernel_boot_has_ended()) + schedule_timeout_interruptible(HZ / 10); rcu_bind_current_to_nocb(); if (!IS_ENABLED(CONFIG_SMP) || !IS_ENABLED(CONFIG_RCU_BOOST)) set_user_nice(current, MAX_NICE); --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28BB62F549E; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; cv=none; b=t57SqAPePZMu3sOkVRAGVY7X9ioi9xo6hClbV8HW0xJMhT6C7aDa9DTnGpZpROkd2OsFhMm1Ddrvnddtu5C3uMZ/kHJQe93x0CrTeaEUVHI59LW1cWdM2Pe4DB9klFxqTxBVLyu02aq12999g1CwdzXI4UE6RqxvJYQiXyQQRwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; c=relaxed/simple; bh=iZgfujpyduVegeZVrLnoIiFFN0/XbNGUGBJBpNQfD5M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xkj7clmEeQiHhZDp+lN6v0oXyN8OYRo8lvTsRaWL58opjSP75L9dXgE0hlaKXa8MJmylW5KKqJaF+R2ItXBbOCcKwyVXjBJuh03Kc23+kUwlvHspLYQOfZ5Iut8V7vbp3gJ98ENnbAE/3d+K0/LpDijU2GM8qZpyTIvis/fRaOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fLJcsvaZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fLJcsvaZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A55FC4CEFA; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191395; bh=iZgfujpyduVegeZVrLnoIiFFN0/XbNGUGBJBpNQfD5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLJcsvaZVN0eyoWgosOfeYKFYKnKUK3zfCzhEvOags3xR50Rznsz8h7F4tXyCa9Dd 7yvQeTD6WFxweMu+8flOtn31OIyOzfvz2UzLgEqCptDP3ft1echMit9YF9VqGn7tKI G8jqeT2bDi5ZGAbf/Ov20mHChPclD+o/9IZ3HgtAEVVKLr2JofieCx0OtvCuw/Uvfi XVE+iRosJAelQ0Pz1IBWrcoKzh1EjEWhTzaINcMAnXKw8CA8XwurPPC7RDQ1UQtXbu Qeka/JByhB0zq+0cqLMLtycoGRO+TiaUaDWpQ9znVefyeZWIG4wP+88a+dJxQ0QFWf eowIZ7gXIXPnA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DF007CE1109; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Qianfeng Rong , "Paul E . McKenney" Subject: [PATCH v2 08/11] rcutorture: Use kcalloc() instead of kzalloc() Date: Thu, 18 Sep 2025 03:29:49 -0700 Message-Id: <20250918102952.2593045-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Qianfeng Rong Use kcalloc() in rcu_torture_writer() to gain built-in overflow protection, making memory allocation safer when calculating allocation size compared to explicit multiplication. Change sizeof(ulo[0]) and sizeof(rgo[0]) to sizeof(*ulo) and sizeof(*rgo), as this is more consistent with coding conventions. Signed-off-by: Qianfeng Rong Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index b8a684459381f2..29fe3c01312f60 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1572,12 +1572,12 @@ rcu_torture_writer(void *arg) return 0; } if (cur_ops->poll_active > 0) { - ulo =3D kzalloc(cur_ops->poll_active * sizeof(ulo[0]), GFP_KERNEL); + ulo =3D kcalloc(cur_ops->poll_active, sizeof(*ulo), GFP_KERNEL); if (!WARN_ON(!ulo)) ulo_size =3D cur_ops->poll_active; } if (cur_ops->poll_active_full > 0) { - rgo =3D kzalloc(cur_ops->poll_active_full * sizeof(rgo[0]), GFP_KERNEL); + rgo =3D kcalloc(cur_ops->poll_active_full, sizeof(*rgo), GFP_KERNEL); if (!WARN_ON(!rgo)) rgo_size =3D cur_ops->poll_active_full; } --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A2632F5A1B; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; cv=none; b=ioeElDPtZ3an/0vlk/MiM5D7bIlSbnO2a1PuZA/o2+a6tcWf2wzJgRHGCNbdAmoyD8wYnMxGB7RlD8/A6xN3Ve76AwYTFDfuycnqGyAXA33CMeqyDlp9XOaEwQhqWE9AkD7eJU5kROyOGGSmKZV82gorZqEDUjH6WGkKOKusbeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; c=relaxed/simple; bh=9Jy/9m0bPK9FNxxaGVhSCzbgUZMydSumdbycYxZ2g4s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hmsYpYjyZhzFqkPJ6D6ses/PrJHvtH5ov7Wlh+WD3EHTo4Rw4djMKnjbLk6PDbG5jSsseS3TwTxSNdA1ESahrDaAIO4MeudujaPviAhA3F+O+3qGeaxHFWq6TL369zaDXJuJ/4NMGpL4N03ZcgsqgeokUIOWt0XCib4LaWeJwCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d4IOeRJd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d4IOeRJd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A5CEC4CEFB; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191395; bh=9Jy/9m0bPK9FNxxaGVhSCzbgUZMydSumdbycYxZ2g4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d4IOeRJd5V9eHONhdRFOfQztG9mW41OYOPzDlhnLQpBacT41BfwHdBY5Efa3W6WVu 5+DCpMfUuwMoDVYmiq1UXoP6TzDGTPOzGRJBDW6W1aruZHc97GpxoLvYsPOHXhqlXb ayNYzwBOzXkPbP8II2FzVb9xBkwez3GShiig5EGk+0ap7A9I4+UsN5cfejhChBOAGY aKVQ2mxVvFyNbyNFL1/qkMQJM4pm4wlEymqYcZlul4QWDrsEXGaHG8prT5VGC+27PY 8lk/eGPA/2Y41xiufIAud6DWoGCHTf4lGF97P2Z7r1gmhB2GMncUaoihSjxhuY+VMT 537F8tDj5gw3w== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E15A3CE112C; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Qianfeng Rong , "Paul E . McKenney" Subject: [PATCH v2 09/11] refscale: Use kcalloc() instead of kzalloc() Date: Thu, 18 Sep 2025 03:29:50 -0700 Message-Id: <20250918102952.2593045-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Qianfeng Rong Use kcalloc() in main_func() to gain built-in overflow protection, making memory allocation safer when calculating allocation size compared to explicit multiplication. Signed-off-by: Qianfeng Rong Signed-off-by: Paul E. McKenney --- kernel/rcu/refscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index df646e0694a8cc..5840fac06feb7d 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -1021,7 +1021,7 @@ static int main_func(void *arg) set_user_nice(current, MAX_NICE); =20 VERBOSE_SCALEOUT("main_func task started"); - result_avg =3D kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL); + result_avg =3D kcalloc(nruns, sizeof(*result_avg), GFP_KERNEL); buf =3D kzalloc(800 + 64, GFP_KERNEL); if (!result_avg || !buf) { SCALEOUT_ERRSTRING("out of memory"); --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A0912F5A15; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; cv=none; b=soq6LoTvLZA5zdWeOfjBGdSpCq4ixpq7vy+VAKCrX0k0BVG0v86+ocEuqkTLOQBFGh2xmX3Ucl3c+bXt3DzNd89IlPkh+HBKTCQFyBH/MqEaZf//OR7EncsQnYKwCjY2ovbpaVpVsZcubSvwYyEjvDTaOdXSAjQMX3Zmg8WVioU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; c=relaxed/simple; bh=Ojqjdl0xYa7AVJyJ5wv5zQIWfqAIqiKEl8ukMG3AfY0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YvW4aKlzN4gjEKwSJ5Eg7pE4LhJoqeWZ/lnMBWuWta82/NuYYy5LQ9Ubfj8wfnDP0+lwF8F/0INnZIOe5RPJGtGV5yI1Lemch7kQSI7JlDB6KUd0BvQM9jWeez0uGGOnKTnGL7te7qRbNYwa0cbAhvQotwZO4zv7o3Rb/fH8puE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ovpzRpnd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ovpzRpnd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ABCEC4AF0B; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191395; bh=Ojqjdl0xYa7AVJyJ5wv5zQIWfqAIqiKEl8ukMG3AfY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovpzRpnd3iqgvMkrIcyIJ7iD6j9tdkuJFrMmoWCxBY/KjqxgndrfLDrc5ZzpWGoTM n5XPPiB3Eq5A6feGiDRwCsSmFpI3TQ4338H2iYyOzsoRJREGfAfJbu354TwoBl4AKn xVvfuHrlpadn1kzuUl3Y0sz6p0qgaTIbSLR0eCwI/iNTi4MM1i0TVlKnAqyzl1G/f5 cmDfxFvXdxa3DhKzzRTPk2wFQAvb94TRTX+Ya/eF7qjmPwzSh3MWeO3AwzVvaWxfpF kuoEUvbpTN2KlJq21GnmoV28QT/bCqhkJ33KJ3pTviKMaBzopXxqC93JqdxPVMEPSn JzaPas0UMMEcA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E3B6ECE11BD; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Kaushlendra Kumar , "Paul E . McKenney" Subject: [PATCH v2 10/11] refperf: Remove redundant kfree() after torture_stop_kthread() Date: Thu, 18 Sep 2025 03:29:51 -0700 Message-Id: <20250918102952.2593045-10-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kaushlendra Kumar Remove unnecessary kfree(main_task) call in ref_scale_cleanup() as torture_stop_kthread() already handles the memory cleanup for the task structure internally. The additional kfree(main_task) call after torture_stop_kthread() is redundant and confusing since torture_stop_kthread() sets the pointer to NULL, making this a no-op. This pattern is consistent with other torture test modules where torture_stop_kthread() is called without explicit kfree() of the task pointer, as the torture framework manages the task lifecycle internally. Signed-off-by: Kaushlendra Kumar Signed-off-by: Paul E. McKenney --- kernel/rcu/refscale.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index 5840fac06feb7d..7f3d23762ef7c7 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -1135,7 +1135,6 @@ ref_scale_cleanup(void) kfree(reader_tasks); =20 torture_stop_kthread("main_task", main_task); - kfree(main_task); =20 // Do scale-type-specific cleanup operations. if (cur_ops->cleanup !=3D NULL) --=20 2.40.1 From nobody Thu Oct 2 09:21:05 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 536F72F5A3C; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; cv=none; b=VuBZE27PlBnIte9Bmb6dZWyjdIrwXyc8t7GRFgyeH1Pjd6DtMXCoou90+w18z3xTujqkcpdxoLaADqNJaYBnWnuFkp9Ab2y5lY7zfTgaKAHNnjNKvxLqIFv8F9Qa1SBAbzQr7SIEb96Ljf9zBCYud77+76z371CxGKt3LIqQCf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758191395; c=relaxed/simple; bh=cqFDloOtTlaPzu/Dg/kSHk8p5W4VMt3ISrqsKrawZtI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RQlF2qf8vxNMN6mJkzixEsQ6nkMngK3qaAjqF5S5FmSK2tZdIkADd2KkqkuUdjK9i5VgJXAWfUH+svDk7Lp3w3usHZqAUDzF9AIQM4P6xedn5y4vK/PswuDa3z3v7qw78WCD1BTUvwQWTxyr+rpHvvH/e4h62E9Hi69Hfr0u2d0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jXEpahW8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jXEpahW8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238B8C4CEF7; Thu, 18 Sep 2025 10:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758191395; bh=cqFDloOtTlaPzu/Dg/kSHk8p5W4VMt3ISrqsKrawZtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXEpahW8PUP0uzzt0LMPPXwWsjm360l72ObJeUDmDCEQfXxfticM+aIQqWsIaJkxm OE6d7/Y3btvtLa71oY5mzjzR4m2dhkTYtYsbK0AREGWSFV62djQ3z2rDoopjQGoPQe fFAmpXE5F9SYiF3GVMcnNW7XO+ZWIiAZcflBbbKe5elulV8W5tNBYEiNQ77WH72xmL /H8W+4lOOCMVFtevYZToY9xFiOzZOU47ITDY+Zy3ACVClO9PtWo43bYjUlHeGHFX8y 1Sc9ziHZQOuw9mFxQrP2KqWcCby545sNuO53ExUvRsP1bLc+ScHTLClPSfQnLRFkwR WXyi/mm8ifxsA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E61ACCE11D7; Thu, 18 Sep 2025 03:29:53 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Kaushlendra Kumar , "Paul E . McKenney" Subject: [PATCH v2 11/11] refperf: Set reader_tasks to NULL after kfree() Date: Thu, 18 Sep 2025 03:29:52 -0700 Message-Id: <20250918102952.2593045-11-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kaushlendra Kumar Set reader_tasks to NULL after kfree() in ref_scale_cleanup() to improve debugging experience with kernel debugging tools. This follows the common pattern of NULLing pointers after freeing to avoid dangling pointer issues during debugging sessions. Setting pointers to NULL after freeing helps debugging tools like kdgb,drgn, and other kernel debuggers by providing clear indication that the memory has been freed and the pointer is no longer valid. Suggested-by: Paul E. McKenney Signed-off-by: Kaushlendra Kumar Signed-off-by: Paul E. McKenney --- kernel/rcu/refscale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index 7f3d23762ef7c7..19841704d8f579 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -1133,6 +1133,7 @@ ref_scale_cleanup(void) reader_tasks[i].task); } kfree(reader_tasks); + reader_tasks =3D NULL; =20 torture_stop_kthread("main_task", main_task); =20 --=20 2.40.1