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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 28 Jan 2013 19:50:39 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Kent Overstreet <koverstreet@...gle.com>
Cc:	tj@...nel.org, srivatsa.bhat@...ux.vnet.ibm.com,
	rusty@...tcorp.com.au, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] generic dynamic per cpu refcounting

On 01/28, Kent Overstreet wrote:
>
> On Fri, Jan 25, 2013 at 07:29:24PM +0100, Oleg Nesterov wrote:
> > On 01/25, Oleg Nesterov wrote:
> > >
> > > > +void __percpu_ref_get(struct percpu_ref *ref, bool alloc)
> > > > +{
> > > > +	unsigned long pcpu_count;
> > > > +	uint64_t v;
> > > > +
> > > > +	pcpu_count = ACCESS_ONCE(ref->pcpu_count);
> > > > +
> > > > +	if (REF_STATUS(pcpu_count) == PCPU_REF_PTR) {
> > > > +		/* for rcu - we're not using rcu_dereference() */
> > > > +		smp_read_barrier_depends();
> > > > +		__this_cpu_inc(*((unsigned __percpu *) pcpu_count));
> > >
> > > The comment looks confusing a bit... smp_read_barrier_depends() is not
> > > for rcu, we obviously need it to access (unsigned __percpu *) pcpu_count.
> > > But yes, since we didn't use rcu_dereference() we have to add it by hand.
> >
> > Hmm. Otoh, arch/alpha uses asm-generic/percpu.h so in theory we need
> > smp_read_barrier_depends() after __this_cpu_generic_to_op() calculates the
> > "real" pointer, __this_cpu_ptr() ?
> >
> > Just curious...
>
> Don't think I follow, but I don't see how... that barriers just needs to
> be between the ACCESS_ONCE and touching the memory pointed to, the fact
> that there's a calculation in there to get the real pointer is
> irrelevant...

Yes, I was wrong. I forgot that pcp is already the pointer even in
_generic_ case, we only add the offset.

Thanks for correcting me.

Oleg.

--
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