* [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation
@ 2024-08-02 0:34 Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions Paul E. McKenney
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt
Hello!
This series adds RCU Tasks diagnostics and documentation:
1. Check processor-ID assumptions.
2. Update rtp->tasks_gp_seq comment.
3. Provide rcu_barrier_cb_is_done() to check rcu_barrier() CBs.
4. Mark callbacks not currently participating in barrier operation.
5. Add detailed grace-period and barrier diagnostics.
6. Add rcu_barrier_tasks*() start time to diagnostics.
Thanx, Paul
------------------------------------------------------------------------
b/include/linux/rcupdate.h | 3 +
b/kernel/rcu/rcu.h | 5 +++
b/kernel/rcu/tasks.h | 1
kernel/rcu/tasks.h | 75 ++++++++++++++++++++++++++++++++++++++++++---
4 files changed, 79 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
@ 2024-08-02 0:34 ` Paul E. McKenney
2024-08-14 12:16 ` Neeraj Upadhyay
2024-08-02 0:34 ` [PATCH rcu 2/6] rcu/tasks: Update rtp->tasks_gp_seq comment Paul E. McKenney
` (4 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
The current mapping of smp_processor_id() to a CPU processing Tasks-RCU
callbacks makes some assumptions about layout. This commit therefore
adds a WARN_ON() to check these assumptions.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tasks.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index b6fcf744af75d..d473846a572aa 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -355,6 +355,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,
rcu_read_lock();
ideal_cpu = smp_processor_id() >> READ_ONCE(rtp->percpu_enqueue_shift);
chosen_cpu = cpumask_next(ideal_cpu - 1, cpu_possible_mask);
+ WARN_ON_ONCE(chosen_cpu >= nr_cpu_ids);
rtpcp = per_cpu_ptr(rtp->rtpcpu, chosen_cpu);
if (!raw_spin_trylock_rcu_node(rtpcp)) { // irqs already disabled.
raw_spin_lock_rcu_node(rtpcp); // irqs already disabled.
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH rcu 2/6] rcu/tasks: Update rtp->tasks_gp_seq comment
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions Paul E. McKenney
@ 2024-08-02 0:34 ` Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 3/6] rcu: Provide rcu_barrier_cb_is_done() to check rcu_barrier() CBs Paul E. McKenney
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
The rtp->tasks_gp_seq grace-period sequence number is not a strict count,
but rather the usual RCU sequence number with the lower few bits tracking
per-grace-period state and the upper bits the count of grace periods
since boot, give or take the initial value. This commit therefore
adjusts this comment.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tasks.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index d473846a572aa..cf273c554f3b0 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -64,7 +64,7 @@ struct rcu_tasks_percpu {
* @init_fract: Initial backoff sleep interval.
* @gp_jiffies: Time of last @gp_state transition.
* @gp_start: Most recent grace-period start in jiffies.
- * @tasks_gp_seq: Number of grace periods completed since boot.
+ * @tasks_gp_seq: Number of grace periods completed since boot in upper bits.
* @n_ipis: Number of IPIs sent to encourage grace periods to end.
* @n_ipis_fails: Number of IPI-send failures.
* @kthread_ptr: This flavor's grace-period/callback-invocation kthread.
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH rcu 3/6] rcu: Provide rcu_barrier_cb_is_done() to check rcu_barrier() CBs
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 2/6] rcu/tasks: Update rtp->tasks_gp_seq comment Paul E. McKenney
@ 2024-08-02 0:34 ` Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 4/6] rcu/tasks: Mark callbacks not currently participating in barrier operation Paul E. McKenney
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
This commit provides a rcu_barrier_cb_is_done() function that returns
true if the *rcu_barrier*() callback passed in is done. This will be
used when printing grace-period debugging information.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/rcu.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index f035fd4e579b4..feb3ac1dc5d59 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -252,6 +252,11 @@ static inline void debug_rcu_head_callback(struct rcu_head *rhp)
kmem_dump_obj(rhp);
}
+static inline bool rcu_barrier_cb_is_done(struct rcu_head *rhp)
+{
+ return rhp->next == rhp;
+}
+
extern int rcu_cpu_stall_suppress_at_boot;
static inline bool rcu_stall_is_suppressed_at_boot(void)
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH rcu 4/6] rcu/tasks: Mark callbacks not currently participating in barrier operation
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
` (2 preceding siblings ...)
2024-08-02 0:34 ` [PATCH rcu 3/6] rcu: Provide rcu_barrier_cb_is_done() to check rcu_barrier() CBs Paul E. McKenney
@ 2024-08-02 0:34 ` Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 5/6] rcu/tasks: Add detailed grace-period and barrier diagnostics Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 6/6] rcu/tasks: Add rcu_barrier_tasks*() start time to diagnostics Paul E. McKenney
5 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
Each Tasks RCU flavor keeps a count of the number of callbacks that the
current rcu_barrier_tasks*() 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 RCU-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/tasks.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index cf273c554f3b0..6f1e82e548bbc 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -281,6 +281,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp)
INIT_LIST_HEAD(&rtpcp->rtp_blkd_tasks);
if (!rtpcp->rtp_exit_list.next)
INIT_LIST_HEAD(&rtpcp->rtp_exit_list);
+ rtpcp->barrier_q_head.next = &rtpcp->barrier_q_head;
maxcpu = cpu;
}
@@ -405,6 +406,7 @@ static void rcu_barrier_tasks_generic_cb(struct rcu_head *rhp)
struct rcu_tasks *rtp;
struct rcu_tasks_percpu *rtpcp;
+ rhp->next = rhp; // Mark the callback as having been invoked.
rtpcp = container_of(rhp, struct rcu_tasks_percpu, barrier_q_head);
rtp = rtpcp->rtpp;
if (atomic_dec_and_test(&rtp->barrier_q_count))
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH rcu 5/6] rcu/tasks: Add detailed grace-period and barrier diagnostics
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
` (3 preceding siblings ...)
2024-08-02 0:34 ` [PATCH rcu 4/6] rcu/tasks: Mark callbacks not currently participating in barrier operation Paul E. McKenney
@ 2024-08-02 0:34 ` Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 6/6] rcu/tasks: Add rcu_barrier_tasks*() start time to diagnostics Paul E. McKenney
5 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
This commit adds rcu_tasks_torture_stats_print(),
rcu_tasks_trace_torture_stats_print(), and
rcu_tasks_rude_torture_stats_print() functions that provide detailed
diagnostics on grace-period, callback, and barrier state.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
include/linux/rcupdate.h | 3 ++
kernel/rcu/tasks.h | 63 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index e40a726fe1a03..58d84c59f3dda 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -174,6 +174,7 @@ static inline void rcu_nocb_flush_deferred_wakeup(void) { }
} while (0)
void call_rcu_tasks(struct rcu_head *head, rcu_callback_t func);
void synchronize_rcu_tasks(void);
+void rcu_tasks_torture_stats_print(char *tt, char *tf);
# else
# define rcu_tasks_classic_qs(t, preempt) do { } while (0)
# define call_rcu_tasks call_rcu
@@ -200,6 +201,7 @@ void rcu_tasks_trace_qs_blkd(struct task_struct *t);
rcu_tasks_trace_qs_blkd(t); \
} \
} while (0)
+void rcu_tasks_trace_torture_stats_print(char *tt, char *tf);
# else
# define rcu_tasks_trace_qs(t) do { } while (0)
# endif
@@ -212,6 +214,7 @@ do { \
# ifdef CONFIG_TASKS_RUDE_RCU
void synchronize_rcu_tasks_rude(void);
+void rcu_tasks_rude_torture_stats_print(char *tt, char *tf);
# endif
#define rcu_note_voluntary_context_switch(t) rcu_tasks_qs(t, false)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 6f1e82e548bbc..37597f7c581ca 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -712,9 +712,7 @@ static void __init rcu_tasks_bootup_oddness(void)
#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
}
-#endif /* #ifndef CONFIG_TINY_RCU */
-#ifndef CONFIG_TINY_RCU
/* Dump out rcutorture-relevant state common to all RCU-tasks flavors. */
static void show_rcu_tasks_generic_gp_kthread(struct rcu_tasks *rtp, char *s)
{
@@ -748,6 +746,52 @@ static void show_rcu_tasks_generic_gp_kthread(struct rcu_tasks *rtp, char *s)
rtp->lazy_jiffies,
s);
}
+
+/* Dump out more rcutorture-relevant state common to all RCU-tasks flavors. */
+static void rcu_tasks_torture_stats_print_generic(struct rcu_tasks *rtp, char *tt,
+ char *tf, char *tst)
+{
+ cpumask_var_t cm;
+ int cpu;
+ bool gotcb = false;
+ unsigned long j = jiffies;
+
+ pr_alert("%s%s Tasks%s RCU g%ld gp_start %lu gp_jiffies %lu gp_state %d (%s).\n",
+ tt, tf, tst, data_race(rtp->tasks_gp_seq),
+ j - data_race(rtp->gp_start), j - data_race(rtp->gp_jiffies),
+ data_race(rtp->gp_state), tasks_gp_state_getname(rtp));
+ pr_alert("\tEnqueue shift %d limit %d Dequeue limit %d gpseq %lu.\n",
+ data_race(rtp->percpu_enqueue_shift),
+ data_race(rtp->percpu_enqueue_lim),
+ data_race(rtp->percpu_dequeue_lim),
+ data_race(rtp->percpu_dequeue_gpseq));
+ (void)zalloc_cpumask_var(&cm, GFP_KERNEL);
+ pr_alert("\tCallback counts:");
+ for_each_possible_cpu(cpu) {
+ long n;
+ struct rcu_tasks_percpu *rtpcp = per_cpu_ptr(rtp->rtpcpu, cpu);
+
+ if (cpumask_available(cm) && !rcu_barrier_cb_is_done(&rtpcp->barrier_q_head))
+ cpumask_set_cpu(cpu, cm);
+ n = rcu_segcblist_n_cbs(&rtpcp->cblist);
+ if (!n)
+ continue;
+ pr_cont(" %d:%ld", cpu, n);
+ gotcb = true;
+ }
+ if (gotcb)
+ pr_cont(".\n");
+ else
+ pr_cont(" (none).\n");
+ pr_alert("\tBarrier seq %lu count %d holdout CPUs ",
+ data_race(rtp->barrier_q_seq), atomic_read(&rtp->barrier_q_count));
+ if (cpumask_available(cm) && !cpumask_empty(cm))
+ pr_cont(" %*pbl.\n", cpumask_pr_args(cm));
+ else
+ pr_cont("(none).\n");
+ free_cpumask_var(cm);
+}
+
#endif // #ifndef CONFIG_TINY_RCU
static void exit_tasks_rcu_finish_trace(struct task_struct *t);
@@ -1199,6 +1243,11 @@ void show_rcu_tasks_classic_gp_kthread(void)
show_rcu_tasks_generic_gp_kthread(&rcu_tasks, "");
}
EXPORT_SYMBOL_GPL(show_rcu_tasks_classic_gp_kthread);
+void rcu_tasks_torture_stats_print(char *tt, char *tf)
+{
+ rcu_tasks_torture_stats_print_generic(&rcu_tasks, tt, tf, "");
+}
+EXPORT_SYMBOL_GPL(rcu_tasks_torture_stats_print);
#endif // !defined(CONFIG_TINY_RCU)
struct task_struct *get_rcu_tasks_gp_kthread(void)
@@ -1360,6 +1409,11 @@ void show_rcu_tasks_rude_gp_kthread(void)
show_rcu_tasks_generic_gp_kthread(&rcu_tasks_rude, "");
}
EXPORT_SYMBOL_GPL(show_rcu_tasks_rude_gp_kthread);
+void rcu_tasks_rude_torture_stats_print(char *tt, char *tf)
+{
+ rcu_tasks_torture_stats_print_generic(&rcu_tasks_rude, tt, tf, "");
+}
+EXPORT_SYMBOL_GPL(rcu_tasks_rude_torture_stats_print);
#endif // !defined(CONFIG_TINY_RCU)
struct task_struct *get_rcu_tasks_rude_gp_kthread(void)
@@ -2037,6 +2091,11 @@ void show_rcu_tasks_trace_gp_kthread(void)
show_rcu_tasks_generic_gp_kthread(&rcu_tasks_trace, buf);
}
EXPORT_SYMBOL_GPL(show_rcu_tasks_trace_gp_kthread);
+void rcu_tasks_trace_torture_stats_print(char *tt, char *tf)
+{
+ rcu_tasks_torture_stats_print_generic(&rcu_tasks_trace, tt, tf, "");
+}
+EXPORT_SYMBOL_GPL(rcu_tasks_trace_torture_stats_print);
#endif // !defined(CONFIG_TINY_RCU)
struct task_struct *get_rcu_tasks_trace_gp_kthread(void)
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH rcu 6/6] rcu/tasks: Add rcu_barrier_tasks*() start time to diagnostics
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
` (4 preceding siblings ...)
2024-08-02 0:34 ` [PATCH rcu 5/6] rcu/tasks: Add detailed grace-period and barrier diagnostics Paul E. McKenney
@ 2024-08-02 0:34 ` Paul E. McKenney
5 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:34 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
This commit adds the start time, in jiffies, of the most recently started
rcu_barrier_tasks*() operation to the diagnostic output used by rcuscale.
This information can be helpful in distinguishing a hung barrier operation
from a long series of barrier operations.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tasks.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 37597f7c581ca..2f8d6c8e3c4ce 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -85,6 +85,7 @@ struct rcu_tasks_percpu {
* @barrier_q_count: Number of queues being waited on.
* @barrier_q_completion: Barrier wait/wakeup mechanism.
* @barrier_q_seq: Sequence number for barrier operations.
+ * @barrier_q_start: Most recent barrier start in jiffies.
* @name: This flavor's textual name.
* @kname: This flavor's kthread name.
*/
@@ -120,6 +121,7 @@ struct rcu_tasks {
atomic_t barrier_q_count;
struct completion barrier_q_completion;
unsigned long barrier_q_seq;
+ unsigned long barrier_q_start;
char *name;
char *kname;
};
@@ -428,6 +430,7 @@ static void __maybe_unused rcu_barrier_tasks_generic(struct rcu_tasks *rtp)
mutex_unlock(&rtp->barrier_q_mutex);
return;
}
+ rtp->barrier_q_start = jiffies;
rcu_seq_start(&rtp->barrier_q_seq);
init_completion(&rtp->barrier_q_completion);
atomic_set(&rtp->barrier_q_count, 2);
@@ -783,8 +786,9 @@ static void rcu_tasks_torture_stats_print_generic(struct rcu_tasks *rtp, char *t
pr_cont(".\n");
else
pr_cont(" (none).\n");
- pr_alert("\tBarrier seq %lu count %d holdout CPUs ",
- data_race(rtp->barrier_q_seq), atomic_read(&rtp->barrier_q_count));
+ pr_alert("\tBarrier seq %lu start %lu count %d holdout CPUs ",
+ data_race(rtp->barrier_q_seq), j - data_race(rtp->barrier_q_start),
+ atomic_read(&rtp->barrier_q_count));
if (cpumask_available(cm) && !cpumask_empty(cm))
pr_cont(" %*pbl.\n", cpumask_pr_args(cm));
else
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions
2024-08-02 0:34 ` [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions Paul E. McKenney
@ 2024-08-14 12:16 ` Neeraj Upadhyay
2024-08-14 16:13 ` Paul E. McKenney
0 siblings, 1 reply; 9+ messages in thread
From: Neeraj Upadhyay @ 2024-08-14 12:16 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: rcu, linux-kernel, kernel-team, rostedt, Zqiang
Hi Paul,
On Thu, Aug 01, 2024 at 05:34:21PM -0700, Paul E. McKenney wrote:
> The current mapping of smp_processor_id() to a CPU processing Tasks-RCU
> callbacks makes some assumptions about layout. This commit therefore
> adds a WARN_ON() to check these assumptions.
>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> kernel/rcu/tasks.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index b6fcf744af75d..d473846a572aa 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -355,6 +355,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,
> rcu_read_lock();
> ideal_cpu = smp_processor_id() >> READ_ONCE(rtp->percpu_enqueue_shift);
> chosen_cpu = cpumask_next(ideal_cpu - 1, cpu_possible_mask);
> + WARN_ON_ONCE(chosen_cpu >= nr_cpu_ids);
I have changed this s/nr_cpu_ids/rcu_task_cpu_ids/ , as there is a
another commit fd70e9f1d85f "rcu-tasks: Fix access non-existent percpu
rtpcp variable in rcu_tasks_need_gpcb()" which is included in the tree
here [1]. Please let me know if something looks incorrect.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/neeraj.upadhyay/linux-rcu.git/log/?h=next.14.08.24a
- Neeraj
> rtpcp = per_cpu_ptr(rtp->rtpcpu, chosen_cpu);
> if (!raw_spin_trylock_rcu_node(rtpcp)) { // irqs already disabled.
> raw_spin_lock_rcu_node(rtpcp); // irqs already disabled.
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions
2024-08-14 12:16 ` Neeraj Upadhyay
@ 2024-08-14 16:13 ` Paul E. McKenney
0 siblings, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2024-08-14 16:13 UTC (permalink / raw)
To: Neeraj Upadhyay; +Cc: rcu, linux-kernel, kernel-team, rostedt, Zqiang
On Wed, Aug 14, 2024 at 05:46:54PM +0530, Neeraj Upadhyay wrote:
> Hi Paul,
>
> On Thu, Aug 01, 2024 at 05:34:21PM -0700, Paul E. McKenney wrote:
> > The current mapping of smp_processor_id() to a CPU processing Tasks-RCU
> > callbacks makes some assumptions about layout. This commit therefore
> > adds a WARN_ON() to check these assumptions.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > ---
> > kernel/rcu/tasks.h | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> > index b6fcf744af75d..d473846a572aa 100644
> > --- a/kernel/rcu/tasks.h
> > +++ b/kernel/rcu/tasks.h
> > @@ -355,6 +355,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,
> > rcu_read_lock();
> > ideal_cpu = smp_processor_id() >> READ_ONCE(rtp->percpu_enqueue_shift);
> > chosen_cpu = cpumask_next(ideal_cpu - 1, cpu_possible_mask);
> > + WARN_ON_ONCE(chosen_cpu >= nr_cpu_ids);
>
> I have changed this s/nr_cpu_ids/rcu_task_cpu_ids/ , as there is a
> another commit fd70e9f1d85f "rcu-tasks: Fix access non-existent percpu
> rtpcp variable in rcu_tasks_need_gpcb()" which is included in the tree
> here [1]. Please let me know if something looks incorrect.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/neeraj.upadhyay/linux-rcu.git/log/?h=next.14.08.24a
Good catch, looks good, and thank you!
Thanx, Paul
> - Neeraj
>
> > rtpcp = per_cpu_ptr(rtp->rtpcpu, chosen_cpu);
> > if (!raw_spin_trylock_rcu_node(rtpcp)) { // irqs already disabled.
> > raw_spin_lock_rcu_node(rtpcp); // irqs already disabled.
> > --
> > 2.40.1
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-08-14 16:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02 0:34 [PATCH rcu 0/6] Add RCU Tasks diagnostics and documentation Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions Paul E. McKenney
2024-08-14 12:16 ` Neeraj Upadhyay
2024-08-14 16:13 ` Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 2/6] rcu/tasks: Update rtp->tasks_gp_seq comment Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 3/6] rcu: Provide rcu_barrier_cb_is_done() to check rcu_barrier() CBs Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 4/6] rcu/tasks: Mark callbacks not currently participating in barrier operation Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 5/6] rcu/tasks: Add detailed grace-period and barrier diagnostics Paul E. McKenney
2024-08-02 0:34 ` [PATCH rcu 6/6] rcu/tasks: Add rcu_barrier_tasks*() start time to diagnostics 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