Commit fda70207 authored by Valentin Schneider's avatar Valentin Schneider Committed by Neeraj Upadhyay

context_tracking, rcu: Rename rcu_dynticks_curr_cpu_in_eqs() into rcu_is_watching_curr_cpu()

The context_tracking.state RCU_DYNTICKS subvariable has been renamed to
RCU_WATCHING, reflect that change in the related helpers.

Note that "watching" is the opposite of "in EQS", so the negation is lifted
out of the helper and into the callsites.
Signed-off-by: default avatarValentin Schneider <vschneid@redhat.com>
Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Signed-off-by: default avatarNeeraj Upadhyay <neeraj.upadhyay@kernel.org>
parent b1b91fd1
...@@ -113,13 +113,17 @@ extern void ct_idle_enter(void); ...@@ -113,13 +113,17 @@ extern void ct_idle_enter(void);
extern void ct_idle_exit(void); extern void ct_idle_exit(void);
/* /*
* Is the current CPU in an extended quiescent state? * Is RCU watching the current CPU (IOW, it is not in an extended quiescent state)?
*
* Note that this returns the actual boolean data (watching / not watching),
* whereas ct_rcu_watching() returns the RCU_WATCHING subvariable of
* context_tracking.state.
* *
* No ordering, as we are sampling CPU-local information. * No ordering, as we are sampling CPU-local information.
*/ */
static __always_inline bool rcu_dynticks_curr_cpu_in_eqs(void) static __always_inline bool rcu_is_watching_curr_cpu(void)
{ {
return !(raw_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_RCU_WATCHING); return raw_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_RCU_WATCHING;
} }
/* /*
...@@ -140,7 +144,7 @@ static __always_inline bool warn_rcu_enter(void) ...@@ -140,7 +144,7 @@ static __always_inline bool warn_rcu_enter(void)
* lots of the actual reporting also relies on RCU. * lots of the actual reporting also relies on RCU.
*/ */
preempt_disable_notrace(); preempt_disable_notrace();
if (rcu_dynticks_curr_cpu_in_eqs()) { if (!rcu_is_watching_curr_cpu()) {
ret = true; ret = true;
ct_state_inc(CT_RCU_WATCHING); ct_state_inc(CT_RCU_WATCHING);
} }
......
...@@ -212,7 +212,7 @@ void noinstr ct_nmi_exit(void) ...@@ -212,7 +212,7 @@ void noinstr ct_nmi_exit(void)
* to us!) * to us!)
*/ */
WARN_ON_ONCE(ct_nmi_nesting() <= 0); WARN_ON_ONCE(ct_nmi_nesting() <= 0);
WARN_ON_ONCE(rcu_dynticks_curr_cpu_in_eqs()); WARN_ON_ONCE(!rcu_is_watching_curr_cpu());
/* /*
* If the nesting level is not 1, the CPU wasn't RCU-idle, so * If the nesting level is not 1, the CPU wasn't RCU-idle, so
...@@ -271,7 +271,7 @@ void noinstr ct_nmi_enter(void) ...@@ -271,7 +271,7 @@ void noinstr ct_nmi_enter(void)
* to be in the outermost NMI handler that interrupted an RCU-idle * to be in the outermost NMI handler that interrupted an RCU-idle
* period (observation due to Andy Lutomirski). * period (observation due to Andy Lutomirski).
*/ */
if (rcu_dynticks_curr_cpu_in_eqs()) { if (!rcu_is_watching_curr_cpu()) {
if (!in_nmi()) if (!in_nmi())
rcu_task_enter(); rcu_task_enter();
...@@ -281,7 +281,7 @@ void noinstr ct_nmi_enter(void) ...@@ -281,7 +281,7 @@ void noinstr ct_nmi_enter(void)
// ... but is watching here. // ... but is watching here.
instrumentation_begin(); instrumentation_begin();
// instrumentation for the noinstr rcu_dynticks_curr_cpu_in_eqs() // instrumentation for the noinstr rcu_is_watching_curr_cpu()
instrument_atomic_read(&ct->state, sizeof(ct->state)); instrument_atomic_read(&ct->state, sizeof(ct->state));
// instrumentation for the noinstr ct_kernel_enter_state() // instrumentation for the noinstr ct_kernel_enter_state()
instrument_atomic_write(&ct->state, sizeof(ct->state)); instrument_atomic_write(&ct->state, sizeof(ct->state));
......
...@@ -601,7 +601,7 @@ void rcu_irq_exit_check_preempt(void) ...@@ -601,7 +601,7 @@ void rcu_irq_exit_check_preempt(void)
RCU_LOCKDEP_WARN(ct_nmi_nesting() != RCU_LOCKDEP_WARN(ct_nmi_nesting() !=
CT_NESTING_IRQ_NONIDLE, CT_NESTING_IRQ_NONIDLE,
"Bad RCU nmi_nesting counter\n"); "Bad RCU nmi_nesting counter\n");
RCU_LOCKDEP_WARN(rcu_dynticks_curr_cpu_in_eqs(), RCU_LOCKDEP_WARN(!rcu_is_watching_curr_cpu(),
"RCU in extended quiescent state!"); "RCU in extended quiescent state!");
} }
#endif /* #ifdef CONFIG_PROVE_RCU */ #endif /* #ifdef CONFIG_PROVE_RCU */
...@@ -641,7 +641,7 @@ void __rcu_irq_enter_check_tick(void) ...@@ -641,7 +641,7 @@ void __rcu_irq_enter_check_tick(void)
if (in_nmi()) if (in_nmi())
return; return;
RCU_LOCKDEP_WARN(rcu_dynticks_curr_cpu_in_eqs(), RCU_LOCKDEP_WARN(!rcu_is_watching_curr_cpu(),
"Illegal rcu_irq_enter_check_tick() from extended quiescent state"); "Illegal rcu_irq_enter_check_tick() from extended quiescent state");
if (!tick_nohz_full_cpu(rdp->cpu) || if (!tick_nohz_full_cpu(rdp->cpu) ||
...@@ -723,7 +723,7 @@ notrace bool rcu_is_watching(void) ...@@ -723,7 +723,7 @@ notrace bool rcu_is_watching(void)
bool ret; bool ret;
preempt_disable_notrace(); preempt_disable_notrace();
ret = !rcu_dynticks_curr_cpu_in_eqs(); ret = rcu_is_watching_curr_cpu();
preempt_enable_notrace(); preempt_enable_notrace();
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment