diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-05-01 15:54:11 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-07-12 18:38:43 -0400 |
| commit | 477351f7829d2268769c5d545511081555066529 (patch) | |
| tree | 8f26f07f259f50a659ef51b875fe0ce636acc07b /kernel/rcu/tree.c | |
| parent | ab5e869c1f7aa30a1210f5e8a277758b0599609f (diff) | |
rcu: Convert rcu_grace_period tracepoint to gp_seq
This commit makes the rcu_grace_period tracepoint use gp_seq instead
of ->gpnum or ->completed. It also introduces a "cpuofl-bgp" string to
less obscurely indicate when a CPU has gone offline while a grace period
is waiting on it.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcu/tree.c')
| -rw-r--r-- | kernel/rcu/tree.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 4826598867c3..7ce85ad39af6 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -234,7 +234,7 @@ void rcu_sched_qs(void) | |||
| 234 | if (!__this_cpu_read(rcu_sched_data.cpu_no_qs.s)) | 234 | if (!__this_cpu_read(rcu_sched_data.cpu_no_qs.s)) |
| 235 | return; | 235 | return; |
| 236 | trace_rcu_grace_period(TPS("rcu_sched"), | 236 | trace_rcu_grace_period(TPS("rcu_sched"), |
| 237 | __this_cpu_read(rcu_sched_data.gpnum), | 237 | __this_cpu_read(rcu_sched_data.gp_seq), |
| 238 | TPS("cpuqs")); | 238 | TPS("cpuqs")); |
| 239 | __this_cpu_write(rcu_sched_data.cpu_no_qs.b.norm, false); | 239 | __this_cpu_write(rcu_sched_data.cpu_no_qs.b.norm, false); |
| 240 | if (!__this_cpu_read(rcu_sched_data.cpu_no_qs.b.exp)) | 240 | if (!__this_cpu_read(rcu_sched_data.cpu_no_qs.b.exp)) |
| @@ -249,7 +249,7 @@ void rcu_bh_qs(void) | |||
| 249 | RCU_LOCKDEP_WARN(preemptible(), "rcu_bh_qs() invoked with preemption enabled!!!"); | 249 | RCU_LOCKDEP_WARN(preemptible(), "rcu_bh_qs() invoked with preemption enabled!!!"); |
| 250 | if (__this_cpu_read(rcu_bh_data.cpu_no_qs.s)) { | 250 | if (__this_cpu_read(rcu_bh_data.cpu_no_qs.s)) { |
| 251 | trace_rcu_grace_period(TPS("rcu_bh"), | 251 | trace_rcu_grace_period(TPS("rcu_bh"), |
| 252 | __this_cpu_read(rcu_bh_data.gpnum), | 252 | __this_cpu_read(rcu_bh_data.gp_seq), |
| 253 | TPS("cpuqs")); | 253 | TPS("cpuqs")); |
| 254 | __this_cpu_write(rcu_bh_data.cpu_no_qs.b.norm, false); | 254 | __this_cpu_write(rcu_bh_data.cpu_no_qs.b.norm, false); |
| 255 | } | 255 | } |
| @@ -1615,7 +1615,7 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, struct rcu_data *rdp, | |||
| 1615 | trace_rcu_this_gp(rnp_root, rdp, c, TPS("NoGPkthread")); | 1615 | trace_rcu_this_gp(rnp_root, rdp, c, TPS("NoGPkthread")); |
| 1616 | goto unlock_out; | 1616 | goto unlock_out; |
| 1617 | } | 1617 | } |
| 1618 | trace_rcu_grace_period(rsp->name, READ_ONCE(rsp->gpnum), TPS("newreq")); | 1618 | trace_rcu_grace_period(rsp->name, READ_ONCE(rsp->gp_seq), TPS("newreq")); |
| 1619 | ret = true; /* Caller must wake GP kthread. */ | 1619 | ret = true; /* Caller must wake GP kthread. */ |
| 1620 | unlock_out: | 1620 | unlock_out: |
| 1621 | /* Push furthest requested GP to leaf node and rcu_data structure. */ | 1621 | /* Push furthest requested GP to leaf node and rcu_data structure. */ |
| @@ -1702,9 +1702,9 @@ static bool rcu_accelerate_cbs(struct rcu_state *rsp, struct rcu_node *rnp, | |||
| 1702 | 1702 | ||
| 1703 | /* Trace depending on how much we were able to accelerate. */ | 1703 | /* Trace depending on how much we were able to accelerate. */ |
| 1704 | if (rcu_segcblist_restempty(&rdp->cblist, RCU_WAIT_TAIL)) | 1704 | if (rcu_segcblist_restempty(&rdp->cblist, RCU_WAIT_TAIL)) |
| 1705 | trace_rcu_grace_period(rsp->name, rdp->gpnum, TPS("AccWaitCB")); | 1705 | trace_rcu_grace_period(rsp->name, rdp->gp_seq, TPS("AccWaitCB")); |
| 1706 | else | 1706 | else |
| 1707 | trace_rcu_grace_period(rsp->name, rdp->gpnum, TPS("AccReadyCB")); | 1707 | trace_rcu_grace_period(rsp->name, rdp->gp_seq, TPS("AccReadyCB")); |
| 1708 | return ret; | 1708 | return ret; |
| 1709 | } | 1709 | } |
| 1710 | 1710 | ||
| @@ -1774,7 +1774,7 @@ static bool __note_gp_changes(struct rcu_state *rsp, struct rcu_node *rnp, | |||
| 1774 | * go looking for one. | 1774 | * go looking for one. |
| 1775 | */ | 1775 | */ |
| 1776 | rdp->gpnum = rnp->gpnum; | 1776 | rdp->gpnum = rnp->gpnum; |
| 1777 | trace_rcu_grace_period(rsp->name, rdp->gpnum, TPS("cpustart")); | 1777 | trace_rcu_grace_period(rsp->name, rdp->gp_seq, TPS("cpustart")); |
| 1778 | need_gp = !!(rnp->qsmask & rdp->grpmask); | 1778 | need_gp = !!(rnp->qsmask & rdp->grpmask); |
| 1779 | rdp->cpu_no_qs.b.norm = need_gp; | 1779 | rdp->cpu_no_qs.b.norm = need_gp; |
| 1780 | rdp->rcu_qs_ctr_snap = __this_cpu_read(rcu_dynticks.rcu_qs_ctr); | 1780 | rdp->rcu_qs_ctr_snap = __this_cpu_read(rcu_dynticks.rcu_qs_ctr); |
| @@ -1851,7 +1851,7 @@ static bool rcu_gp_init(struct rcu_state *rsp) | |||
| 1851 | rcu_seq_start(&rsp->gp_seq); | 1851 | rcu_seq_start(&rsp->gp_seq); |
| 1852 | if (WARN_ON_ONCE(((rnp->completed << RCU_SEQ_CTR_SHIFT) >> RCU_SEQ_CTR_SHIFT) != rcu_seq_ctr(rnp->gp_seq))) /* Catch any ->completed/->gp_seq mismatches. */ | 1852 | if (WARN_ON_ONCE(((rnp->completed << RCU_SEQ_CTR_SHIFT) >> RCU_SEQ_CTR_SHIFT) != rcu_seq_ctr(rnp->gp_seq))) /* Catch any ->completed/->gp_seq mismatches. */ |
| 1853 | pr_info("%s ->completed: %#lx (%#lx) ->gp_seq %#lx (%#lx)\n", __func__, rnp->completed, (rnp->completed << RCU_SEQ_CTR_SHIFT) >> RCU_SEQ_CTR_SHIFT, rnp->gp_seq, rcu_seq_ctr(rnp->gp_seq)); | 1853 | pr_info("%s ->completed: %#lx (%#lx) ->gp_seq %#lx (%#lx)\n", __func__, rnp->completed, (rnp->completed << RCU_SEQ_CTR_SHIFT) >> RCU_SEQ_CTR_SHIFT, rnp->gp_seq, rcu_seq_ctr(rnp->gp_seq)); |
| 1854 | trace_rcu_grace_period(rsp->name, rsp->gpnum, TPS("start")); | 1854 | trace_rcu_grace_period(rsp->name, rsp->gp_seq, TPS("start")); |
| 1855 | raw_spin_unlock_irq_rcu_node(rnp); | 1855 | raw_spin_unlock_irq_rcu_node(rnp); |
| 1856 | 1856 | ||
| 1857 | /* | 1857 | /* |
| @@ -1928,7 +1928,7 @@ static bool rcu_gp_init(struct rcu_state *rsp) | |||
| 1928 | if (rnp == rdp->mynode) | 1928 | if (rnp == rdp->mynode) |
| 1929 | (void)__note_gp_changes(rsp, rnp, rdp); | 1929 | (void)__note_gp_changes(rsp, rnp, rdp); |
| 1930 | rcu_preempt_boost_start_gp(rnp); | 1930 | rcu_preempt_boost_start_gp(rnp); |
| 1931 | trace_rcu_grace_period_init(rsp->name, rnp->gpnum, | 1931 | trace_rcu_grace_period_init(rsp->name, rnp->gp_seq, |
| 1932 | rnp->level, rnp->grplo, | 1932 | rnp->level, rnp->grplo, |
| 1933 | rnp->grphi, rnp->qsmask); | 1933 | rnp->grphi, rnp->qsmask); |
| 1934 | raw_spin_unlock_irq_rcu_node(rnp); | 1934 | raw_spin_unlock_irq_rcu_node(rnp); |
| @@ -2048,7 +2048,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
| 2048 | /* Declare grace period done. */ | 2048 | /* Declare grace period done. */ |
| 2049 | WRITE_ONCE(rsp->completed, rsp->gpnum); | 2049 | WRITE_ONCE(rsp->completed, rsp->gpnum); |
| 2050 | rcu_seq_end(&rsp->gp_seq); | 2050 | rcu_seq_end(&rsp->gp_seq); |
| 2051 | trace_rcu_grace_period(rsp->name, rsp->completed, TPS("end")); | 2051 | trace_rcu_grace_period(rsp->name, rsp->gp_seq, TPS("end")); |
| 2052 | rsp->gp_state = RCU_GP_IDLE; | 2052 | rsp->gp_state = RCU_GP_IDLE; |
| 2053 | /* Check for GP requests since above loop. */ | 2053 | /* Check for GP requests since above loop. */ |
| 2054 | rdp = this_cpu_ptr(rsp->rda); | 2054 | rdp = this_cpu_ptr(rsp->rda); |
| @@ -2061,7 +2061,7 @@ static void rcu_gp_cleanup(struct rcu_state *rsp) | |||
| 2061 | if (!rcu_accelerate_cbs(rsp, rnp, rdp) && needgp) { | 2061 | if (!rcu_accelerate_cbs(rsp, rnp, rdp) && needgp) { |
| 2062 | WRITE_ONCE(rsp->gp_flags, RCU_GP_FLAG_INIT); | 2062 | WRITE_ONCE(rsp->gp_flags, RCU_GP_FLAG_INIT); |
| 2063 | rsp->gp_req_activity = jiffies; | 2063 | rsp->gp_req_activity = jiffies; |
| 2064 | trace_rcu_grace_period(rsp->name, READ_ONCE(rsp->gpnum), | 2064 | trace_rcu_grace_period(rsp->name, READ_ONCE(rsp->gp_seq), |
| 2065 | TPS("newreq")); | 2065 | TPS("newreq")); |
| 2066 | } else { | 2066 | } else { |
| 2067 | WRITE_ONCE(rsp->gp_flags, rsp->gp_flags & RCU_GP_FLAG_INIT); | 2067 | WRITE_ONCE(rsp->gp_flags, rsp->gp_flags & RCU_GP_FLAG_INIT); |
| @@ -2087,7 +2087,7 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
| 2087 | /* Handle grace-period start. */ | 2087 | /* Handle grace-period start. */ |
| 2088 | for (;;) { | 2088 | for (;;) { |
| 2089 | trace_rcu_grace_period(rsp->name, | 2089 | trace_rcu_grace_period(rsp->name, |
| 2090 | READ_ONCE(rsp->gpnum), | 2090 | READ_ONCE(rsp->gp_seq), |
| 2091 | TPS("reqwait")); | 2091 | TPS("reqwait")); |
| 2092 | rsp->gp_state = RCU_GP_WAIT_GPS; | 2092 | rsp->gp_state = RCU_GP_WAIT_GPS; |
| 2093 | swait_event_idle(rsp->gp_wq, READ_ONCE(rsp->gp_flags) & | 2093 | swait_event_idle(rsp->gp_wq, READ_ONCE(rsp->gp_flags) & |
| @@ -2100,7 +2100,7 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
| 2100 | WRITE_ONCE(rsp->gp_activity, jiffies); | 2100 | WRITE_ONCE(rsp->gp_activity, jiffies); |
| 2101 | WARN_ON(signal_pending(current)); | 2101 | WARN_ON(signal_pending(current)); |
| 2102 | trace_rcu_grace_period(rsp->name, | 2102 | trace_rcu_grace_period(rsp->name, |
| 2103 | READ_ONCE(rsp->gpnum), | 2103 | READ_ONCE(rsp->gp_seq), |
| 2104 | TPS("reqwaitsig")); | 2104 | TPS("reqwaitsig")); |
| 2105 | } | 2105 | } |
| 2106 | 2106 | ||
| @@ -2119,7 +2119,7 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
| 2119 | jiffies + 3 * j); | 2119 | jiffies + 3 * j); |
| 2120 | } | 2120 | } |
| 2121 | trace_rcu_grace_period(rsp->name, | 2121 | trace_rcu_grace_period(rsp->name, |
| 2122 | READ_ONCE(rsp->gpnum), | 2122 | READ_ONCE(rsp->gp_seq), |
| 2123 | TPS("fqswait")); | 2123 | TPS("fqswait")); |
| 2124 | rsp->gp_state = RCU_GP_WAIT_FQS; | 2124 | rsp->gp_state = RCU_GP_WAIT_FQS; |
| 2125 | ret = swait_event_idle_timeout(rsp->gp_wq, | 2125 | ret = swait_event_idle_timeout(rsp->gp_wq, |
| @@ -2134,12 +2134,12 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
| 2134 | if (ULONG_CMP_GE(jiffies, rsp->jiffies_force_qs) || | 2134 | if (ULONG_CMP_GE(jiffies, rsp->jiffies_force_qs) || |
| 2135 | (gf & RCU_GP_FLAG_FQS)) { | 2135 | (gf & RCU_GP_FLAG_FQS)) { |
| 2136 | trace_rcu_grace_period(rsp->name, | 2136 | trace_rcu_grace_period(rsp->name, |
| 2137 | READ_ONCE(rsp->gpnum), | 2137 | READ_ONCE(rsp->gp_seq), |
| 2138 | TPS("fqsstart")); | 2138 | TPS("fqsstart")); |
| 2139 | rcu_gp_fqs(rsp, first_gp_fqs); | 2139 | rcu_gp_fqs(rsp, first_gp_fqs); |
| 2140 | first_gp_fqs = false; | 2140 | first_gp_fqs = false; |
| 2141 | trace_rcu_grace_period(rsp->name, | 2141 | trace_rcu_grace_period(rsp->name, |
| 2142 | READ_ONCE(rsp->gpnum), | 2142 | READ_ONCE(rsp->gp_seq), |
| 2143 | TPS("fqsend")); | 2143 | TPS("fqsend")); |
| 2144 | cond_resched_tasks_rcu_qs(); | 2144 | cond_resched_tasks_rcu_qs(); |
| 2145 | WRITE_ONCE(rsp->gp_activity, jiffies); | 2145 | WRITE_ONCE(rsp->gp_activity, jiffies); |
| @@ -2158,7 +2158,7 @@ static int __noreturn rcu_gp_kthread(void *arg) | |||
| 2158 | WRITE_ONCE(rsp->gp_activity, jiffies); | 2158 | WRITE_ONCE(rsp->gp_activity, jiffies); |
| 2159 | WARN_ON(signal_pending(current)); | 2159 | WARN_ON(signal_pending(current)); |
| 2160 | trace_rcu_grace_period(rsp->name, | 2160 | trace_rcu_grace_period(rsp->name, |
| 2161 | READ_ONCE(rsp->gpnum), | 2161 | READ_ONCE(rsp->gp_seq), |
| 2162 | TPS("fqswaitsig")); | 2162 | TPS("fqswaitsig")); |
| 2163 | ret = 1; /* Keep old FQS timing. */ | 2163 | ret = 1; /* Keep old FQS timing. */ |
| 2164 | j = jiffies; | 2164 | j = jiffies; |
| @@ -2388,17 +2388,16 @@ rcu_check_quiescent_state(struct rcu_state *rsp, struct rcu_data *rdp) | |||
| 2388 | */ | 2388 | */ |
| 2389 | static void rcu_cleanup_dying_cpu(struct rcu_state *rsp) | 2389 | static void rcu_cleanup_dying_cpu(struct rcu_state *rsp) |
| 2390 | { | 2390 | { |
| 2391 | RCU_TRACE(unsigned long mask;) | 2391 | RCU_TRACE(bool blkd;) |
| 2392 | RCU_TRACE(struct rcu_data *rdp = this_cpu_ptr(rsp->rda);) | 2392 | RCU_TRACE(struct rcu_data *rdp = this_cpu_ptr(rsp->rda);) |
| 2393 | RCU_TRACE(struct rcu_node *rnp = rdp->mynode;) | 2393 | RCU_TRACE(struct rcu_node *rnp = rdp->mynode;) |
| 2394 | 2394 | ||
| 2395 | if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) | 2395 | if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) |
| 2396 | return; | 2396 | return; |
| 2397 | 2397 | ||
| 2398 | RCU_TRACE(mask = rdp->grpmask;) | 2398 | RCU_TRACE(blkd = !!(rnp->qsmask & rdp->grpmask);) |
| 2399 | trace_rcu_grace_period(rsp->name, | 2399 | trace_rcu_grace_period(rsp->name, rnp->gp_seq, |
| 2400 | rnp->gpnum + 1 - !!(rnp->qsmask & mask), | 2400 | blkd ? TPS("cpuofl") : TPS("cpuofl-bgp")); |
| 2401 | TPS("cpuofl")); | ||
| 2402 | } | 2401 | } |
| 2403 | 2402 | ||
| 2404 | /* | 2403 | /* |
| @@ -3538,7 +3537,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp) | |||
| 3538 | rdp->core_needs_qs = false; | 3537 | rdp->core_needs_qs = false; |
| 3539 | rdp->rcu_iw_pending = false; | 3538 | rdp->rcu_iw_pending = false; |
| 3540 | rdp->rcu_iw_gp_seq = rnp->gp_seq - 1; | 3539 | rdp->rcu_iw_gp_seq = rnp->gp_seq - 1; |
| 3541 | trace_rcu_grace_period(rsp->name, rdp->gpnum, TPS("cpuonl")); | 3540 | trace_rcu_grace_period(rsp->name, rdp->gp_seq, TPS("cpuonl")); |
| 3542 | raw_spin_unlock_irqrestore_rcu_node(rnp, flags); | 3541 | raw_spin_unlock_irqrestore_rcu_node(rnp, flags); |
| 3543 | } | 3542 | } |
| 3544 | 3543 | ||
