From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
rostedt@goodmis.org, "Paul E. McKenney" <paulmck@kernel.org>
Subject: [PATCH rcu v2] 01/11] torture: Add get_torture_init_jiffies() for test-start time
Date: Thu, 30 Jan 2025 11:04:34 -0800 [thread overview]
Message-ID: <20250130190444.1652700-1-paulmck@kernel.org> (raw)
In-Reply-To: <bd22a7da-a4e0-45dc-b43c-1532af4dcfc7@paulmck-laptop>
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 <paulmck@kernel.org>
---
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 0134e7221cae..1b59056c3b18 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 dede150aef01..3a0a8cc60401 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
--
2.40.1
next prev parent reply other threads:[~2025-01-30 19:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 20:24 [PATCH rcu 0/11] Torture-test updates Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 01/11] torture: Add get_torture_init_jiffies() for test-start time Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 02/11] rcutorture: Add a test_boost_holdoff module parameter Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 03/11] rcutorture: Include grace-period sequence numbers in failure/close-call Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 04/11] rcutorture: Expand failure/close-call grace-period output Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 05/11] rcu: Trace expedited grace-period numbers in hexadecimal Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 06/11] rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 07/11] rcutorture: Make cur_ops->format_gp_seqs take buffer length Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 08/11] rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 09/11] rcutorture: Complain when invalid SRCU reader_flavor is specified Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing Paul E. McKenney
2025-01-16 20:24 ` [PATCH rcu 11/11] torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe() Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu 0/11] Torture-test updates Paul E. McKenney
2025-01-30 19:04 ` Paul E. McKenney [this message]
2025-01-30 19:04 ` [PATCH rcu v2] 02/11] rcutorture: Add a test_boost_holdoff module parameter Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 03/11] rcutorture: Include grace-period sequence numbers in failure/close-call Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 04/11] rcutorture: Expand failure/close-call grace-period output Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 05/11] rcu: Trace expedited grace-period numbers in hexadecimal Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 06/11] rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 07/11] rcutorture: Make cur_ops->format_gp_seqs take buffer length Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 08/11] rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 09/11] rcutorture: Complain when invalid SRCU reader_flavor is specified Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing Paul E. McKenney
2025-01-30 19:04 ` [PATCH rcu v2] 11/11] torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe() Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250130190444.1652700-1-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox