From patchwork Thu Jan 16 20:24:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942261 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 5337F2442E4; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=KHLHP4ishJ1K9huyEDMv1DIVGf+7KwNpg7PxsNzSeSE4/S6Ni2s/ORF32LASsrZrdru+K2kA/XmvQJgXRPLJaSz5s0aDIa42mpC/SEA4QjpiyKibwMPgyiyCfrXgbwPGfBnLWh4f5aKHifAd6GM6ZhbPsPxS3U+moilm2UbTU3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=sNsrlG0xwaUm9vOI/jxEuBiUxmOvuWV5gFJh0f+cF64=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dg8fsUZkCbYZI4NQnYKFKUgjj6Ktddy0/xcjS7hcuhmBgLaeoZZ7DLAMfLuGGG6nrnXtTEuZ6nAy67oWr/1r20bj9ITK5qDY7yYYrkmuBIHKzJW8jWF117OnC3eLcwT9SXM10wpSue4lEf9mGVGX2TyDpnpcNp4BJ/9Y1r728mU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fIdX5y9S; 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="fIdX5y9S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FBAC4CED6; Thu, 16 Jan 2025 20:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059075; bh=sNsrlG0xwaUm9vOI/jxEuBiUxmOvuWV5gFJh0f+cF64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIdX5y9Sjb3ozn3k395jgeSOFcYZ1sOqUoIC60yrVXwmQskLoROov4ZZrlStW6VVn MKhwm+Zw/7DorKMO77CDVrXG8+ymlegI4+crF4BwW/19QCCYEqFcCgHjGk+LjM83Mt lztnirgrLiL3bCccX4ADwzRKsZJWpn/EX/z8hXGrqu00OimY8ilTDRABLqKrNXtlU3 SGzweZ9U870fG/7y1Vr0WndAabyWEJq7MALNjlWeLfR7j5JAs5gx9J1KT4GydS3GnL nA/Sj8kXHTlKpZt43/R//+4brgyaBqiHQZhyJ2csJK/5NJGoZn1TiljzUUrlZxRNWw wkoCKa9nJT0pA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A1383CE13C4; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 01/11] torture: Add get_torture_init_jiffies() for test-start time Date: Thu, 16 Jan 2025 12:24:24 -0800 Message-Id: <20250116202434.3783613-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit adds a get_torture_init_jiffies() function that returns the value of the jiffies counter at the start of the test, that is, at the point where torture_init_begin() was invoked. This will be used to enable torture-test holdoffs for tests implemented using per-CPU kthreads, which are created and deleted by CPU-hotplug operations, and thus (unlike normal kthreads) don't automatically know when the test started. Signed-off-by: Paul E. McKenney --- include/linux/torture.h | 1 + kernel/torture.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/linux/torture.h b/include/linux/torture.h index 0134e7221cae6..1b59056c3b182 100644 --- a/include/linux/torture.h +++ b/include/linux/torture.h @@ -104,6 +104,7 @@ int torture_stutter_init(int s, int sgap); /* Initialization and cleanup. */ bool torture_init_begin(char *ttype, int v); void torture_init_end(void); +unsigned long get_torture_init_jiffies(void); bool torture_cleanup_begin(void); void torture_cleanup_end(void); bool torture_must_stop(void); diff --git a/kernel/torture.c b/kernel/torture.c index dede150aef011..3a0a8cc604010 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -792,6 +792,8 @@ static void torture_stutter_cleanup(void) stutter_task = NULL; } +static unsigned long torture_init_jiffies; + static void torture_print_module_parms(void) { @@ -821,6 +823,7 @@ bool torture_init_begin(char *ttype, int v) torture_type = ttype; verbose = v; fullstop = FULLSTOP_DONTSTOP; + WRITE_ONCE(torture_init_jiffies, jiffies); // Lockless reads. torture_print_module_parms(); return true; } @@ -836,6 +839,15 @@ void torture_init_end(void) } EXPORT_SYMBOL_GPL(torture_init_end); +/* + * Get the torture_init_begin()-time value of the jiffies counter. + */ +unsigned long get_torture_init_jiffies(void) +{ + return READ_ONCE(torture_init_jiffies); +} +EXPORT_SYMBOL_GPL(get_torture_init_jiffies); + /* * Clean up torture module. Please note that this is -not- invoked via * the usual module_exit() mechanism, but rather by an explicit call from From patchwork Thu Jan 16 20:24:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942258 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 532172442E1; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=VM4Cr8U9hFHFGtObQHDf7+e0m5c182M+JqSIBApk38fb1x0IbqsX7fEopkM4Un0DSBZTBQ1qpHmIlRikkZh6YHiCXmR2zKvk5sJrZAyoYq62sY4xkV1pzy2vWs1dtBrFaFn60iHysehrk0VdCtCnqq50vSkOxHH1w7pQ4oASIG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=v8Vx57I2ULal+cNnM9rDZYU6BFWOj5CJDnMjBosdXCM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KY7yHdM0qB3zj/MGent42TFfnQWbjnTQEKXWL+uvJOMpfOITbrm+P0R1Kii6WpNt26Vw9vRj82jo7GIhZGNi2fugFZyd828mCln6LmDXs5skcLa8i++WV0AtjRDqxSvHqJLXa8iAmAy1325kDOI7KWePMkP/JZ3NLinuMe3cIhc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rv/4Sqb3; 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="Rv/4Sqb3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF462C4CEDD; Thu, 16 Jan 2025 20:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=v8Vx57I2ULal+cNnM9rDZYU6BFWOj5CJDnMjBosdXCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rv/4Sqb38mfK2/vvjID2IHO4Q2tv7cvDZcGKzfB70nikBijVb3TDwQFlgBfoduuOH H24v8O8qjG7hPW5UmPHmIghFccMqR6vDVmgyafRa17IePU01DpZ3s8Gmi++M1bAgv4 hbyUC2QtgMI1679gGhT7iSZWJmFvhV/Iim+7a6fH4IIj4ee9MJrP0siPd1vuxCXOj5 svhHCQRfOCoiR4O5ecaj8GTRpuR5GHp52lMt0LzF85y8Ds39kXE62iSE/dL2w+1ZJL eb2fpSbNTEIWYF44jROFJU3nuyE3RiIczqnVDiTvtZONkEhMA9hjurjZkfuUU06zrP jpfIoMcylWWKg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A37A6CE13C5; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 02/11] rcutorture: Add a test_boost_holdoff module parameter Date: Thu, 16 Jan 2025 12:24:25 -0800 Message-Id: <20250116202434.3783613-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit adds a test_boost_holdoff module parameter that tells the RCU priority-boosting tests to wait for the specified number of seconds past the start of the rcutorture test. This can be useful when rcutorture is built into the kernel (as opposed to being modprobed), especially on large systems where early start of RCU priority boosting can delay the boot sequence, which adds a full CPU's worth of load onto the system. This can in turn result in pointless stall warnings. Signed-off-by: Paul E. McKenney --- .../admin-guide/kernel-parameters.txt | 5 +++++ kernel/rcu/rcutorture.c | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 3152f2c1da294..d6c3f9d9d3a73 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5592,6 +5592,11 @@ rcutorture.test_boost_duration= [KNL] Duration (s) of each individual boost test. + rcutorture.test_boost_holdoff= [KNL] + Holdoff time (s) from start of test to the start + of RCU priority-boost testing. Defaults to zero, + that is, no holdoff. + rcutorture.test_boost_interval= [KNL] Interval (s) between each boost test. diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 1bd3eaa0b8e7a..9788933984655 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -135,6 +135,7 @@ torture_param(int, stat_interval, 60, "Number of seconds between stats printk()s torture_param(int, stutter, 5, "Number of seconds to run/halt test"); torture_param(int, test_boost, 1, "Test RCU prio boost: 0=no, 1=maybe, 2=yes."); torture_param(int, test_boost_duration, 4, "Duration of each boost test, seconds."); +torture_param(int, test_boost_holdoff, 0, "Holdoff time from rcutorture start, seconds."); torture_param(int, test_boost_interval, 7, "Interval between boost tests, seconds."); torture_param(int, test_nmis, 0, "End-test NMI tests, 0 to disable."); torture_param(bool, test_no_idle_hz, true, "Test support for tickless idle CPUs"); @@ -1159,8 +1160,19 @@ static int rcu_torture_boost(void *arg) unsigned long gp_state; unsigned long gp_state_time; unsigned long oldstarttime; + unsigned long booststarttime = get_torture_init_jiffies() + test_boost_holdoff * HZ; - VERBOSE_TOROUT_STRING("rcu_torture_boost started"); + if (test_boost_holdoff <= 0 || time_after(jiffies, booststarttime)) { + VERBOSE_TOROUT_STRING("rcu_torture_boost started"); + } else { + VERBOSE_TOROUT_STRING("rcu_torture_boost started holdoff period"); + while (time_before(jiffies, booststarttime)) { + schedule_timeout_idle(HZ); + if (kthread_should_stop()) + goto cleanup; + } + VERBOSE_TOROUT_STRING("rcu_torture_boost finished holdoff period"); + } /* Set real-time priority. */ sched_set_fifo_low(current); @@ -1236,6 +1248,7 @@ checkwait: if (stutter_wait("rcu_torture_boost")) sched_set_fifo_low(current); } while (!torture_must_stop()); +cleanup: /* Clean up and exit. */ while (!kthread_should_stop()) { torture_shutdown_absorb("rcu_torture_boost"); @@ -2523,7 +2536,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag) "shuffle_interval=%d stutter=%d irqreader=%d " "fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d " "test_boost=%d/%d test_boost_interval=%d " - "test_boost_duration=%d shutdown_secs=%d " + "test_boost_duration=%d test_boost_holdoff=%d shutdown_secs=%d " "stall_cpu=%d stall_cpu_holdoff=%d stall_cpu_irqsoff=%d " "stall_cpu_block=%d stall_cpu_repeat=%d " "n_barrier_cbs=%d " @@ -2537,7 +2550,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag) stat_interval, verbose, test_no_idle_hz, shuffle_interval, stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter, test_boost, cur_ops->can_boost, - test_boost_interval, test_boost_duration, shutdown_secs, + test_boost_interval, test_boost_duration, test_boost_holdoff, shutdown_secs, stall_cpu, stall_cpu_holdoff, stall_cpu_irqsoff, stall_cpu_block, stall_cpu_repeat, n_barrier_cbs, From patchwork Thu Jan 16 20:24:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942260 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 5327F2442E2; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=m2RVWQQOzY2qqCEwAE/ht+y23c4nJoeoP47fZJ1TeZgIxyPecEzgGSVnumdf/4OsPUuAxTxLNPVre+h26vfZa1RPhJ+q2eYJ8usjHeNpMeIqekzTwp3Cr31vsJfJwX5UUNGB2XmUOciI/Sml0EO5Nmu+1iqSUZhXPvxgDMiF+HQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=iWWKhZCpclRMeZhsYPmOufXD5RGtSeKrdZTXIAZscLg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eCsFXXDpIesmDhZT0V6XL30UcUKtiDumAo95mZA5yEKuXrJGDz09PjaKCW9gxUztFHEYEQs+eRkS+dd4JKJeNT1ZMeTiFOGxHZoLSfi6DCzeDPC4jcgklHAzyFvmhwy+6uoTkvpkvytn74Dhk4DEOL4UqJsAQnsiFFDqWq5zH6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=go5YKibP; 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="go5YKibP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0974FC4CEDF; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=iWWKhZCpclRMeZhsYPmOufXD5RGtSeKrdZTXIAZscLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=go5YKibPCx7L1LeYzN6ERdnBUQJCj+oC6izEos4IyxeRWKIORKylz6+wtvmRY882L 5NoWAIxqN5F+sthElV9dzOskzmgBl26P1MjEdrt6iHOVUFUg51HH4p/EiqUWeZVMSj ZY/UFZPO5+hnjEJiMSPDgq33M2tu1kdNKanN545DnE+E4/J93wVm3USAu2Ee/EXUgb itiM75X9Zsq6IRXbrEG5HTg3jJ1XD2oaFYouO06E+xfW+m75VfeCSBdtEWpYa2MvgA GA8GfAHC7JydvbA0rysTVE3IEX42pyj+su8NtGhbZE5lG0zM2WUyyv/2NrpRjoeZdd sonc368/8eLtQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A5E81CE37B4; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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" , kernel test robot Subject: [PATCH rcu 03/11] rcutorture: Include grace-period sequence numbers in failure/close-call Date: Thu, 16 Jan 2025 12:24:26 -0800 Message-Id: <20250116202434.3783613-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit includes the grace-period sequence numbers at the beginning and end of each segment in the "Failure/close-call rcutorture reader segments" list. These are in hexadecimal, and only the bottom byte. Currently, only RCU is supported, with its three sequence numbers (normal, expedited, and polled). Note that if all the grace-period sequence numbers remain the same across a given reader segement, only one copy of the number will be printed. Of course, if there is a change, both sets of values will be printed. Because the overhead of collecting this information can suppress heisenbugs, this information is collected and printed only in kernels built with CONFIG_RCU_TORTURE_TEST_LOG_GP=y. [ paulmck: Apply Nathan Chancellor feedback for IS_ENABLED(). ] [ paulmck: Apply feedback from kernel test robot. ] Signed-off-by: Paul E. McKenney Tested-by: kernel test robot --- kernel/rcu/Kconfig.debug | 14 ++++++++++++++ kernel/rcu/rcu.h | 2 ++ kernel/rcu/rcutorture.c | 34 ++++++++++++++++++++++++++++++++++ kernel/rcu/tiny.c | 14 ++++++++++++++ kernel/rcu/tree.c | 20 ++++++++++++++++++++ 5 files changed, 84 insertions(+) diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug index 6af90510a1ca7..25a9dc2be0dcd 100644 --- a/kernel/rcu/Kconfig.debug +++ b/kernel/rcu/Kconfig.debug @@ -84,6 +84,20 @@ config RCU_TORTURE_TEST_LOG_CPU Say Y here if you want CPU IDs logged. Say N if you are unsure. +config RCU_TORTURE_TEST_LOG_GP + bool "Log grace-period numbers for rcutorture failures" + depends on RCU_TORTURE_TEST + default n + help + This option causes rcutorture to decorate each entry of its + log of failure/close-call rcutorture reader segments with the + corresponding grace-period sequence numbers. This information + can be useful, but it does incur additional overhead, overhead + that can make both failures and close calls less probable. + + Say Y here if you want grace-period sequence numbers logged. + Say N if you are unsure. + config RCU_REF_SCALE_TEST tristate "Scalability tests for read-side synchronization (RCU and others)" depends on DEBUG_KERNEL diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index f6fcf87d91395..7c14eec7c13ae 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -590,6 +590,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename, #endif static inline void rcu_gp_set_torture_wait(int duration) { } #endif +unsigned long rcutorture_gather_gp_seqs(void); +void rcutorture_format_gp_seqs(unsigned long seqs, char *cp); #ifdef CONFIG_TINY_SRCU diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 9788933984655..7af7de1688466 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -273,6 +273,8 @@ struct rt_read_seg { bool rt_preempted; int rt_cpu; int rt_end_cpu; + unsigned long rt_gp_seq; + unsigned long rt_gp_seq_end; }; static int err_segs_recorded; static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS]; @@ -407,6 +409,8 @@ struct rcu_torture_ops { void (*gp_slow_register)(atomic_t *rgssp); void (*gp_slow_unregister)(atomic_t *rgssp); bool (*reader_blocked)(void); + unsigned long (*gather_gp_seqs)(void); + void (*format_gp_seqs)(unsigned long seqs, char *cp); long cbflood_max; int irq_capable; int can_boost; @@ -611,6 +615,8 @@ static struct rcu_torture_ops rcu_ops = { .reader_blocked = IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU) ? has_rcu_reader_blocked : NULL, + .gather_gp_seqs = rcutorture_gather_gp_seqs, + .format_gp_seqs = rcutorture_format_gp_seqs, .irq_capable = 1, .can_boost = IS_ENABLED(CONFIG_RCU_BOOST), .extendables = RCUTORTURE_MAX_EXTEND, @@ -656,6 +662,8 @@ static struct rcu_torture_ops rcu_busted_ops = { .sync = synchronize_rcu_busted, .exp_sync = synchronize_rcu_busted, .call = call_rcu_busted, + .gather_gp_seqs = rcutorture_gather_gp_seqs, + .format_gp_seqs = rcutorture_format_gp_seqs, .irq_capable = 1, .extendables = RCUTORTURE_MAX_EXTEND, .name = "busted" @@ -1989,6 +1997,12 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq, rtrsp[-1].rt_preempted = cur_ops->reader_blocked(); } } + // Sample grace-period sequence number, as good a place as any. + if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_GP) && cur_ops->gather_gp_seqs) { + rtrsp->rt_gp_seq = cur_ops->gather_gp_seqs(); + if (!first) + rtrsp[-1].rt_gp_seq_end = rtrsp->rt_gp_seq; + } /* * Next, remove old protection, in decreasing order of strength @@ -3577,6 +3591,7 @@ rcu_torture_cleanup(void) int flags = 0; unsigned long gp_seq = 0; int i; + int j; if (torture_cleanup_begin()) { if (cur_ops->cb_barrier != NULL) { @@ -3672,6 +3687,25 @@ rcu_torture_cleanup(void) else pr_cont(" ..."); } + if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_GP) && + cur_ops->gather_gp_seqs && cur_ops->format_gp_seqs) { + char buf1[16+1]; + char buf2[16+1]; + char sepchar = '-'; + + cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq, buf1); + cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq_end, buf2); + if (err_segs[i].rt_gp_seq == err_segs[i].rt_gp_seq_end) { + if (buf2[0]) { + for (j = 0; buf2[j]; j++) + buf2[j] = '.'; + if (j) + buf2[j - 1] = ' '; + } + sepchar = ' '; + } + pr_cont(" %s%c%s", buf1, sepchar, buf2); + } if (err_segs[i].rt_delay_ms != 0) { pr_cont(" %s%ldms", firsttime ? "" : "+", err_segs[i].rt_delay_ms); diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c index b3b3ce34df631..773944257e796 100644 --- a/kernel/rcu/tiny.c +++ b/kernel/rcu/tiny.c @@ -257,6 +257,20 @@ void kvfree_call_rcu(struct rcu_head *head, void *ptr) EXPORT_SYMBOL_GPL(kvfree_call_rcu); #endif +#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) +unsigned long rcutorture_gather_gp_seqs(void) +{ + return READ_ONCE(rcu_ctrlblk.gp_seq) & 0xff; +} +EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs); + +void rcutorture_format_gp_seqs(unsigned long seqs, char *cp) +{ + snprintf(cp, 8, "g%02lx", seqs & 0xff); +} +EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs); +#endif + void __init rcu_init(void) { open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 9ba34206e20d2..574a280660624 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -559,6 +559,26 @@ void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq) } EXPORT_SYMBOL_GPL(rcutorture_get_gp_data); +/* Gather grace-period sequence numbers for rcutorture diagnostics. */ +unsigned long rcutorture_gather_gp_seqs(void) +{ + return ((READ_ONCE(rcu_state.gp_seq) & 0xff) << 16) | + ((READ_ONCE(rcu_state.expedited_sequence) & 0xff) << 8) | + (READ_ONCE(rcu_state.gp_seq_polled) & 0xff); +} +EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs); + +/* Format grace-period sequence numbers for rcutorture diagnostics. */ +void rcutorture_format_gp_seqs(unsigned long seqs, char *cp) +{ + unsigned int egp = (seqs >> 8) & 0xff; + unsigned int ggp = (seqs >> 16) & 0xff; + unsigned int pgp = seqs & 0xff; + + snprintf(cp, 16, "g%02x:e%02x:p%02x", ggp, egp, pgp); +} +EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs); + #if defined(CONFIG_NO_HZ_FULL) && (!defined(CONFIG_GENERIC_ENTRY) || !defined(CONFIG_KVM_XFER_TO_GUEST_WORK)) /* * An empty function that will trigger a reschedule on From patchwork Thu Jan 16 20:24:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942259 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 532DD2442E3; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=AsP7PcvUIwhJA4/dYrbmZLOxxgl3bBZxhgDdgJIMRSVi8ox9Hzd4UUwtSVMM+rPRjzGywoNJLOVoevQcchkxAn4VKNpRdYpFeZuqD7pnaxdDQn8+fNLrnFacdB6CEfr0Ze+YW7hTb2+7WlJLVP9kVffusZhUTa3UOEo9miZuXzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=CllbxRXuakn5RgpA5sgvez+XvWvb/koD6YasIx7YiYc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=biCwwqLV/YauNYKJepmGDkwdF6eRVSfDkVEkrukL8RiEZIv4JqD5pEiBKZGIoLV81kbMPuFnrGUfOqfFd/IF03GY/Jd942iu0u6ovJAcV95Sn7X/ILR0373qWcYg+U+rZJAREIwcVcpxY3Jb1+KVpi7EqzQgh/0WfA4gem1/cW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K50YDFtO; 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="K50YDFtO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BD57C4CEE5; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=CllbxRXuakn5RgpA5sgvez+XvWvb/koD6YasIx7YiYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K50YDFtOGWyFzEAMxOo1OxhtWuR/FnjIELFE0Jj8pWxOyzmQPMttJoM+wSQ1s2pCm L1H5NInuXT9kPqCdN6/knFmHP4Ckdr210BogzUwuYpfYZnwX7ZgDc82oHzMHff0OLZ TeZ4EmPx4UHwdbkGC1STIgEL0Wed9UNhO0DNneviUimyiBO7HrwihfoBLy/wf6ueEL 7PMsH+Anvr6E5uOnfB0bCGln3CrtNnFB/4gF1by5TV2LwbKBO7dUqdEVChkrMQQJfA 4xX/L6gMXA29Fo56GPfzga1PGdy/nRY+eVuw92vjbAF5JGHL4iGkW+WZy322ZQndr6 SpV7G/dbt93VA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A80F7CE37B6; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 04/11] rcutorture: Expand failure/close-call grace-period output Date: Thu, 16 Jan 2025 12:24:27 -0800 Message-Id: <20250116202434.3783613-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 With only eight bits per grace-period sequence number, wrap can happen in 64 grace periods. This commit therefore increases this to sixteen bits for normal grace-period sequence numbers and the combined short-form polling sequence numbers, thus deferring wrap for at least 16,384 grace periods. Because expedited grace periods go faster, expand these to 24 bits, deferring wrap for at least 4,194,304 expedited grace periods. These longer wrap times makes it easier to correlate these numbers to trace-event output. Note that the low-order two bits are reserved for intra-grace-period state, hence the above wrap numbers being a factor of four smaller than you might expect. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcu.h | 4 ++-- kernel/rcu/rcutorture.c | 12 ++++++------ kernel/rcu/tiny.c | 8 ++++---- kernel/rcu/tree.c | 18 +++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index 7c14eec7c13ae..d2a91f705a4ab 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -590,8 +590,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename, #endif static inline void rcu_gp_set_torture_wait(int duration) { } #endif -unsigned long rcutorture_gather_gp_seqs(void); -void rcutorture_format_gp_seqs(unsigned long seqs, char *cp); +unsigned long long rcutorture_gather_gp_seqs(void); +void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp); #ifdef CONFIG_TINY_SRCU diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 7af7de1688466..5b0510c79fde7 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -273,8 +273,8 @@ struct rt_read_seg { bool rt_preempted; int rt_cpu; int rt_end_cpu; - unsigned long rt_gp_seq; - unsigned long rt_gp_seq_end; + unsigned long long rt_gp_seq; + unsigned long long rt_gp_seq_end; }; static int err_segs_recorded; static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS]; @@ -409,8 +409,8 @@ struct rcu_torture_ops { void (*gp_slow_register)(atomic_t *rgssp); void (*gp_slow_unregister)(atomic_t *rgssp); bool (*reader_blocked)(void); - unsigned long (*gather_gp_seqs)(void); - void (*format_gp_seqs)(unsigned long seqs, char *cp); + unsigned long long (*gather_gp_seqs)(void); + void (*format_gp_seqs)(unsigned long long seqs, char *cp); long cbflood_max; int irq_capable; int can_boost; @@ -3689,8 +3689,8 @@ rcu_torture_cleanup(void) } if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_GP) && cur_ops->gather_gp_seqs && cur_ops->format_gp_seqs) { - char buf1[16+1]; - char buf2[16+1]; + char buf1[20+1]; + char buf2[20+1]; char sepchar = '-'; cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq, buf1); diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c index 773944257e796..b97c64e99a905 100644 --- a/kernel/rcu/tiny.c +++ b/kernel/rcu/tiny.c @@ -258,15 +258,15 @@ EXPORT_SYMBOL_GPL(kvfree_call_rcu); #endif #if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) -unsigned long rcutorture_gather_gp_seqs(void) +unsigned long long rcutorture_gather_gp_seqs(void) { - return READ_ONCE(rcu_ctrlblk.gp_seq) & 0xff; + return READ_ONCE(rcu_ctrlblk.gp_seq) & 0xffffULL; } EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs); -void rcutorture_format_gp_seqs(unsigned long seqs, char *cp) +void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp) { - snprintf(cp, 8, "g%02lx", seqs & 0xff); + snprintf(cp, 8, "g%04llx", seqs & 0xffffULL); } EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs); #endif diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 574a280660624..ac596596e7717 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -560,22 +560,22 @@ void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq) EXPORT_SYMBOL_GPL(rcutorture_get_gp_data); /* Gather grace-period sequence numbers for rcutorture diagnostics. */ -unsigned long rcutorture_gather_gp_seqs(void) +unsigned long long rcutorture_gather_gp_seqs(void) { - return ((READ_ONCE(rcu_state.gp_seq) & 0xff) << 16) | - ((READ_ONCE(rcu_state.expedited_sequence) & 0xff) << 8) | - (READ_ONCE(rcu_state.gp_seq_polled) & 0xff); + return ((READ_ONCE(rcu_state.gp_seq) & 0xffffULL) << 40) | + ((READ_ONCE(rcu_state.expedited_sequence) & 0xffffffULL) << 16) | + (READ_ONCE(rcu_state.gp_seq_polled) & 0xffffULL); } EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs); /* Format grace-period sequence numbers for rcutorture diagnostics. */ -void rcutorture_format_gp_seqs(unsigned long seqs, char *cp) +void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp) { - unsigned int egp = (seqs >> 8) & 0xff; - unsigned int ggp = (seqs >> 16) & 0xff; - unsigned int pgp = seqs & 0xff; + unsigned int egp = (seqs >> 16) & 0xffffffULL; + unsigned int ggp = (seqs >> 40) & 0xffffULL; + unsigned int pgp = seqs & 0xffffULL; - snprintf(cp, 16, "g%02x:e%02x:p%02x", ggp, egp, pgp); + snprintf(cp, 20, "g%04x:e%06x:p%04x", ggp, egp, pgp); } EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs); From patchwork Thu Jan 16 20:24:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942262 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 7DA722442EB; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=RISzzMG0YKgbKS43yMAH6R0W+jEh1bd/f9NjvlPf158E++w0iOP1aNc00Q/wNJl5D/V3uX5RE004j5RLPj9P6K92wBuDfCTYA1Bey+PjSJg54UHFheYHJOdp+p/2M/Y1i2PaWklGdF9Hr0pw+0QSKLm6UksmtsVFDWd2atWlrhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=hN3ajggYm+37wd/iR3tlAlMEp4lIJ8U5kBMAt2Et/G8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uPI/OdQaSEHsj45TNRfmNR+D4n/FZsKDEPJNQK44WB25BEn+OaXACs36ABLAk+C+7McPRbS96GIZ/ATb+lcF0I3Lt63xkYaiHAlHAiVCI9n1GCvpK6w3v0XcnPW5QxKB0nK0olflGCzDfgzPEsYN8Eb3DJbm8lmEizbnbbL79Bo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q8mTWq8z; 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="Q8mTWq8z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C756C4CEE7; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=hN3ajggYm+37wd/iR3tlAlMEp4lIJ8U5kBMAt2Et/G8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8mTWq8z+Ll8Ppbz2cGxixSyiAVfSPGstPf91t2c+938C1xysfnYBViLgvPyjuQrT IddaaOMXSpXd/fCtChaE05075AX4b3XpdSNtU8Bf3/QHDKnbgrWkU8wBmUxHoqNqx5 wu/IMT1aCziNrOQd66BtROIHzLD4HN8z8Y0qgBbk5jgGBL753giFY1fFXNmGPVIsjZ aeAjalEMRQOpMrhg5DBPVDfxAdP/8CRQcY0BP8l4fOUxxTIpkgHK1zNA6xHWyOSZw0 YcS3PD5yhpCfIkVjyyjqFuUNE0iCtXkwYo8oOjILVZWvsuUADJR3YXD7JLh739ingd X0vbJ4TBTOocA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AA5BBCE37C1; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 05/11] rcu: Trace expedited grace-period numbers in hexadecimal Date: Thu, 16 Jan 2025 12:24:28 -0800 Message-Id: <20250116202434.3783613-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit reformats the expedited grace-period numbers into hexadecimal for easier decoding and comparison. The normal grace-period numbers remain in decimal for the time being. Signed-off-by: Paul E. McKenney --- include/trace/events/rcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index e81431deaa50b..63fd8aa99af7c 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h @@ -207,7 +207,7 @@ TRACE_EVENT_RCU(rcu_exp_grace_period, __entry->gpevent = gpevent; ), - TP_printk("%s %ld %s", + TP_printk("%s %#lx %s", __entry->rcuname, __entry->gpseq, __entry->gpevent) ); From patchwork Thu Jan 16 20:24:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942265 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 8E3612442F4; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=IT504komDN+MCdeAV6n9nagrnqjuund2lsHOw+c0M9N0p7ptw7pmzW4Zez2QX5uBVb7qALpzC06iE+4izCYPEsNTjgEL9D+II5SI4a+Kwbc+UCBmQxzj8XnZAtIaS3l8ikEfg04YvoKaR3QbPgY3N3JYEuHlEF9sAx+67E+nCjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=CjJgBFtsok54/lEjpFkXjT3UevRr3ESUhr7/3ZJSEJ4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tPAKv+yA8BzfB/1ea55pCZiVPnGcYUloJcn6wiwYTc1sIEciD2fVDifSB010u0khnfXtpVTrwZ2JRgMRBcqfPjcWSzj98TQV4TP2nLT2odkKujUaVq1SDRsONUZv/C43BB9QclaC8JfYfF3CdoUCnalnY1UTOd8NgWi9EY59/qc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Lvye994o; 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="Lvye994o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49E51C4CEEA; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=CjJgBFtsok54/lEjpFkXjT3UevRr3ESUhr7/3ZJSEJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lvye994oZbVVRkcJjzlOguMV/ZlWXqMgRh0ZJXOtRkPuTA80hEMbyrCuqmwJWs3YF MuhFHPv/FLMqDnpfOhOfGlUqPNlqIUYgnEDBxVYX18msz9Za+BUD7VZPb3908OMc9r ZYV77e3/lzkEPiPbd3bXQuxPkTMHMlHlo2uCYdXxjfxeGqcEafJHKcqQns/3Wauyqc mGQ7dFleTxu1o20qRFjUQlOOLehSYEnJsQmdxO72mfWR1KDZHq1VVD/3g8PQ2RGGE1 gsmdFhiILf8o+zAThze2yxIzVVv/dxQFvqbc9Oy3PT/ihOkakLbCPq9oVcM3AOjJO2 RMV6et8iK3+kQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AC814CE37C4; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 06/11] rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output Date: Thu, 16 Jan 2025 12:24:29 -0800 Message-Id: <20250116202434.3783613-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This commit adds an ftrace-compatible microsecond-scale timestamp to the failure/close-call output, but only in kernels built with CONFIG_RCU_TORTURE_TEST_LOG_GP=y. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 5b0510c79fde7..0f5a945427190 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -275,6 +275,7 @@ struct rt_read_seg { int rt_end_cpu; unsigned long long rt_gp_seq; unsigned long long rt_gp_seq_end; + u64 rt_ts; }; static int err_segs_recorded; static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS]; @@ -2000,6 +2001,7 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq, // Sample grace-period sequence number, as good a place as any. if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_GP) && cur_ops->gather_gp_seqs) { rtrsp->rt_gp_seq = cur_ops->gather_gp_seqs(); + rtrsp->rt_ts = ktime_get_mono_fast_ns(); if (!first) rtrsp[-1].rt_gp_seq_end = rtrsp->rt_gp_seq; } @@ -3674,7 +3676,11 @@ rcu_torture_cleanup(void) pr_alert("\t: No segments recorded!!!\n"); firsttime = 1; for (i = 0; i < rt_read_nsegs; i++) { - pr_alert("\t%d: %#4x", i, err_segs[i].rt_readstate); + if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_GP)) + pr_alert("\t%lluus ", div64_u64(err_segs[i].rt_ts, 1000ULL)); + else + pr_alert("\t"); + pr_cont("%d: %#4x", i, err_segs[i].rt_readstate); if (err_segs[i].rt_delay_jiffies != 0) { pr_cont("%s%ldjiffies", firsttime ? "" : "+", err_segs[i].rt_delay_jiffies); From patchwork Thu Jan 16 20:24:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942266 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 9FAA32442D9; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=o5PiU/GqFjZwk8SkcJRYL9fYB79J4ZR4HSMeaRYV9xM+a6vVV9YGoHe1rXJX9Ef8Bkw9KvIzkBmwhxiBiowDQ/b4czlFvDYkq6zr34+mfHZjAbpwXjTYmZ5DoGbC27vDWNqoNEQkiDsPFwazm3DkcMWiNYoN5PZMZdz2s7okSnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=pzDQ9rnnwo68H+iTYTDw1mS+6LjzLcLHRtTMGGlwxsY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CLannAwmRgsWe7pl63CTTg92+kfY6esLlAbz0hmmL6S3Cra4W3WM0ezs5Fj9sYjtOIzwB2E8nOjDPDWWPvToTr/RZ6lPOHJH6nPHAk80TTLY6tWzx3KFVwXwnv9k+AJ6r+xPXfDOq2SahJMB9z5eQ4f0UihqtI8swqjq1r2wwLA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BxY0RE9k; 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="BxY0RE9k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CB95C4CEED; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=pzDQ9rnnwo68H+iTYTDw1mS+6LjzLcLHRtTMGGlwxsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BxY0RE9kr6yF/P2noBfoJanOIRbMh3fHkp1DFrqHoBmrKFHkqLvt98ISZ8qjHcyZx 0N5ApZKntmrQUQnJ3TyLMtENsVcx/2Bxpdnsg/pKS5vcUgRh8GwkIUqQ/daVjuip3U Nqzm2QuYZLxL4ugySzTgN04XAOL7st1Wo7ynOgBJ5qKXA+M2wIHFiJHB31lCNcs6NJ wPy0Wp5bbIB2nR9gh56WO5ozSl91L4ofsIEdw3DUcKTyRT3+zk49n7ZlvplPbgjsB0 ZTJvQpuxR76gI87B6zjZ9kycN1OP2l5yxIemXR3eFEAylHpKEJouxdaAo7YDMSjnUC d2H71tO1dkI9w== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AEA28CE37D2; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 07/11] rcutorture: Make cur_ops->format_gp_seqs take buffer length Date: Thu, 16 Jan 2025 12:24:30 -0800 Message-Id: <20250116202434.3783613-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The Tree and Tiny implementations of rcutorture_format_gp_seqs() use hard-coded constants for the length of the buffer that they format into. This is of course an accident waiting to happen, so this commit therefore makes them take a length argument. The rcutorture calling code uses ARRAY_SIZE() to safely compute this new argument. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcu.h | 2 +- kernel/rcu/rcutorture.c | 8 +++++--- kernel/rcu/tiny.c | 4 ++-- kernel/rcu/tree.c | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index d2a91f705a4ab..eed2951a4962d 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -591,7 +591,7 @@ void do_trace_rcu_torture_read(const char *rcutorturename, static inline void rcu_gp_set_torture_wait(int duration) { } #endif unsigned long long rcutorture_gather_gp_seqs(void); -void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp); +void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp, size_t len); #ifdef CONFIG_TINY_SRCU diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 0f5a945427190..2e6e8664e4038 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -411,7 +411,7 @@ struct rcu_torture_ops { void (*gp_slow_unregister)(atomic_t *rgssp); bool (*reader_blocked)(void); unsigned long long (*gather_gp_seqs)(void); - void (*format_gp_seqs)(unsigned long long seqs, char *cp); + void (*format_gp_seqs)(unsigned long long seqs, char *cp, size_t len); long cbflood_max; int irq_capable; int can_boost; @@ -3699,8 +3699,10 @@ rcu_torture_cleanup(void) char buf2[20+1]; char sepchar = '-'; - cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq, buf1); - cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq_end, buf2); + cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq, + buf1, ARRAY_SIZE(buf1)); + cur_ops->format_gp_seqs(err_segs[i].rt_gp_seq_end, + buf2, ARRAY_SIZE(buf2)); if (err_segs[i].rt_gp_seq == err_segs[i].rt_gp_seq_end) { if (buf2[0]) { for (j = 0; buf2[j]; j++) diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c index b97c64e99a905..6380fbd27557a 100644 --- a/kernel/rcu/tiny.c +++ b/kernel/rcu/tiny.c @@ -264,9 +264,9 @@ unsigned long long rcutorture_gather_gp_seqs(void) } EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs); -void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp) +void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp, size_t len) { - snprintf(cp, 8, "g%04llx", seqs & 0xffffULL); + snprintf(cp, len, "g%04llx", seqs & 0xffffULL); } EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs); #endif diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index ac596596e7717..1d201455aa7c3 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -569,13 +569,13 @@ unsigned long long rcutorture_gather_gp_seqs(void) EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs); /* Format grace-period sequence numbers for rcutorture diagnostics. */ -void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp) +void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp, size_t len) { unsigned int egp = (seqs >> 16) & 0xffffffULL; unsigned int ggp = (seqs >> 40) & 0xffffULL; unsigned int pgp = seqs & 0xffffULL; - snprintf(cp, 20, "g%04x:e%06x:p%04x", ggp, egp, pgp); + snprintf(cp, len, "g%04x:e%06x:p%04x", ggp, egp, pgp); } EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs); From patchwork Thu Jan 16 20:24:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942267 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 A03192442F7; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=a2uRdWEPr3N33EsX6KwATLbvzw5jGdVKZle45BqrIR6VZJJCSNz3Fn/luB4vNNgAMNAnLRPZ+crVEgFvZnnCPHEt+W5Q58TZ13lywfdQDV141mnkhLbM7FYvN7CPODXe4qBEObgGf4/mhJraXqg7d7Ea9SaQomUvZdP8xBaoYDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=Y0UpprIRJnbbVRDMHgt1RNMyLVEianVXZ68KcrsvDn8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WwuV1BEfaRaTysp07FfbSI/FrMAmUHsCRuTx3sa9DPH+F4oRn8uK9Rg5YJX0QZw7Z3WbToVYSnE1K/jED6sssgNGvjyzX0+A3Reta15tGkDf4EC9bziNwZPKDicETe4uns3cux8LzGmHfmLiDhec5gihsFXrt9u42l26ZRMuTmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RqzPDbt4; 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="RqzPDbt4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CA20C4CEEC; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=Y0UpprIRJnbbVRDMHgt1RNMyLVEianVXZ68KcrsvDn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqzPDbt4D9MPcaHKPshOX/OkWhoI27wrBL6gWh29ZVtNZ95Bo5caDeIw8C/O7ScbV pdJTi0CpDPkBn0duzsm8UFDkTBopq1QwYeHzmrMo1r7xYUgibGzfgOJZ/Zz/ShgIUh OnLkehn4VVjzHeunehDGCcdI3MuAWvOqNAJQNhV/3F71j0IWgzoMWJ+SbTXByWZ4o5 1+Nd/oX36DWS2QWVaLcklHydk889ixxsG3/So/sQV8HK7oRouIfDHlzQqV/DbrMAjc xiShTileXpoxjarCo46JFWP9tOhq1ESGzZ8ULj6HrV8kulj3kKCBjn4rBCv3gPHog0 f2QPM5U4LVLBA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B12F1CE37D4; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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" , kernel test robot Subject: [PATCH rcu 08/11] rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool Date: Thu, 16 Jan 2025 12:24:31 -0800 Message-Id: <20250116202434.3783613-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The RCU_TORTURE_TEST_CHK_RDR_STATE and RCU_TORTURE_TEST_LOG_CPU Kconfig options are pointlessly defined as tristate. This commit therefore converts them to bool. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202412241458.150d082b-lkp@intel.com Signed-off-by: Paul E. McKenney --- kernel/rcu/Kconfig.debug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug index 25a9dc2be0dcd..12e4c64ebae15 100644 --- a/kernel/rcu/Kconfig.debug +++ b/kernel/rcu/Kconfig.debug @@ -54,7 +54,7 @@ config RCU_TORTURE_TEST Say N if you are unsure. config RCU_TORTURE_TEST_CHK_RDR_STATE - tristate "Check rcutorture reader state" + bool "Check rcutorture reader state" depends on RCU_TORTURE_TEST default n help @@ -70,7 +70,7 @@ config RCU_TORTURE_TEST_CHK_RDR_STATE Say N if you are unsure. config RCU_TORTURE_TEST_LOG_CPU - tristate "Log CPU for rcutorture failures" + bool "Log CPU for rcutorture failures" depends on RCU_TORTURE_TEST default n help From patchwork Thu Jan 16 20:24:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942268 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 B00CE244F82; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=B2V+wpA7sg134tzSWc5yw3S7SkwouPlMvQrn3QFW4nArQ3AeIsRMUU+2QiA/CYcRQ9+dx2WXjop87MGAXJzMTJg+YjeEz9UqsoSeD0AEIo8LxUS8LGyYYonSsCAGIxFqI6nZOUsDc2R4pVEC2lynyNZ8qXl9w382IodlJ7XGdOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=KB7ffITFRNm9svQKvwkYB6dRr1WT4/QwQRwGRBNJU48=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XJl298YgjrijBjdYpkRrsQk6S5EuU3LHg9Gsmn3fsXMH9pg5mgDw1w2Ct5FFtAmaRXnr56s6O0fXaYn0+BLJ6toVXQ0SI0pXzNISghV5rXpyUe49SNkltFqn+5dFfe8Lq5UZ2z05AQmmZbHilDtS5FPBxrYtKWe6ExMzH0mVN6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u6Yz7bvw; 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="u6Yz7bvw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64E51C4CEEB; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=KB7ffITFRNm9svQKvwkYB6dRr1WT4/QwQRwGRBNJU48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6Yz7bvwgj4h+cU2O5vnLFA5gXHAtfnj12w47WYEPljgsxmbIV8gGxT7qKy24l6iK OmkftegDs8RlTmb1LBMXyRQcx7XteFj0XAzP8mVDLdXWHaEQUggRYgTlYAqTkbmanX ZAoL+BGGSmhYh9m4ONd6kcGNg0m8VK4mV0Us1UrsHphEkb0WVd1cuHBqyFjkJUE3hE vgIUxH7N7JMt8UYXIYxSMkqvZmIyl5dQsimOiJtdCaBkaJMtOIKr0LSKJ5mskNYNZX RWHokevHFKYAy6iyFwpw/dISGi5avAI0ZSoRu3U79oroj0sbV/wm3uZH/kxHFu9HRf cObmnpGNtblfg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B349DCE37D5; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 09/11] rcutorture: Complain when invalid SRCU reader_flavor is specified Date: Thu, 16 Jan 2025 12:24:32 -0800 Message-Id: <20250116202434.3783613-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently, rcutorture ignores reader_flavor bits that are not in the SRCU_READ_FLAVOR_ALL bitmask, which could confuse rcutorture users into believing buggy patches had been fully tested. This commit therefore produces a splat in this case. 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 2e6e8664e4038..36bc8d1332d43 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -690,6 +690,8 @@ static int srcu_torture_read_lock(void) struct srcu_ctr __percpu *scp; int ret = 0; + WARN_ON_ONCE(reader_flavor & ~SRCU_READ_FLAVOR_ALL); + if ((reader_flavor & SRCU_READ_FLAVOR_NORMAL) || !(reader_flavor & SRCU_READ_FLAVOR_ALL)) { idx = srcu_read_lock(srcu_ctlp); WARN_ON_ONCE(idx & ~0x1); From patchwork Thu Jan 16 20:24:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942264 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 8A07A2442F2; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=GsZ0ykEPVA0Uy5yrUakLpjFzy1KbhVjinsr0GIx/on6rMR6ebkAbxCbde7XTtpq7Ilrm9lW0YNy0NKf9Iu1kwgQD/n1CPzOvF9EvDM/+Zh+ZIhyCWEY7pzP5N7gSE9XISH2nWKc+lBtPbGOBvIc3DHnfNCJbLayCSn9ydxYaGY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=FzUQJoOG2vRf53pKk7ZYyvipXK6KzW+OBXWQI7AE6cY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DyQY8Akq9bIIRytx/Vzk4OJgN1gcVt8Cubo0sBxsh6pT9MpPX2aC+uzEmKJjWaUmrTECPfwVHRjOKKjvyBM3R9+g6dWVcAGdGL32cv0OXXHb/gJvqso16QV3rJ8GfL2bPkyBv45lyKMCfKkmYoyTi4NEOkM8QyBmn+693ovmyL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SQHUixO3; 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="SQHUixO3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ABA4C4CEE3; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=FzUQJoOG2vRf53pKk7ZYyvipXK6KzW+OBXWQI7AE6cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQHUixO3pFJZzFxKKPs1sKd6qZjJuvRn0JUTQfurNb1Ga4pSDjKrnQXyVBWVXjOA1 Fx1lJ2tPA2n8W452vs/XfWMipTyFRgQzJqODAE8MZd7tPmaeicidR8uboJIVaU6d/4 F+CmRIva/6KM/kkE33cJsDqt3AuhZj+CqlVXCbkqupq9cZ4qW8T6MQpLv4T1YpvIR4 kY4/3toiQHyNUCcu+jODNQcxyK2yZ7mMne3DWVwXl/xevzKcGOpMCXu6a2ZV+Px2s7 Si8zvkzGZNzjq2P1B5nrfeA9/JGkT9micbcVq4Ao3vusmGZ6xsuh3x2zA2P/SN2PTX WLCarn18tOixQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B55FDCE37D7; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing Date: Thu, 16 Jan 2025 12:24:33 -0800 Message-Id: <20250116202434.3783613-10-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86 that have NMI-safe this_cpu_inc() operations. This makes the underlying __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions difficult to test on (for example) x86 systems, allowing bugs to creep in. This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that forces those underlying functions to be used even on systems where they are not needed, thus providing better testing coverage. Signed-off-by: Paul E. McKenney --- kernel/rcu/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig index 80242957fa417..aa42de4d27684 100644 --- a/kernel/rcu/Kconfig +++ b/kernel/rcu/Kconfig @@ -65,6 +65,17 @@ config TREE_SRCU help This option selects the full-fledged version of SRCU. +config FORCE_NEED_SRCU_NMI_SAFE + bool "Force selection of NEED_SRCU_NMI_SAFE" + depends on !TINY_SRCU + select NEED_SRCU_NMI_SAFE + default n + help + This option forces selection of the NEED_SRCU_NMI_SAFE + Kconfig option, allowing testing of srcu_read_lock_nmisafe() + and srcu_read_unlock_nmisafe() on architectures (like x86) + that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option. + config NEED_SRCU_NMI_SAFE def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU From patchwork Thu Jan 16 20:24:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13942263 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 876E02442E8; Thu, 16 Jan 2025 20:24:36 +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=1737059076; cv=none; b=XwT67D/aCZjcf0h9BJPdGead35+33GZV7Lzjcz5z4c3aq3MVdB4kXrh8YL2Qbs7e/6dclJCzIoXKayGKWyF/FpPzPUpzWL4kVdq0Y2Zw6IZJHOEG2jANEsbZAiMrXxsoWoQhg1Pk1b/QQsKjXnd9A21z5/SuydqbBaXMCrB2z30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737059076; c=relaxed/simple; bh=+whrCwaWWhgiIOPTij1X6AFm0+bMFyBVvN6NvAiWHDM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=htiBIUrUW1ucI4z81PWUZPUoILuKFJoJjL3k0cc/ynmxBqaSOuUEr6IybQWv6I1LNhKeMIIDjHWZ9pg4MK4xwk9PZnCuz6Qmy1s1lrApPp1WfrMHUC4u9F5TbHVs7vn11ZP2GJWuwXq8a8mMzA0MEuNV6HGk+36/GXSzDLfCQ2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l3kXoJfK; 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="l3kXoJfK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DFF1C4CEEE; Thu, 16 Jan 2025 20:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737059076; bh=+whrCwaWWhgiIOPTij1X6AFm0+bMFyBVvN6NvAiWHDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3kXoJfKH+8AGFAK9XzmXBVX4dUEtVNlRZWca29hP3FqEwjWrGnQHZTQrzeF6o2n4 Y9PEJdjKB3Ze0IHkM/eRZc8s5hu/d6/IRDCzIsakC2Nu5G+KNIjKnyXcEqmRrdnP/T F1q0QjgtTe9FdporlDwZmFrdcFeCABKyWuHxdDzKO+MZ+JV0LrCifOrNf209yrIive wqU1VRTii2OQf6ZWFlgiRSj4WKNCBf0HOY/iBuET2i6hB09JXZGmM75X5hu0BVqyMD Q68HHctdCQ7MHcfMQxiLtMlK9uDB5SBzR9/249qoamX41TeXGtoP4QjEy/0XoYsKFq ChjJyNPbLgPFw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B7679CE37D8; Thu, 16 Jan 2025 12:24:35 -0800 (PST) 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 rcu 11/11] torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe() Date: Thu, 16 Jan 2025 12:24:34 -0800 Message-Id: <20250116202434.3783613-11-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Recent experience shows that the srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions are not sufficiently tested. This commit therefore causes the torture.sh script's SRCU lockdep testing to use these two functions. This will cause these two functions to be regularly tested by several developers (myself included) who use torture.sh as an RCU acceptance test. Signed-off-by: Paul E. McKenney --- tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh b/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh index 2e63ef009d593..2db12c5cad9c6 100755 --- a/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh +++ b/tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh @@ -49,7 +49,7 @@ do do err= val=$((d*1000+t*10+c)) - tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s --configs "SRCU-P" --bootargs "rcutorture.test_srcu_lockdep=$val" --trust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1 + tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s --configs "SRCU-P" --kconfig "CONFIG_FORCE_NEED_SRCU_NMI_SAFE=y" --bootargs "rcutorture.test_srcu_lockdep=$val rcutorture.reader_flavor=0x2" --trust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1 ret=$? mv "$T/kvm.sh.out" "$RCUTORTURE/res/$ds/$val" if test "$d" -ne 0 && test "$ret" -eq 0