lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 26 Aug 2008 17:38:36 -0700
From:	Josh Triplett <josht@...ux.vnet.ibm.com>
To:	paulmck@...ux.vnet.ibm.com
Cc:	linux-kernel@...r.kernel.org, cl@...ux-foundation.org,
	mingo@...e.hu, akpm@...ux-foundation.org, manfred@...orfullife.com,
	dipankar@...ibm.com, schamp@....com, niv@...ibm.com,
	dvhltc@...ibm.com, ego@...ibm.com, laijs@...fujitsu.com,
	rostedt@...dmis.org
Subject: Re: [PATCH, RFC, tip/core/rcu] scalable classic RCU implementation

On Tue, 2008-08-26 at 09:05 -0700, Paul E. McKenney wrote:
> On Mon, Aug 25, 2008 at 03:02:30PM -0700, Josh Triplett wrote:
> > On Fri, 2008-08-22 at 18:53 -0700, Paul E. McKenney wrote:
> > > On Fri, Aug 22, 2008 at 04:29:32PM -0700, Josh Triplett wrote:
> > > > On Thu, 2008-08-21 at 16:43 -0700, Paul E. McKenney wrote:
> > > > > @@ -658,14 +806,19 @@ int rcu_needs_cpu(int cpu)
> > > > >  	struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
> > > > >  	struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);
> > > > > 
> > > > > -	return !!rdp->nxtlist || !!rdp_bh->nxtlist || rcu_pending(cpu);
> > > > > +	return !!*rdp->nxttail[RCU_DONE_TAIL] ||
> > > > > +	       !!*rdp_bh->nxttail[RCU_DONE_TAIL] ||
> > > > > +	       rcu_pending(cpu);
> > > > 
> > > > !! seems unnecessary here.
> > > 
> > > Someone once told me why this was necessary, but I forget.  It was in the
> > > original, and I didn't put it there.  Some weirdness about conversion
> > > to 32-bit integer when the lower 32 bits of the pointer was zero or
> > > some such.  So if your pointer value was 0x100000000, for example,
> > > so that conversion to int gives zero.
> > 
> > Good point!  That doesn't apply if you use ||, though.  If you just did
> > "return somepointer" that could potentially cause the problem you
> > describe.  In any case, it can't *hurt* to have it; GCC should do the
> > sane thing.
> 
> OK.  I will review this towards the end, leaving it there to remind me
> in the meantime.
> 
> So, would I need the !! on the left-hand operand of the first || due
> to short-circuiting?

No.  || will always return 1 or 0.  You only need the !! if you want to
directly return the boolean value of a potentially 64-bit pointer.

- Josh Triplett


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ