Message ID | 20240807163506.434885-3-neeraj.upadhyay@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Modify RCU Tasks to scan idle tasks | expand |
On Wed, Aug 07, 2024 at 10:05:06PM +0530, neeraj.upadhyay@kernel.org wrote: > 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. This last sentence could be broken up. ;-) Other than that, looks good! Reviewed-by: Paul E. McKenney <paulmck@kernel.org> > 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(); > } > > /** > @@ -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); > -- > 2.40.1 >
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 >
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(); } /** @@ -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);