Re: [PATCH tip/core/rcu 17/86] rcu: fix boost-tracing bug and update tracing documentation

Paul E. McKenney
2011-05-02T21:37:08Z

On Mon, May 02, 2011 at 09:18:24AM -0700, Paul E. McKenney wrote:
> On Mon, May 02, 2011 at 01:33:01AM -0700, Paul E. McKenney wrote:
> > On Sun, May 01, 2011 at 08:43:10AM -0700, Josh Triplett wrote:
> > > The bugfix here should really go in a separate commit from the updated
> > > documentation. Also:
> > >
> > > On Sun, May 01, 2011 at 06:20:57AM -0700, Paul E. McKenney wrote:
> > > > --- a/Documentation/RCU/trace.txt
> > > > +++ b/Documentation/RCU/trace.txt
> > > > @@ -10,34 +10,37 @@ for rcutree and next for rcutiny.
> > > >
> > > > CONFIG_TREE_RCU and CONFIG_TREE_PREEMPT_RCU debugfs Files and Formats
> > > >
> > > > -These implementations of RCU provides five debugfs files under the
> > > > +These implementations of RCU provides seven debugfs files under the
> > >
> > > s/seven/several/, so this doesn't continue to need updates as you add
> > > more tracing? It doesn't seem entirely accurate even now, given that
> > > the set of files available now depends on CONFIG_RCU_BOOST.
> >
> > Good point, will fix.
> >
> > > > top-level directory RCU: rcu/rcudata (which displays fields in struct
> > >
> > > RCU or rcu?
> >
> > Indeed, "rcu". Will fix.
> >
> > > > rcu_data), rcu/rcudata.csv (which is a .csv spreadsheet version of
> > > > rcu/rcudata), rcu/rcugp (which displays grace-period counters),
> > > > -rcu/rcuhier (which displays the struct rcu_node hierarchy), and
> > > > +rcu/rcuhier (which displays the struct rcu_node hierarchy),
> > > > rcu/rcu_pending (which displays counts of the reasons that the
> > > > -rcu_pending() function decided that there was core RCU work to do).
> > > > +rcu_pending() function decided that there was core RCU work to do),
> > > > +rcu/rcutorture (which displays rcutorture test progress), and, if the
> > > > +kernel is built with CONFIG_RCU_BOOST, rcu/rcuboost (which displays RCU
> > > > +boosting statistics).
> > >
> > > I think this would work better as a list:
> > >
> > > rcu/rcudata:
> > > Displays fields in struct rcu_data.
> > > rcu/rcudata.csv:
> > > Comma-separated values spreadsheet version of rcudata.
> > > rcu/rcugp:
> > > Displays grace-period counters.
> > > rcu/rcuhier
> > > Displays the struct rcu_node hierarchy.
> > > rcu/rcu_pending:
> > > Displays counts of the reasons rcu_pending() decided that RCU had
> > > work to do.
> > > rcu/rcutorture:
> > > Displays rcutorture test progress.
> > > rcu/rcuboost
> > > Displays RCU boosting statistics. Only present if
> > > CONFIG_RCU_BOOST=y.
> > >
> > > Feel free to put the descriptions on the same lines as the filenames if
> > > you prefer; however, I thought this style worked better for the
> > > descriptions longer than one line.
> >
> > Makes sense, will do a list.
> >
> > > Also, does rcu/rcutorture appear with rcutorture not loaded? Hopefully
> > > not, since rcutorture shouldn't take up any additional resources when
> > > not loaded.
> >
> > Not much choice, unfortunately. If I put the info into rcutorture, then
> > I lose it when rcutorture is unloaded. This is problematic in automated
> > tests that repeatedly load and unload rcutorture.
> >
> > But the amount of data is small, and I set things up so that TINY_RCU
> > can omit this. TREE_RCU is big enough that it doesn't really matter.
> >
> > > > --- a/kernel/rcutree_plugin.h
> > > > +++ b/kernel/rcutree_plugin.h
> > > > @@ -1086,7 +1086,7 @@ static void rcu_initiate_boost_trace(struct rcu_node *rnp)
> > > > else if (rnp->gp_tasks != NULL && rnp->qsmask != 0)
> > > > rnp->n_balk_notblocked++;
> > > > else if (rnp->gp_tasks != NULL &&
> > > > - ULONG_CMP_GE(jiffies, rnp->boost_time))
> > > > + ULONG_CMP_LT(jiffies, rnp->boost_time))
> > > > rnp->n_balk_notyet++;
> > > > else
> > > > rnp->n_balk_nos++;
> > >
> > > This bugfix should go in a separate commit.
> >
> > Excellent point, will fix.
>
> Here is the updated documentation update.

And here is the bug fix.

Thanx, Paul

------------------------------------------------------------------------

rcu: fix tracing bug thinko on boost-balk attribution

The rcu_initiate_boost_trace() function mis-attributed refusals to
initiate RCU priority boosting that were in fact due to its not yet
being time to boost. This patch fixes the faulty comparison.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 22a6a46..a21413d 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -1086,7 +1086,7 @@ static void rcu_initiate_boost_trace(struct rcu_node *rnp)
else if (rnp->gp_tasks != NULL && rnp->qsmask != 0)
rnp->n_balk_notblocked++;
else if (rnp->gp_tasks != NULL &&
- ULONG_CMP_GE(jiffies, rnp->boost_time))
+ ULONG_CMP_LT(jiffies, rnp->boost_time))
rnp->n_balk_notyet++;
else
rnp->n_balk_nos++;