From: Neeraj Upadhyay <Neeraj.Upadhyay@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, rostedt@goodmis.org,
Zqiang <qiang.zhang1211@gmail.com>
Subject: Re: [PATCH rcu 1/6] rcu/tasks: Check processor-ID assumptions
Date: Wed, 14 Aug 2024 17:46:54 +0530 [thread overview]
Message-ID: <20240814121654.GA1412801@neeraj.linux> (raw)
In-Reply-To: <20240802003426.4134196-1-paulmck@kernel.org>
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
>
next prev parent reply other threads:[~2024-08-14 12:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=20240814121654.GA1412801@neeraj.linux \
--to=neeraj.upadhyay@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--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