All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: neeraj.upadhyay@kernel.org
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
	paulmck@kernel.org, joel@joelfernandes.org, boqun.feng@gmail.com,
	urezki@gmail.com, rostedt@goodmis.org,
	mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
	qiang.zhang1211@gmail.com, neeraj.iitr10@gmail.com
Subject: Re: [PATCH 2/2] context_tracking: Invoke Tasks-RCU enter/exit for NMI context
Date: Wed, 14 Aug 2024 14:47:46 +0200	[thread overview]
Message-ID: <ZryncuVGyxL1-OX1@localhost.localdomain> (raw)
In-Reply-To: <20240807163506.434885-3-neeraj.upadhyay@kernel.org>

Le Wed, Aug 07, 2024 at 10:05:06PM +0530, neeraj.upadhyay@kernel.org a écrit :
> From: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
> 
> rcu_task_enter() and rcu_task_exit() are not called on NMI
> entry and exit. So, Tasks-RCU-Rude grace period wait is required to
> ensure that NMI handlers have entered/exited into Tasks-RCU eqs.
> For architectures which do not require Tasks-RCU-Rude (as the code
> sections where RCU is not watching are marked as noinstr), when
> those architectures switch to not using Tasks-RCU-Rude, NMI handlers
> task exit to eqs will need to be handled correctly for Tasks-RCU holdout
> tasks running on nohz_full CPUs. As it is safe to call these two
> functions from NMI context, remove the in_nmi() check to ensure that
> Tasks-RCU entry/exit is marked correctly for NMI handlers.
> 
> Reported-by: Frederic Weisbecker <frederic@kernel.org>
> Suggested-by: Frederic Weisbecker <frederic@kernel.org>
> Suggested-by: "Paul E. McKenney" <paulmck@kernel.org>
> Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
> ---
>  kernel/context_tracking.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 152b485a62db..626dd7a173a5 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -239,8 +239,7 @@ void noinstr ct_nmi_exit(void)
>  	ct_kernel_exit_state(CT_RCU_WATCHING);
>  	// ... but is no longer watching here.
>  
> -	if (!in_nmi())
> -		rcu_task_exit();
> +	rcu_task_exit();

And now since it is called by all callers of ct_kernel_exit_state(), you
can call it from it directly.

>  }
>  
>  /**
> @@ -273,8 +272,7 @@ void noinstr ct_nmi_enter(void)
>  	 */
>  	if (!rcu_is_watching_curr_cpu()) {
>  
> -		if (!in_nmi())
> -			rcu_task_enter();
> +		rcu_task_enter();
>  
>  		// RCU is not watching here ...
>  		ct_kernel_enter_state(CT_RCU_WATCHING);

Ditto for ct_kernel_enter_state().

Thanks.

> -- 
> 2.40.1
> 

      parent reply	other threads:[~2024-08-14 12:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 16:35 [PATCH 0/2] Modify RCU Tasks to scan idle tasks neeraj.upadhyay
2024-08-07 16:35 ` [PATCH 1/2] rcu-tasks: Make RCU-Tasks pay attention to " neeraj.upadhyay
2024-08-08 17:59   ` Paul E. McKenney
2024-08-14 15:01   ` Frederic Weisbecker
2024-08-07 16:35 ` [PATCH 2/2] context_tracking: Invoke Tasks-RCU enter/exit for NMI context neeraj.upadhyay
2024-08-08 18:01   ` Paul E. McKenney
2024-08-14 12:47   ` Frederic Weisbecker [this message]

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=ZryncuVGyxL1-OX1@localhost.localdomain \
    --to=frederic@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=neeraj.iitr10@gmail.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang1211@gmail.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.