public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Valentin Schneider <vschneid@redhat.com>
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Neeraj Upadhyay <quic_neeraju@quicinc.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang1211@gmail.com>
Subject: Re: [PATCH v3 13/25] context_tracking, rcu: Rename rcu_dynticks_task*() into rcu_task*()
Date: Wed, 31 Jul 2024 18:07:32 +0200	[thread overview]
Message-ID: <ZqphRBrI4mlSdER4@localhost.localdomain> (raw)
In-Reply-To: <20240724144325.3307148-14-vschneid@redhat.com>

Le Wed, Jul 24, 2024 at 04:43:13PM +0200, Valentin Schneider a écrit :
> The context_tracking.state RCU_DYNTICKS subvariable has been renamed to
> RCU_WATCHING, and the 'dynticks' prefix can be dropped without losing any
> meaning.
> 
> While at it, flip the suffixes of these helpers. We are not telling
> that we are entering dynticks mode from an RCU-task perspective anymore; we
> are telling that we are exiting RCU-tasks because we are in eqs mode.
> 
> Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
> ---
>  kernel/context_tracking.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 8262f57a43636..1c16a7336360f 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -38,24 +38,24 @@ EXPORT_SYMBOL_GPL(context_tracking);
>  #ifdef CONFIG_CONTEXT_TRACKING_IDLE
>  #define TPS(x)  tracepoint_string(x)
>  
> -/* Record the current task on dyntick-idle entry. */
> -static __always_inline void rcu_dynticks_task_enter(void)
> +/* Record the current task on exiting RCU-tasks (dyntick-idle entry). */
> +static __always_inline void rcu_task_exit(void)

So this makes sense.

>  {
>  #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
>  	WRITE_ONCE(current->rcu_tasks_idle_cpu, smp_processor_id());
>  #endif /* #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL) */
>  }
>  
> -/* Record no current task on dyntick-idle exit. */
> -static __always_inline void rcu_dynticks_task_exit(void)
> +/* Record no current task on entering RCU-tasks (dyntick-idle exit). */
> +static __always_inline void rcu_task_enter(void)

That too.

>  {
>  #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL)
>  	WRITE_ONCE(current->rcu_tasks_idle_cpu, -1);
>  #endif /* #if defined(CONFIG_TASKS_RCU) && defined(CONFIG_NO_HZ_FULL) */
>  }
>  
> -/* Turn on heavyweight RCU tasks trace readers on idle/user entry. */
> -static __always_inline void rcu_dynticks_task_trace_enter(void)
> +/* Turn on heavyweight RCU tasks trace readers on kernel exit. */
> +static __always_inline void rcu_task_trace_exit(void)

But that eventually doesn't, because it's not about not wathing anymore from
an RCU-TASKS-TRACE perspective. It's actually about adding more heavyweight
ordering to track down RCU-TASKS-TRACE read side while traditional RCU is not
watching. Sorry for understanding it that late.

Oh well. So a more accurate name here would be rcu_task_trace_heavyweight_enter().

>  {
>  #ifdef CONFIG_TASKS_TRACE_RCU
>  	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
> @@ -63,8 +63,8 @@ static __always_inline void rcu_dynticks_task_trace_enter(void)
>  #endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
>  }
>  
> -/* Turn off heavyweight RCU tasks trace readers on idle/user exit. */
> -static __always_inline void rcu_dynticks_task_trace_exit(void)
> +/* Turn off heavyweight RCU tasks trace readers on kernel entry. */
> +static __always_inline void rcu_task_trace_enter(void)

And rcu_task_trace_heavyweight_exit().

Thanks!

>  {
>  #ifdef CONFIG_TASKS_TRACE_RCU
>  	if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
> @@ -87,7 +87,7 @@ static noinstr void ct_kernel_exit_state(int offset)
>  	 * critical sections, and we also must force ordering with the
>  	 * next idle sojourn.
>  	 */
> -	rcu_dynticks_task_trace_enter();  // Before ->dynticks update!
> +	rcu_task_trace_exit();  // Before CT state update!
>  	seq = ct_state_inc(offset);
>  	// RCU is no longer watching.  Better be in extended quiescent state!
>  	WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && (seq & CT_RCU_WATCHING));
> @@ -109,7 +109,7 @@ static noinstr void ct_kernel_enter_state(int offset)
>  	 */
>  	seq = ct_state_inc(offset);
>  	// RCU is now watching.  Better not be in an extended quiescent state!
> -	rcu_dynticks_task_trace_exit();  // After ->dynticks update!
> +	rcu_task_trace_enter();  // After CT state update!
>  	WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && !(seq & CT_RCU_WATCHING));
>  }
>  
> @@ -149,7 +149,7 @@ static void noinstr ct_kernel_exit(bool user, int offset)
>  	// RCU is watching here ...
>  	ct_kernel_exit_state(offset);
>  	// ... but is no longer watching here.
> -	rcu_dynticks_task_enter();
> +	rcu_task_exit();
>  }
>  
>  /*
> @@ -173,7 +173,7 @@ static void noinstr ct_kernel_enter(bool user, int offset)
>  		ct->nesting++;
>  		return;
>  	}
> -	rcu_dynticks_task_exit();
> +	rcu_task_enter();
>  	// RCU is not watching here ...
>  	ct_kernel_enter_state(offset);
>  	// ... but is watching here.
> @@ -240,7 +240,7 @@ void noinstr ct_nmi_exit(void)
>  	// ... but is no longer watching here.
>  
>  	if (!in_nmi())
> -		rcu_dynticks_task_enter();
> +		rcu_task_exit();
>  }
>  
>  /**
> @@ -274,7 +274,7 @@ void noinstr ct_nmi_enter(void)
>  	if (rcu_dynticks_curr_cpu_in_eqs()) {
>  
>  		if (!in_nmi())
> -			rcu_dynticks_task_exit();
> +			rcu_task_enter();
>  
>  		// RCU is not watching here ...
>  		ct_kernel_enter_state(CT_RCU_WATCHING);
> -- 
> 2.43.0
> 

  parent reply	other threads:[~2024-07-31 16:07 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24 14:43 [PATCH v3 00/25] context_tracking, rcu: Spring cleaning of dynticks references Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 01/25] treewide: context_tracking: Rename CONTEXT_* into CT_STATE_* Valentin Schneider
2024-07-26 17:41   ` Thomas Gleixner
2024-07-24 14:43 ` [PATCH v3 02/25] context_tracking, rcu: Rename RCU_DYNTICKS_IDX into CT_RCU_WATCHING Valentin Schneider
2024-07-26 17:43   ` Thomas Gleixner
2024-07-24 14:43 ` [PATCH v3 03/25] context_tracking, rcu: Rename ct_dynticks() into ct_rcu_watching() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 04/25] context_tracking, rcu: Rename ct_dynticks_cpu() into ct_rcu_watching_cpu() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 05/25] context_tracking, rcu: Rename ct_dynticks_cpu_acquire() into ct_rcu_watching_cpu_acquire() Valentin Schneider
2024-07-24 20:20   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 06/25] context_tracking, rcu: Rename struct context_tracking .dynticks_nesting into .nesting Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 07/25] context_tracking, rcu: Rename ct_dynticks_nesting() into ct_nesting() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 08/25] context_tracking, rcu: Rename ct_dynticks_nesting_cpu() into ct_nesting_cpu() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 09/25] context_tracking, rcu: Rename struct context_tracking .dynticks_nmi_nesting into .nmi_nesting Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 10/25] context_tracking, rcu: Rename ct_dynticks_nmi_nesting() into ct_nmi_nesting() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 11/25] context_tracking, rcu: Rename ct_dynticks_nmi_nesting_cpu() into ct_nmi_nesting_cpu() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 12/25] context_tracking, rcu: Rename DYNTICK_IRQ_NONIDLE into CT_NESTING_IRQ_NONIDLE Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 13/25] context_tracking, rcu: Rename rcu_dynticks_task*() into rcu_task*() Valentin Schneider
2024-07-25 14:32   ` RCU-Task[-Trace] VS EQS (was Re: [PATCH v3 13/25] context_tracking, rcu: Rename rcu_dynticks_task*() into rcu_task*()) Frederic Weisbecker
2024-07-30 14:23     ` Paul E. McKenney
2024-07-30 22:17       ` Frederic Weisbecker
2024-07-30 22:39         ` Paul E. McKenney
2024-07-31 12:28           ` Frederic Weisbecker
2024-08-03  4:32             ` Paul E. McKenney
2024-08-05  9:01               ` Peter Zijlstra
2024-08-05 12:18                 ` Frederic Weisbecker
2024-08-05 13:26               ` Frederic Weisbecker
2024-08-05 17:04                 ` Paul E. McKenney
2024-07-31 16:07   ` Frederic Weisbecker [this message]
2024-08-14 12:06     ` [PATCH v3 13/25] context_tracking, rcu: Rename rcu_dynticks_task*() into rcu_task*() Neeraj Upadhyay
2024-08-15 14:14       ` Frederic Weisbecker
2024-08-16 10:19       ` Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 14/25] context_tracking, rcu: Rename rcu_dynticks_curr_cpu_in_eqs() into rcu_watching_curr_cpu() Valentin Schneider
2024-07-25 12:10   ` Frederic Weisbecker
2024-07-25 14:46     ` Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 15/25] rcu: Rename rcu_dynticks_eqs_online() into rcu_watching_online() Valentin Schneider
2024-07-25 12:12   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 16/25] rcu: Rename rcu_dynticks_in_eqs() into rcu_watching_snap_in_eqs() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 17/25] rcu: Rename rcu_dynticks_in_eqs_since() into rcu_watching_snap_stopped_since() Valentin Schneider
2024-07-25 12:18   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 18/25] rcu: Rename rcu_dynticks_zero_in_eqs() into rcu_watching_zero_in_eqs() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 19/25] rcu: Rename struct rcu_data .dynticks_snap into .watching_snap Valentin Schneider
2024-07-25 12:21   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 20/25] rcu: Rename struct rcu_data .exp_dynticks_snap into .exp_watching_snap Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 21/25] rcu: Rename dyntick_save_progress_counter() into rcu_watching_snap_save() Valentin Schneider
2024-07-25 12:24   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 22/25] rcu: Rename rcu_implicit_dynticks_qs() into rcu_implicit_eqs() Valentin Schneider
2024-07-25 12:27   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 23/25] rcu: Rename rcu_momentary_dyntick_idle() into rcu_momentary_eqs() Valentin Schneider
2024-07-24 14:43 ` [PATCH v3 24/25] rcu: Update stray documentation references to rcu_dynticks_eqs_{enter, exit}() Valentin Schneider
2024-07-25 12:32   ` Frederic Weisbecker
2024-07-24 14:43 ` [PATCH v3 25/25] context_tracking, rcu: Rename rcu_dyntick trace event into rcu_watching Valentin Schneider
2024-07-25 12:39   ` Frederic Weisbecker
2024-07-25 14:47     ` Valentin Schneider
2024-07-25 15:22 ` [PATCH v3 00/25] context_tracking, rcu: Spring cleaning of dynticks references Neeraj Upadhyay
2024-07-25 16:07   ` Valentin Schneider
2024-07-25 16:44     ` Paul E. McKenney
2024-07-26 14:43   ` Valentin Schneider
2024-07-29  2:42     ` Neeraj Upadhyay

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=ZqphRBrI4mlSdER4@localhost.localdomain \
    --to=frederic@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qiang.zhang1211@gmail.com \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=vschneid@redhat.com \
    /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