public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: paulmck <paulmck@kernel.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	rcu <rcu@vger.kernel.org>, Peter Zijlstra <peterz@infradead.org>,
	Josh Triplett <josh@joshtriplett.org>,
	rostedt <rostedt@goodmis.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	"Joel Fernandes, Google" <joel@joelfernandes.org>
Subject: Re: tasks-trace RCU: question about grace period forward progress
Date: Thu, 25 Feb 2021 15:20:34 -0500 (EST)	[thread overview]
Message-ID: <2096901411.5697.1614284434230.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20210225183321.GT2743@paulmck-ThinkPad-P72>

----- On Feb 25, 2021, at 1:33 PM, paulmck paulmck@kernel.org wrote:
[...]
> commit 581f79546b6be406a9c7280b2d3511b60821efe0
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date:   Thu Feb 25 10:26:00 2021 -0800
> 
>    rcu-tasks: Add block comment laying out RCU Tasks Trace design
>    
>    This commit adds a block comment that gives a high-level overview of
>    how RCU tasks trace grace periods progress.  It also adds a note about
>    how exiting tasks are handles, plus it gives an overview of the memory

handles -> handled

>    ordering.
>    
>    Reported-by: Peter Zijlstra <peterz@infradead.org>
>    Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> 
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 17c8ebe..f818357 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -726,6 +726,42 @@ EXPORT_SYMBOL_GPL(show_rcu_tasks_rude_gp_kthread);
> // flavors, rcu_preempt and rcu_sched.  The fact that RCU Tasks Trace
> // readers can operate from idle, offline, and exception entry/exit in no
> // way allows rcu_preempt and rcu_sched readers to also do so.
> +//
> +// The implementation uses rcu_tasks_wait_gp(), which relies on function
> +// pointers in the rcu_tasks structure.  The rcu_spawn_tasks_trace_kthread()
> +// function sets these function pointers up so that rcu_tasks_wait_gp()
> +// invokes these functions in this order:
> +//
> +// rcu_tasks_trace_pregp_step():
> +//	Initialize the count of readers and block CPU-hotplug operations.
> +// rcu_tasks_trace_pertask(), invoked on every non-idle task:
> +//	Initialize per-task state and attempt to identify an immediate
> +//	quiescent state for that task, or, failing that, attempt to set
> +//	that task's .need_qs flag so that that task's next outermost
> +//	rcu_read_unlock_trace() will report the quiescent state (in which
> +//	case the count of readers is incremented).  If both attempts fail,
> +//	the task is added to a "holdout" list.
> +// rcu_tasks_trace_postscan():
> +//	Initialize state and attempt to identify an immediate quiescent
> +//	state as above (but only for idle tasks), unblock CPU-hotplug
> +//	operations, and wait for an RCU grace period to avoid races with
> +//	tasks that are in the process of exiting.
> +// check_all_holdout_tasks_trace(), repeatedly until holdout list is empty:
> +//	Scans the holdout list, attempting to identify a quiescent state
> +//	for each task on the list.  If there is a quiescent state, the
> +//	corresponding task is removed from the holdout list.
> +// rcu_tasks_trace_postgp():
> +//	Wait for the count of readers do drop to zero, reporting any stalls.
> +//	Also execute full memory barriers to maintain ordering with code
> +//	executing after the grace period.
> +//
> +// The exit_tasks_rcu_finish_trace() synchronizes with exiting tasks.
> +//
> +// Pre-grace-period update-side code is ordered before the grace
> +// period via the ->cbs_lock and barriers in rcu_tasks_kthread().
> +// Pre-grace-period read-side code is ordered before the grace period by
> +// atomic_dec_and_test() of the count of readers (for IPIed readers) and by
> +// scheduler context-switch ordering (for locked-down non-running readers).

The rest looks good, thanks!

Mathieu

> 
> // The lockdep state must be outside of #ifdef to be useful.
>  #ifdef CONFIG_DEBUG_LOCK_ALLOC

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2021-02-25 20:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 14:22 tasks-trace RCU: question about grace period forward progress Mathieu Desnoyers
2021-02-25 15:36 ` Paul E. McKenney
2021-02-25 15:47   ` Mathieu Desnoyers
2021-02-25 18:33     ` Paul E. McKenney
2021-02-25 20:20       ` Mathieu Desnoyers [this message]
2021-02-25 20:55         ` Paul E. McKenney
2021-02-25 22:23       ` Peter Zijlstra
2021-02-25 23:05         ` 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=2096901411.5697.1614284434230.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.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