From nobody Sun Nov 24 07:41:24 2024 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 343C7204F62; Wed, 6 Nov 2024 16:02:32 +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=1730908953; cv=none; b=Bk9yqk4Fr6UUblRW0tD4ePkMwUUQ+pBm2v3UqeAuja/Y7pf9ywWL9XAedkOPu8eAAhs1Absmzdb3UwMglk1IJcWAiBMiFXnsgWs+kDS1Rt1Pg8ODSFtRl3L5qldAOdr3sV+iAdiUW/sxrqHpKTuABSnM0YyHWy0PxoUM5rJ9quU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730908953; c=relaxed/simple; bh=U/ItV5j1IpXcUSs5Dm84g9/hYR9gVguqhjK8HZMgJPM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JQbE6bWDqD+wewac8RP6z6fLtU0ywXakdTfp1ZuqrwFTD+qgbuTHZHQys89vqUb3TlMvbBREQyUfsiDHHCfJDUUhuJXNog8GmHowap7+++zu8bd2ewMKR7pNEWoJ7kuJNb2vmt1JWSrs5LMvwNaNDlRZ5GL6IL5rviSte1pLRBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DWy4Zodh; 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="DWy4Zodh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42DE3C4CECC; Wed, 6 Nov 2024 16:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730908952; bh=U/ItV5j1IpXcUSs5Dm84g9/hYR9gVguqhjK8HZMgJPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWy4Zodh36t9qH9k8xzjHrN5kAOcvILfj3dmKyPcH7U+s5gGDxeRCMjPIKYtIiaZ4 KFEt+RY++4V6EUPOmq4qK6tk/BwzbuT+JBPTvcRsrK/CJb+sncSM2Whm43RbjWKm1M M1l4fUFm0GHwdcBqxe6xcsQP7Ni6ztxhB4yO+6kGO598tsKx9dQewSAVtb2CwvJSrm wmyco/F/ThaIVPTmeu/MWUCUSQl50bf3Jg1DJMDVe8g84YZfsYh51HTXhKsags0wqc tJwTp1ypD7mg5nbEQCxN4lEew3gMjQC7I+VymDbsq0IFKmK3C57uGYQzGU17u1gZTk aOn14mVEzQc0g== From: Frederic Weisbecker To: LKML Cc: "Paul E. McKenney" , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , Steven Rostedt , Uladzislau Rezki , Zqiang , rcu , Frederic Weisbecker Subject: [PATCH 1/6] torture: Add --no-affinity parameter to kvm.sh Date: Wed, 6 Nov 2024 17:02:18 +0100 Message-ID: <20241106160223.42119-2-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241106160223.42119-1-frederic@kernel.org> References: <20241106160223.42119-1-frederic@kernel.org> 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: "Paul E. McKenney" In performance tests, it can be counter-productive to spread torture-test guest OSes across sockets. Plus the experimenter might have ideas about what CPUs individual guest OSes are to run on. This commit therefore adds a --no-affinity parameter to kvm.sh to prevent it from running taskset on its guest OSes. Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay --- .../rcutorture/bin/kvm-test-1-run-batch.sh | 43 ++++++++++--------- tools/testing/selftests/rcutorture/bin/kvm.sh | 6 +++ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-batch.sh= b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-batch.sh index c3808c490d92..f87046b702d8 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-batch.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-batch.sh @@ -56,27 +56,30 @@ do echo > $i/kvm-test-1-run-qemu.sh.out export TORTURE_AFFINITY=3D kvm-get-cpus-script.sh $T/cpuarray.awk $T/cpubatches.awk $T/cpustate - cat << ' ___EOF___' >> $T/cpubatches.awk - END { - affinitylist =3D ""; - if (!gotcpus()) { - print "echo No CPU-affinity information, so no taskset command."; - } else if (cpu_count !~ /^[0-9][0-9]*$/) { - print "echo " scenario ": Bogus number of CPUs (old qemu-cmd?), so no t= askset command."; - } else { - affinitylist =3D nextcpus(cpu_count); - if (!(affinitylist ~ /^[0-9,-][0-9,-]*$/)) - print "echo " scenario ": Bogus CPU-affinity information, so no taskse= t command."; - else if (!dumpcpustate()) - print "echo " scenario ": Could not dump state, so no taskset command.= "; - else - print "export TORTURE_AFFINITY=3D" affinitylist; + if test -z "${TORTURE_NO_AFFINITY}" + then + cat << ' ___EOF___' >> $T/cpubatches.awk + END { + affinitylist =3D ""; + if (!gotcpus()) { + print "echo No CPU-affinity information, so no taskset command."; + } else if (cpu_count !~ /^[0-9][0-9]*$/) { + print "echo " scenario ": Bogus number of CPUs (old qemu-cmd?), so no = taskset command."; + } else { + affinitylist =3D nextcpus(cpu_count); + if (!(affinitylist ~ /^[0-9,-][0-9,-]*$/)) + print "echo " scenario ": Bogus CPU-affinity information, so no tasks= et command."; + else if (!dumpcpustate()) + print "echo " scenario ": Could not dump state, so no taskset command= ."; + else + print "export TORTURE_AFFINITY=3D" affinitylist; + } } - } - ___EOF___ - cpu_count=3D"`grep '# TORTURE_CPU_COUNT=3D' $i/qemu-cmd | sed -e 's/^.*= =3D//'`" - affinity_export=3D"`awk -f $T/cpubatches.awk -v cpu_count=3D"$cpu_count" = -v scenario=3D$i < /dev/null`" - $affinity_export + ___EOF___ + cpu_count=3D"`grep '# TORTURE_CPU_COUNT=3D' $i/qemu-cmd | sed -e 's/^.*= =3D//'`" + affinity_export=3D"`awk -f $T/cpubatches.awk -v cpu_count=3D"$cpu_count"= -v scenario=3D$i < /dev/null`" + $affinity_export + fi kvm-test-1-run-qemu.sh $i >> $i/kvm-test-1-run-qemu.sh.out 2>&1 & done for i in $runfiles diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/= selftests/rcutorture/bin/kvm.sh index 7af73ddc148d..42e5e8597a1a 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm.sh @@ -42,6 +42,7 @@ TORTURE_JITTER_STOP=3D"" TORTURE_KCONFIG_KASAN_ARG=3D"" TORTURE_KCONFIG_KCSAN_ARG=3D"" TORTURE_KMAKE_ARG=3D"" +TORTURE_NO_AFFINITY=3D"" TORTURE_QEMU_MEM=3D512 torture_qemu_mem_default=3D1 TORTURE_REMOTE=3D @@ -82,6 +83,7 @@ usage () { echo " --kmake-arg kernel-make-arguments" echo " --mac nn:nn:nn:nn:nn:nn" echo " --memory megabytes|nnnG" + echo " --no-affinity" echo " --no-initrd" echo " --qemu-args qemu-arguments" echo " --qemu-cmd qemu-system-..." @@ -220,6 +222,9 @@ do torture_qemu_mem_default=3D shift ;; + --no-affinity) + TORTURE_NO_AFFINITY=3D"no-affinity" + ;; --no-initrd) TORTURE_INITRD=3D""; export TORTURE_INITRD ;; @@ -417,6 +422,7 @@ TORTURE_KCONFIG_KASAN_ARG=3D"$TORTURE_KCONFIG_KASAN_ARG= "; export TORTURE_KCONFIG_K TORTURE_KCONFIG_KCSAN_ARG=3D"$TORTURE_KCONFIG_KCSAN_ARG"; export TORTURE_K= CONFIG_KCSAN_ARG TORTURE_KMAKE_ARG=3D"$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG TORTURE_MOD=3D"$TORTURE_MOD"; export TORTURE_MOD +TORTURE_NO_AFFINITY=3D"$TORTURE_NO_AFFINITY"; export TORTURE_NO_AFFINITY TORTURE_QEMU_CMD=3D"$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD TORTURE_QEMU_INTERACTIVE=3D"$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEM= U_INTERACTIVE TORTURE_QEMU_MAC=3D"$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC --=20 2.46.0 From nobody Sun Nov 24 07:41:24 2024 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 C585C20513B; Wed, 6 Nov 2024 16:02:35 +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=1730908955; cv=none; b=o0zof2dR9+8uV7qKMHU19reswJefeq1t6GFtMBwMN+a+5KL7j0vEqKZGF21SoOLBL81DiBZLPdOX6ACGjGePfa52uy5Us77O6mvo1zZmzv4gUGIXnPapl9W815YyF08pup/rDbK/kQw7UQGPBuqZKs+2okqf8PfeGIKOXvKDtKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730908955; c=relaxed/simple; bh=6zHhX5oEUV07uCHmS2wHkHIVA45QcuRfPVXY/4+AqIM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ofwN0R/ICjTmxR4mZybupYrK96ZxxrnfwU13jejcxE06AD9QDZpIuFgctGVohSkozxzGtMYKAWIvcjFtuj9kMQyJbBNGHUrNHd6Ufqvga/MPRZ1+pSC6T8xDAwUM5rHee5HW9bZh44rSwqb0yVh3vwzL1n4iMKPKMNKRbLCJiFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rLgv/L4c; 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="rLgv/L4c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07225C4CEC6; Wed, 6 Nov 2024 16:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730908955; bh=6zHhX5oEUV07uCHmS2wHkHIVA45QcuRfPVXY/4+AqIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLgv/L4cQ/MT+RuGQb6RC0ySq7ycR/3QqC4MO00q4nHebaneyMBP5UlMkhmLvvySh jVgcV9ac2xhR804X12jaDBI4a/kLIHRfTxFfAjQNccLSB/ViOGPPJyyz2LP7c5EECm WhK9NnK+Ojw/u8Atb6uqScuBEcZWMNPXlXjEoyNyWxG9LtOes0A5PkO/oZpO8Q+KeT PJqEgMcV1LqQczEVb/U7B/j09GTmEVsH6u401hXJTAaSDaydjsbcjhojGj8EDU4s/Q oEiavRCR09EQgTjJryajExQTBFdcV4giENRsmpDEAffPNBjpZiIFC5772qQn6FCGLq nGtdwASCRyCQA== From: Frederic Weisbecker To: LKML Cc: "Paul E. McKenney" , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , Steven Rostedt , Uladzislau Rezki , Zqiang , rcu , Frederic Weisbecker Subject: [PATCH 2/6] refscale: Correct affinity check Date: Wed, 6 Nov 2024 17:02:19 +0100 Message-ID: <20241106160223.42119-3-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241106160223.42119-1-frederic@kernel.org> References: <20241106160223.42119-1-frederic@kernel.org> 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: "Paul E. McKenney" The current affinity check works fine until there are more reader processes than CPUs, at which point the affinity check is looking for non-existent CPUs. This commit therefore applies the same modulus to the check as is present in the set_cpus_allowed_ptr() call. Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay --- 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 0db9db73f57f..25910ebe95c0 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -829,7 +829,7 @@ ref_scale_reader(void *arg) goto end; =20 // Make sure that the CPU is affinitized appropriately during testing. - WARN_ON_ONCE(raw_smp_processor_id() !=3D me); + WARN_ON_ONCE(raw_smp_processor_id() !=3D me % nr_cpu_ids); =20 WRITE_ONCE(rt->start_reader, 0); if (!atomic_dec_return(&n_started)) --=20 2.46.0 From nobody Sun Nov 24 07:41:24 2024 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 BA1FB205E2D; Wed, 6 Nov 2024 16:02:38 +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=1730908958; cv=none; b=hxX/aS3MOZBzQak6EyA6mD93ywCQNPB96JkH6SetglQ69RpiwM4xu14LgBYeHdtoHVjpz+HZHSdR5bDWwDDtOwjyZ2CMryL2XAG0aVM/jlLNa/c2y9srt46MwpdEfdkugBZFllMBfxfhbvZZ6LiOKwGEWfEIJKrL8rzRwEoOGto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730908958; c=relaxed/simple; bh=zfmB69Z3xb3CVeThnzwQWB10ZhWTFdBu117CVg5FG/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TC/QF9GPJ18NujXyLGalYEQYSVRhF3yGKebRRXO8MeNlf4pYsNggOjD0Xue4vZ7HaoTZJjYPR8yuWqhNuqlpd7cDbvq/oJvj0EJtzX7/Xw5haI84Ut+ZDjJ1yThdxcI2Os4N9vQVlzkIDuKK9vnLTDJ/6D49X0FOPoUBHsiyQB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=US3V2bxN; 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="US3V2bxN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6396C4CED6; Wed, 6 Nov 2024 16:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730908958; bh=zfmB69Z3xb3CVeThnzwQWB10ZhWTFdBu117CVg5FG/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=US3V2bxNdIcig1wbdN+HySmruVB8hPDXtM5nntafT1NgPz6BofWBWeDtMh911JaVX pE3xrd/On3iWHRu623V2OMrfoj8D1BvulvJwMRysquB/hsYzqMOFq4m+tDBNXVqDM1 hReXw6tPEag6+1UWvoHoBB4DPEatnLtdJGxFz5bd0jNYctf741aJ+glllZBZ90YVMh uMq/VrUUbELRSoxyn5Y5hpXY36EfWjevdpC5cGo+N6IMqerSVUbU3fjHaP7w+fMQon aBMFDTXYZqJYsixOS5ZmFS+d6pgNA2jtuEXX+qZPepSW+LAKpZP929477fdf84wINK +/JHgtEVaUDKw== From: Frederic Weisbecker To: LKML Cc: "Paul E. McKenney" , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , Steven Rostedt , Uladzislau Rezki , Zqiang , rcu , Frederic Weisbecker Subject: [PATCH 3/6] rcuscale: Add guest_os_delay module parameter Date: Wed, 6 Nov 2024 17:02:20 +0100 Message-ID: <20241106160223.42119-4-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241106160223.42119-1-frederic@kernel.org> References: <20241106160223.42119-1-frederic@kernel.org> 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: "Paul E. McKenney" This commit adds a guest_os_delay module parameter that extends warm-up and cool-down the specified number of seconds before and after the series of test runs. This allows the data-collection intervals from any given rcuscale guest OSes to line up with active periods in the other rcuscale guest OSes, and also allows the thermal warm-up period required to obtain consistent results from one test to the next. Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay --- kernel/rcu/refscale.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index 25910ebe95c0..c8374760e003 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -75,6 +75,9 @@ MODULE_PARM_DESC(scale_type, "Type of test (rcu, srcu, re= fcnt, rwsem, rwlock."); torture_param(int, verbose, 0, "Enable verbose debugging printk()s"); torture_param(int, verbose_batched, 0, "Batch verbose debugging printk()s"= ); =20 +// Number of seconds to extend warm-up and cool-down for multiple guest OS= es +torture_param(long, guest_os_delay, 0, + "Number of seconds to extend warm-up/cool-down for multiple guest O= Ses."); // Wait until there are multiple CPUs before starting test. torture_param(int, holdoff, IS_BUILTIN(CONFIG_RCU_REF_SCALE_TEST) ? 10 : 0, "Holdoff time before test start (s)"); @@ -801,6 +804,18 @@ static void rcu_scale_one_reader(void) cur_ops->delaysection(loops, readdelay / 1000, readdelay % 1000); } =20 +// Warm up cache, or, if needed run a series of rcu_scale_one_reader() +// to allow multiple rcuscale guest OSes to collect mutually valid data. +static void rcu_scale_warm_cool(void) +{ + unsigned long jdone =3D jiffies + (guest_os_delay > 0 ? guest_os_delay * = HZ : -1); + + do { + rcu_scale_one_reader(); + cond_resched(); + } while (time_before(jiffies, jdone)); +} + // Reader kthread. Repeatedly does empty RCU read-side // critical section, minimizing update-side interference. static int @@ -957,6 +972,7 @@ static int main_func(void *arg) schedule_timeout_uninterruptible(1); =20 // Start exp readers up per experiment + rcu_scale_warm_cool(); for (exp =3D 0; exp < nruns && !torture_must_stop(); exp++) { if (torture_must_stop()) goto end; @@ -987,6 +1003,7 @@ static int main_func(void *arg) =20 result_avg[exp] =3D div_u64(1000 * process_durations(nreaders), nreaders= * loops); } + rcu_scale_warm_cool(); =20 // Print the average of all experiments SCALEOUT("END OF TEST. Calculating average duration per loop (nanoseconds= )...\n"); --=20 2.46.0 From nobody Sun Nov 24 07:41:24 2024 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 7F7022064F5; Wed, 6 Nov 2024 16:02:41 +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=1730908961; cv=none; b=K1YEphkw6kf7qycwP3bB1lFwHjQVSiSoeqx/vtNFOOFroC+rhIY7if4LoL1xlh5O6pJVvHYwyjuvK1MpJRGCkYYi1zNFQ59SB9oKeO2W+qxYLNOZt3zO1//BiYuOjqPMSlVxE45taSLF9lnockNqtPO2PpaawIh/m+0OV1U8DG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730908961; c=relaxed/simple; bh=4glDQSNUoXiax4XF8AjgBBQOPX1MeTdEr5B6E0keNH8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JFFBiggH5dLSCE+8x/FeQ9UfT6N43PkrF4L0PtQHsX3wEm4Z4GUQp0RrtO90S33qXO4lgiexp99YfySgyDKOolpyWLNGRF/T1u0gJzRbB2jjBwXFfEdYX78MLMJI7vF5y779/f+RirIyb3WUsTmY7I2nUwk7aObowfzo+dYbe+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FXLpXb1J; 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="FXLpXb1J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE061C4CED4; Wed, 6 Nov 2024 16:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730908961; bh=4glDQSNUoXiax4XF8AjgBBQOPX1MeTdEr5B6E0keNH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXLpXb1J6rVW/SuU/Gqadi2jhe22nOaPSsoC+PTIlHtR5nBDiY0G5GOYyPWta6RXo S7cEWf89VH/aDQzPKRzjywAUo+YZ1l2nJOu5qhu52HYB3FN/nHcSmnZUrwYh9nx6ZN obqGLnYSCsaiKRZV9PxwXneMgPMv/KsSJKGAC+RSSjdenkSCOoqzLz1bteX4vnQN3I cGfiHRKwaYqd4DqTV1y5AJH2RxZoXLl/U1Kcghz46wyt0iCw9PlqSH1Z+QAZQLXgLM +rL231KJC5usVG9EwX+P/RWI6b8Uu44gUMCOPUPUOrmnO2E1KZ00WNEzCrswJVlvak YqRbLkx8NNIzA== From: Frederic Weisbecker To: LKML Cc: "Paul E. McKenney" , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , Steven Rostedt , Uladzislau Rezki , Zqiang , rcu , Frederic Weisbecker Subject: [PATCH 4/6] rcutorture: Avoid printing cpu=-1 for no-fault RCU boost failure Date: Wed, 6 Nov 2024 17:02:21 +0100 Message-ID: <20241106160223.42119-5-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241106160223.42119-1-frederic@kernel.org> References: <20241106160223.42119-1-frederic@kernel.org> 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: "Paul E. McKenney" If a CPU runs throughout the stalled grace period without passing through a quiescent state, RCU priority boosting cannot help. The rcu_torture_boost_failed() function therefore prints a message flagging the first such CPU. However, if the stall was instead due to (for example) RCU's grace-period kthread being starved of CPU, there will be no such CPU, causing rcu_check_boost_fail() to instead pass back -1 through its cpup CPU-pointer parameter. Therefore, the current message complains about a mythical CPU -1. This commit therefore checks for this situation, and notes that all CPUs have passed through a quiescent state. Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay --- kernel/rcu/rcutorture.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index bb75dbf5c800..e92fa97fc76f 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1059,8 +1059,13 @@ static bool rcu_torture_boost_failed(unsigned long g= p_state, unsigned long *star // At most one persisted message per boost test. j =3D jiffies; lp =3D READ_ONCE(last_persist); - if (time_after(j, lp + mininterval) && cmpxchg(&last_persist, lp, j) = =3D=3D lp) - pr_info("Boost inversion persisted: No QS from CPU %d\n", cpu); + if (time_after(j, lp + mininterval) && + cmpxchg(&last_persist, lp, j) =3D=3D lp) { + if (cpu < 0) + pr_info("Boost inversion persisted: QS from all CPUs\n"); + else + pr_info("Boost inversion persisted: No QS from CPU %d\n", cpu); + } return false; // passed on a technicality } VERBOSE_TOROUT_STRING("rcu_torture_boost boosting failed"); --=20 2.46.0 From nobody Sun Nov 24 07:41:24 2024 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 2B465206970; Wed, 6 Nov 2024 16:02:44 +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=1730908964; cv=none; b=WjZ/vibkXEHsKxsPz/2976IsxzZIHihy8HI06eljyLcz4sv+vY/3Gi1RaiX+aXMqlaF+ZKu4cDcn1nYxhLtDuhCdgXV1yZp1HeEm2UXPlK+O1MuKYxO0I4Gdl8iQB3LQN1STyLf9XriUWlbAxgZ5E1AeQLbcennOgTKyAeI8s8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730908964; c=relaxed/simple; bh=rhYeUBB/n91//oTPNUiqguVr/Wrp4228mhfdTnKKsC4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cq0scMs2kLKw3UFybpHQCrQN7SVxBMhSZEakzG9Bqe8unksIuFL8qR3lZg5/fXBK7vplh+7jh5NS1o0F0uprPNx6GHSFRQqPimgwQ/d9t8ICdPK91oCWyVBSVRDR0CRL/KLIzSYeT9I9qgr+3MddLmP5xFjze0HaKWPvG7HEhtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BPmToyHE; 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="BPmToyHE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74077C4CECD; Wed, 6 Nov 2024 16:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730908964; bh=rhYeUBB/n91//oTPNUiqguVr/Wrp4228mhfdTnKKsC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BPmToyHE8ScyzXvhV1M8DWPs/LIrWMm48yT8CJARVZhLBQ9xF4aYzpxJA426U+WVp gp7+weV/Dp6rbUpU23pgS7pAdMj3aK1IgwEOVVy4a3I61sqvfV/ySpgOV0dLmtaTcw kWmb9NbqI0wO0qmAPfdwIbbrNnrbcol306h65Ml11AXU7CCLx6IbZT98JHZLI66qu1 HkRol5XxL1//+rHRBndYaNn2O4Cl2GWt7+tJmSI2s2EMLNjKTMEXbEvekGK8YJbUeT vOMcPjEi8RExwEMdH8lJobX+saqXDJ2OA38ipKk/w0OroXqCr6ULysR573pgvI74Xc lUEggRdYT4Qvg== From: Frederic Weisbecker To: LKML Cc: "Uladzislau Rezki (Sony)" , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Zqiang , rcu , Dan Carpenter , Frederic Weisbecker Subject: [PATCH 5/6] rcuscale: Do a proper cleanup if kfree_scale_init() fails Date: Wed, 6 Nov 2024 17:02:22 +0100 Message-ID: <20241106160223.42119-6-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241106160223.42119-1-frederic@kernel.org> References: <20241106160223.42119-1-frederic@kernel.org> 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: "Uladzislau Rezki (Sony)" A static analyzer for C, Smatch, reports and triggers below warnings: kernel/rcu/rcuscale.c:1215 rcu_scale_init() warn: inconsistent returns 'global &fullstop_mutex'. The checker complains about, we do not unlock the "fullstop_mutex" mutex, in case of hitting below error path: ... if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) { pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n"); WARN_ON_ONCE(1); return -1; ^^^^^^^^^^ ... it happens because "-1" is returned right away instead of doing a proper unwinding. Fix it by jumping to "unwind" label instead of returning -1. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/rcu/ZxfTrHuEGtgnOYWp@pc636/T/ Fixes: 084e04fff160 ("rcuscale: Add laziness and kfree tests") Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay --- kernel/rcu/rcuscale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index 6d37596deb1f..de7d511e6be4 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -890,13 +890,13 @@ kfree_scale_init(void) if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) { pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n"); WARN_ON_ONCE(1); - return -1; + goto unwind; } =20 if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start > 3 * HZ)) { pr_alert("ERROR: call_rcu() CBs are being too lazy!\n"); WARN_ON_ONCE(1); - return -1; + goto unwind; } } =20 --=20 2.46.0 From nobody Sun Nov 24 07:41:24 2024 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 358CA204F74; Wed, 6 Nov 2024 16:02:46 +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=1730908967; cv=none; b=LJDAQQyCz3yPVuufAR4mHeSTz63ZNgDwJXPD0W/4xDXvUZshSBK1RTt5kQ7enF2yAxgbtQwJ/eB88MtwIGmjhSvYE4tzX0ijcQCaHxbuI2OV0zoMjS+ZKbxt24lgZUAPDkaBrSUag2r4yTAHcZq/0hR0fT8TpYhAR7HvPpbYY7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730908967; c=relaxed/simple; bh=GS00MQQCCGQlMrETLu2vYuH9LgO7xjhv1AVBlgrtGuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F9KcbhjMmXKvhgF//3WeF3wIVQ/tSko0/3bYskOlZgXDyjyfx8kbAsDz+khhgcK7gN6+pADEPQJJMvrH8R/ogJchcgaNkyBY3DkkyCkbOdwbtoD2SYcZ9GVG7axhXFT3fbCkeye+teWbEpGB3fHkvdpGqrOvw0Z8XRdvDDHTJL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VLjhsDnZ; 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="VLjhsDnZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A6C8C4CECD; Wed, 6 Nov 2024 16:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730908966; bh=GS00MQQCCGQlMrETLu2vYuH9LgO7xjhv1AVBlgrtGuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VLjhsDnZqFUJKv0ayRfHLtfvJxEVksGPtcJVXavCP5xvq/QtoAuIjcT+I4kvLUNOc rtf6Rz7pt9p/IugddARHP0TzS16nX4SZWJkltoLqWaRryAujVfDO8nVZm1J2yo5GWj LxUl2B/DSdcU0viLFca6t1T6m356UGug6zUTd+F/dPd6z8ArUhKAAVgvSIenYQMKc3 TmCFad/pT94so2ZjqBqckzJaHPiwBEetNjoVRkWO88GnMwWx3/OiKYL9sJ4iLZSMtr 8Jl9LvypemSiJvGRo90ZZGd5qS12J6RupJYyN7k19ZJeTZhtsUWwTlOfwYTu2SzSpV rfhqeiVv6htnA== From: Frederic Weisbecker To: LKML Cc: "Uladzislau Rezki (Sony)" , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Zqiang , rcu , Frederic Weisbecker Subject: [PATCH 6/6] rcuscale: Remove redundant WARN_ON_ONCE() splat Date: Wed, 6 Nov 2024 17:02:23 +0100 Message-ID: <20241106160223.42119-7-frederic@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241106160223.42119-1-frederic@kernel.org> References: <20241106160223.42119-1-frederic@kernel.org> 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: "Uladzislau Rezki (Sony)" There are two places where WARN_ON_ONCE() is called two times in the error paths. One which is encapsulated into if() condition and another one, which is unnecessary, is placed in the brackets. Remove an extra WARN_ON_ONCE() splat which is in brackets. Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay --- kernel/rcu/rcuscale.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index de7d511e6be4..1d8bb603c289 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -889,13 +889,11 @@ kfree_scale_init(void) =20 if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) { pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n"); - WARN_ON_ONCE(1); goto unwind; } =20 if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start > 3 * HZ)) { pr_alert("ERROR: call_rcu() CBs are being too lazy!\n"); - WARN_ON_ONCE(1); goto unwind; } } --=20 2.46.0