* [PATCH rcu 0/2] SRCU updates
@ 2024-08-02 0:36 Paul E. McKenney
2024-08-02 0:36 ` [PATCH rcu 1/2] srcu: Check for concurrent updates of heuristics Paul E. McKenney
2024-08-02 0:36 ` [PATCH rcu 2/2] srcu: Mark callbacks not currently participating in barrier operation Paul E. McKenney
0 siblings, 2 replies; 3+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:36 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt
Hello!
This series contains a couple of SRCU updates:
1. Check for concurrent updates of heuristics.
2. Mark callbacks not currently participating in barrier operation.
Thanx, Paul
------------------------------------------------------------------------
b/kernel/rcu/srcutree.c | 2 ++
kernel/rcu/srcutree.c | 2 ++
2 files changed, 4 insertions(+)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH rcu 1/2] srcu: Check for concurrent updates of heuristics
2024-08-02 0:36 [PATCH rcu 0/2] SRCU updates Paul E. McKenney
@ 2024-08-02 0:36 ` Paul E. McKenney
2024-08-02 0:36 ` [PATCH rcu 2/2] srcu: Mark callbacks not currently participating in barrier operation Paul E. McKenney
1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:36 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
SRCU maintains the ->srcu_n_exp_nodelay and ->reschedule_count values
to guide heuristics governing auto-expediting of normal SRCU grace
periods and grace-period-state-machine delays. This commit adds KCSAN
ASSERT_EXCLUSIVE_WRITER() calls to check for concurrent updates to
these fields.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/srcutree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 48cd75b74f708..d3fdaeba0c10d 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -632,6 +632,7 @@ static unsigned long srcu_get_delay(struct srcu_struct *ssp)
if (time_after(j, gpstart))
jbase += j - gpstart;
if (!jbase) {
+ ASSERT_EXCLUSIVE_WRITER(sup->srcu_n_exp_nodelay);
WRITE_ONCE(sup->srcu_n_exp_nodelay, READ_ONCE(sup->srcu_n_exp_nodelay) + 1);
if (READ_ONCE(sup->srcu_n_exp_nodelay) > srcu_max_nodelay_phase)
jbase = 1;
@@ -1822,6 +1823,7 @@ static void process_srcu(struct work_struct *work)
} else {
j = jiffies;
if (READ_ONCE(sup->reschedule_jiffies) == j) {
+ ASSERT_EXCLUSIVE_WRITER(sup->reschedule_count);
WRITE_ONCE(sup->reschedule_count, READ_ONCE(sup->reschedule_count) + 1);
if (READ_ONCE(sup->reschedule_count) > srcu_max_nodelay)
curdelay = 1;
--
2.40.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH rcu 2/2] srcu: Mark callbacks not currently participating in barrier operation
2024-08-02 0:36 [PATCH rcu 0/2] SRCU updates Paul E. McKenney
2024-08-02 0:36 ` [PATCH rcu 1/2] srcu: Check for concurrent updates of heuristics Paul E. McKenney
@ 2024-08-02 0:36 ` Paul E. McKenney
1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:36 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
SRCU keeps a count of the number of callbacks that the current
srcu_barrier() is waiting on, but there is currently no easy way to
work out which callback is stuck. One way to do this is to mark idle
SRCU-barrier callbacks by making the ->next pointer point to the callback
itself, and this commit does just that.
Later commits will use this for debug output.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/srcutree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index d3fdaeba0c10d..50508c9605791 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -140,6 +140,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)
sdp->srcu_cblist_invoking = false;
sdp->srcu_gp_seq_needed = ssp->srcu_sup->srcu_gp_seq;
sdp->srcu_gp_seq_needed_exp = ssp->srcu_sup->srcu_gp_seq;
+ sdp->srcu_barrier_head.next = &sdp->srcu_barrier_head;
sdp->mynode = NULL;
sdp->cpu = cpu;
INIT_WORK(&sdp->work, srcu_invoke_callbacks);
@@ -1565,6 +1566,7 @@ static void srcu_barrier_cb(struct rcu_head *rhp)
struct srcu_data *sdp;
struct srcu_struct *ssp;
+ rhp->next = rhp; // Mark the callback as having been invoked.
sdp = container_of(rhp, struct srcu_data, srcu_barrier_head);
ssp = sdp->ssp;
if (atomic_dec_and_test(&ssp->srcu_sup->srcu_barrier_cpu_cnt))
--
2.40.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-02 0:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 0:36 [PATCH rcu 0/2] SRCU updates Paul E. McKenney
2024-08-02 0:36 ` [PATCH rcu 1/2] srcu: Check for concurrent updates of heuristics Paul E. McKenney
2024-08-02 0:36 ` [PATCH rcu 2/2] srcu: Mark callbacks not currently participating in barrier operation Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®