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]
Message-ID: <20160624163430.GA11823@linux-80c1.suse>
Date:	Fri, 24 Jun 2016 09:34:30 -0700
From:	Davidlohr Bueso <dave@...olabs.net>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	mingo@...nel.org, davem@...emloft.net, cw00.choi@...sung.com,
	dougthompson@...ssion.com, bp@...en8.de, mchehab@....samsung.com,
	gregkh@...uxfoundation.org, pfg@....com, jikos@...nel.org,
	hans.verkuil@...co.com, awalls@...metrocast.net,
	dledford@...hat.com, sean.hefty@...el.com, kys@...rosoft.com,
	heiko.carstens@...ibm.com, James.Bottomley@...senPartnership.com,
	sumit.semwal@...aro.org, schwidefsky@...ibm.com,
	linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH v2 01/12] locking/atomic: Introduce inc/dec calls for
 FETCH-OP flavors

On Thu, 23 Jun 2016, Peter Zijlstra wrote:

>Would something like so make sense?
>
>---
>--- a/include/linux/atomic.h
>+++ b/include/linux/atomic.h
>@@ -188,15 +188,18 @@
> #endif
> #endif /* atomic_fetch_add_relaxed */
>
>-#ifndef atomic_fetch_inc
>-#define atomic_fetch_inc(v)  (atomic_fetch_add(1, v))
>-#endif

Hmm perhaps I'm a bit lost in all this CPP maze, but where do you in fact
define atomic_fetch_inc() generically here? gcc cannot see it either.

Another option could be to add the above for atomic_fetch_inc inside the
ifndef atomic_fetch_release. Ie:

>-
> /* atomic_fetch_inc_relaxed */
> #ifndef atomic_fetch_inc_relaxed
>+
>+#ifndef atomic_fetch_inc

#define atomic_fetch_inc(v)  (atomic_fetch_add(1, v))

>+#define atomic_fetch_inc_relaxed(v)	atomic_fetch_add_relaxed(1, (v))
>+#define atomic_fetch_inc_acquire(v)	atomic_fetch_add_acquire(1, (v))
>+#define atomic_fetch_inc_release(v)	atomic_fetch_add_release(1, (v))

I was under the impression that if the archs don't define their own calls,
then we always default to fully ordered. Which is why I based all this ifdefery
on what is currently done with the other atomic_fetch_$ops.

>+#else /* atomic_fetch_inc */
> #define atomic_fetch_inc_relaxed	atomic_fetch_inc
> #define atomic_fetch_inc_acquire	atomic_fetch_inc
> #define atomic_fetch_inc_release	atomic_fetch_inc
>+#endif /* atomic_fetch_inc */
>
> #else /* atomic_fetch_inc_relaxed */

Thanks,
Davidlohr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ