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] 04/11] rcutorture: Expand failure/close-call grace-period output
Date: Thu, 30 Jan 2025 11:04:37 -0800 [thread overview]
Message-ID: <20250130190444.1652700-4-paulmck@kernel.org> (raw)
In-Reply-To: <bd22a7da-a4e0-45dc-b43c-1532af4dcfc7@paulmck-laptop>
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 <paulmck@kernel.org>
---
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 7c14eec7c13a..d2a91f705a4a 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 7af7de168846..5b0510c79fde 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 773944257e79..b97c64e99a90 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 574a28066062..ac596596e771 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);
--
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 ` [PATCH rcu v2] 01/11] torture: Add get_torture_init_jiffies() for test-start time Paul E. McKenney
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 ` Paul E. McKenney [this message]
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-4-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