All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.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:01:53 -0700	[thread overview]
Message-ID: <20160518180153.GA3528@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAPAsAGzYxfEsc8EMVHr0NFP1x1CjtdHbi_GApfbu18of98mBvw@mail.gmail.com>

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?

							Thanx, Paul

  reply	other threads:[~2016-05-18 18:01 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 [this message]
2016-05-18 18:30     ` Mark Rutland
2016-05-18 18:44       ` Paul E. McKenney

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=20160518180153.GA3528@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.