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:	Wed, 15 Jun 2011 18:39:52 +0200
From:	Tejun Heo <tj@...nel.org>
To:	Christoph Lameter <cl@...ux.com>
Cc:	Pekka Enberg <penberg@...helsinki.fi>,
	David Rientjes <rientjes@...gle.com>,
	Eric Dumazet <eric.dumazet@...il.com>,
	"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [slubllv7 04/17] x86: Add support for cmpxchg_double

Hello, Christoph.

On Wed, Jun 15, 2011 at 09:26:15AM -0500, Christoph Lameter wrote:
> > Do we really need cmpxchg16b*() macros separately?  Why not just
> > collapse them into cmpxchg_double*()?  Also, it would be better if we
> > have the same level of VM_BUG_ON() checks as in percpu cmpxchg_double
> > ops.  Maybe we should put them in a separate macro?
> 
> The method here is to put all the high level checks in cmpxchg_double()
> and then do the low level asm stuff in cmpxchg16b macros. I think that is
> a good separation.

I don't know; then, I think the name better clearly indicate that
they're not used outside of implementation.  I don't see merit in
keeping them separate.

> > > +#define system_has_cmpxchg_double() cpu_has_cx16
> >
> > Where's the fallback %false definition for the above feature macro for
> > archs which don't support cmpxchg_double?  Also, is system_has_*()
> > conventional?  Isn't arch_has_*() more conventional for this purpose?
> 
> There is a convention for querying processor flags from core code?

At least generic ptrace code uses arch_has_block/single_step().
Probably better than introducing something completely new.

> The system_has_cmpxchg_double() is only used if the arch defines
> CONFIG_CMPXCHG_DOUBLE

Why?  What's the benefit of that?

> This way it is done in the same way on 32 bit than on 64 bit. The use of
> cmpxchg64 also means that some of the parameters would have to be combined
> to form 64 bit ints from the 32 bit ones before __cmpxchg64 could be used.
> 
> __cmpxchg64 has different parameter conventions.

But they all just deal with the starting addresses and the _local
version already has proper fallback implementation.

> > Another thing is that choosing different code path depending on
> > has_cmpxchg_double() would be quite messy and won't bode well with
> > many people.  I agree that fallback implementation would be heavier
> > for SMP safe operations but some archs already do that for cmpxchg
> > (forgot which one).  If we're gonna export this to generic code,
> > wouldn't it be better to implement proper generic fallbacks and
> > provide has_*() as hint?
> 
> A generic fallback for cmpxchg_double would mean having to disable
> interrupts and then take a global spinlock. There are significant scaling
> problems with such an implementation.
> 
> The fallback through the subsystem means that the subsystem can do locking
> that scales better. In the case of SLUB we fall back to a bit lock in the
> page struct which is a hot cache line in the hotpaths. This is the same
> approach as used before the lockless patches and we expect the performance
> on platforms not supporting cmpxchg_double to stay the same.

Yes, that's nice but you're introducing new operations and they should
meet the usual conventions and cmpxchg fallback on the arch which I
don't recall now already uses hashed lock so it's not like this is
completely new.  As added, the interface basically requires extreme
ifdeffery which isn't good.

Thanks.

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