lkml.org 
[lkml]   [2009]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH RFC tip/core/rcu 15/18] rcu: give different levels of the rcu_node hierarchy distinct lockdep names
    From
    Date
    On Tue, 2009-12-15 at 15:02 -0800, Paul E. McKenney wrote:
    > From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    >
    > Proposed for 2.6.34, not for inclusion.
    >
    > Previously, each level of the rcu_node hierarchy had the same rather
    > unimaginative name: "&rcu_node_class[i]". This makes lockdep diagnostics
    > involving these lockdep classes less helpful than would be nice. This
    > patch fixes this by giving each level of the rcu_node hierarchy a distinct
    > name: "rcu_node_level_0", "rcu_node_level_1", and so on.
    >
    > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    > ---
    > kernel/rcutree.c | 9 ++++++++-
    > 1 files changed, 8 insertions(+), 1 deletions(-)
    >
    > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
    > index 0a4c328..a6e45f6 100644
    > --- a/kernel/rcutree.c
    > +++ b/kernel/rcutree.c
    > @@ -1811,11 +1811,17 @@ static void __init rcu_init_levelspread(struct rcu_state *rsp)
    > */
    > static void __init rcu_init_one(struct rcu_state *rsp)
    > {
    > + static char *buf[] = { "rcu_node_level_0",
    > + "rcu_node_level_1",
    > + "rcu_node_level_2",
    > + "rcu_node_level_3" }; /* Match MAX_RCU_LVLS */
    > int cpustride = 1;
    > int i;
    > int j;
    > struct rcu_node *rnp;
    >
    > + WARN_ON_ONCE(MAX_RCU_LVLS > 4); /* Fix buf[] initialization! */

    So you're going to WARN here,

    > /* Initialize the level-tracking arrays. */
    >
    > for (i = 1; i < NUM_RCU_LVLS; i++)
    > @@ -1829,7 +1835,8 @@ static void __init rcu_init_one(struct rcu_state *rsp)
    > rnp = rsp->level[i];
    > for (j = 0; j < rsp->levelcnt[i]; j++, rnp++) {
    > spin_lock_init(&rnp->lock);
    > - lockdep_set_class(&rnp->lock, &rcu_node_class[i]);
    > + lockdep_set_class_and_name(&rnp->lock,
    > + &rcu_node_class[i], buf[i]);

    and segfault here because i overruns its bounds?

    Might as well BUG_ON then.



    \
     
     \ /
      Last update: 2009-12-16 14:05    [W:0.032 / U:0.660 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site