All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	dennis.chen@arm.com, jiangshanlai@gmail.com,
	josh@joshtriplett.org, LKML <linux-kernel@vger.kernel.org>,
	mathieu.desnoyers@efficios.com,
	Steven Rostedt <rostedt@goodmis.org>,
	steve.capper@arm.com, Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] rcu: tree: correctly handle sparse possible CPUs
Date: Wed, 18 May 2016 11:44:16 -0700	[thread overview]
Message-ID: <20160518184416.GC3528@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160518183041.GB8664@svinekod>

On Wed, May 18, 2016 at 07:30:41PM +0100, Mark Rutland wrote:
> On Wed, May 18, 2016 at 11:01:53AM -0700, Paul E. McKenney wrote:
> > On Wed, May 18, 2016 at 06:15:23PM +0300, Andrey Ryabinin wrote:
> > > 2016-05-16 19:48 GMT+03:00 Mark Rutland <mark.rutland@arm.com>:
> > > 
> > > >  /*
> > > > + * Iterate over all possible CPUs in a leaf RCU node.
> > > > + */
> > > > +#define for_each_leaf_node_possible_cpu(rnp, cpu) \
> > > > +       for ((cpu) = rnp->grplo; \
> > > > +            cpu <= rnp->grphi; \
> > > > +            cpu = cpumask_next((cpu), cpu_possible_mask))
> > > > +
> > > > +/*
> > > > + * Iterate over all possible CPUs in a leaf RCU node, at each step providing a
> > > > + * bit for comparison against rcu_node bitmasks.
> > > > + */
> > > > +#define for_each_leaf_node_possible_cpu_bit(rnp, cpu, bit) \
> > > > +       for ((cpu) = rnp->grplo, (bit) = 1; \
> > > > +            cpu <= rnp->grphi; \
> > > > +            cpu = cpumask_next((cpu), cpu_possible_mask), \
> > > > +                  (bit) = 1UL << (cpu - rnp->grplo))
> > > > +
> > > 
> > > [    0.163652] UBSAN: Undefined behaviour in ../kernel/rcu/tree.c:2912:3
> > > [    0.164000] shift exponent 64 is too large for 64-bit type 'long
> > > unsigned int'
> > 
> > Ah, dead value, but can happen nevertheless.  One fix is to prevent the
> > assignment to bit when cpu > rnp->grphi.
> > 
> > Any ideas for a better fix?  And isn't there some combination of
> > signedness that makes shifting all the bits out of the value defined
> > to zero?  Or is that only for right shifts?
> 
> We could add a (leaf/rcu)_node_cpu_mask(rnp, cpu) macro, and only use that in
> the body of the loop. That would avoid the stale value and would be useful in a
> couple of additional places.
> 
> If that makes sense to you, I can respin the patch with that.

Please try it and then let's see what it looks like.

							Thanx, Paul

      reply	other threads:[~2016-05-18 18:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 16:48 [PATCH] rcu: tree: correctly handle sparse possible CPUs Mark Rutland
2016-05-16 19:19 ` Paul E. McKenney
2016-05-17 10:22   ` [PATCHv2] " Mark Rutland
2016-05-17 19:01     ` Paul E. McKenney
2016-05-13  1:27       ` Mark Rutland
2016-05-18  0:12       ` Paul E. McKenney
2016-05-18 12:02         ` Arnd Bergmann
2016-05-18 18:15           ` Mark Rutland
2016-05-18 18:41             ` Paul E. McKenney
2016-05-20 10:30     ` kbuild test robot
2016-05-18 15:15 ` [PATCH] " Andrey Ryabinin
2016-05-18 18:01   ` Paul E. McKenney
2016-05-18 18:30     ` Mark Rutland
2016-05-18 18:44       ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160518184416.GC3528@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dennis.chen@arm.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=steve.capper@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.