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]
Message-ID: <20211210162313.377798220@infradead.org>
Date:   Fri, 10 Dec 2021 17:16:20 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     will@...nel.org, boqun.feng@...il.com
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org, peterz@...radead.org,
        mark.rutland@....com, elver@...gle.com, keescook@...omium.org,
        hch@...radead.org, torvalds@...ux-foundation.org, axboe@...nel.dk
Subject: [PATCH v2 2/9] atomic: Add xchg.tbl

The tail of gen-atomic-instrumented.sh now looks like a hard-coded
variant of atomics.tbl, extract it into xchg.tbl.

Add meta-'M' to generate the order variants.

No change in generated files.

Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
 scripts/atomic/atomic-tbl.sh              |   10 +++++-----
 scripts/atomic/atomics.tbl                |    2 +-
 scripts/atomic/gen-atomic-instrumented.sh |   18 ++----------------
 scripts/atomic/xchg.tbl                   |   13 +++++++++++++
 4 files changed, 21 insertions(+), 22 deletions(-)

--- a/scripts/atomic/atomic-tbl.sh
+++ b/scripts/atomic/atomic-tbl.sh
@@ -15,31 +15,31 @@ meta_in()
 #meta_has_ret(meta)
 meta_has_ret()
 {
-	meta_in "$1" "bBiIfFlRm"
+	meta_in "$1" "bBiIfFlRMm"
 }
 
 #meta_has_acquire(meta)
 meta_has_acquire()
 {
-	meta_in "$1" "BFIlR"
+	meta_in "$1" "BFIlRM"
 }
 
 #meta_has_release(meta)
 meta_has_release()
 {
-	meta_in "$1" "BFIRs"
+	meta_in "$1" "BFIRsM"
 }
 
 #meta_has_relaxed(meta)
 meta_has_relaxed()
 {
-	meta_in "$1" "BFIR"
+	meta_in "$1" "BFIRM"
 }
 
 #meta_has_macro(meta)
 meta_has_macro()
 {
-	meta_in "$1" "mn"
+	meta_in "$1" "Mmn"
 }
 
 #find_fallback_template(pfx, name, sfx, order)
--- a/scripts/atomic/atomics.tbl
+++ b/scripts/atomic/atomics.tbl
@@ -10,7 +10,7 @@
 # * F/f	- fetch: returns base type (has fetch_ variants)
 # * l	- load: returns base type (has _acquire order variant)
 # * s	- store: returns void (has _release order variant)
-# * m	- macro: with return value
+# * M/m	- macro: with return value
 # * n	- macro: with No return value
 #
 # Where args contains list of type[:name], where type is:
--- a/scripts/atomic/gen-atomic-instrumented.sh
+++ b/scripts/atomic/gen-atomic-instrumented.sh
@@ -195,22 +195,8 @@ grep '^[a-z]' "$1" | while read name met
 	gen_proto "${meta}" "${name}" "atomic_long" "long" ${args}
 done
 
-for xchg in "xchg" "cmpxchg" "cmpxchg64"; do
-	for order in "" "_acquire" "_release" "_relaxed"; do
-		gen_proto_order_variant "m" "" "${xchg}" "" "${order}" "" "" "v:ptr" "V:..."
-	done
-done
-
-for order in "" "_acquire" "_release" "_relaxed"; do
-	gen_proto_order_variant "m" "" "try_cmpxchg" "" "${order}" "" "" "v:ptr" "p:oldp" "V:..."
-done
-
-for xchg in "cmpxchg_local" "cmpxchg64_local" "sync_cmpxchg"; do
-	gen_proto_order_variant "m" "" "${xchg}" "" "" "" "" "v:ptr" "V:..."
-done
-
-for xchg in "cmpxchg_double" "cmpxchg_double_local"; do
-	gen_proto_order_variant "m" "" "${xchg}" "" "" "" "" "P:ptr" "V:..."
+grep '^[a-z]' $(dirname $1)/xchg.tbl | while read name meta args; do
+	gen_proto "${meta}" "${name}" "" "" ${args}
 done
 
 cat <<EOF
--- /dev/null
+++ b/scripts/atomic/xchg.tbl
@@ -0,0 +1,13 @@
+# name	meta	args...
+#
+# see atomics.tbl for a description of meta and args...
+#
+xchg			M	v:ptr	V:...
+cmpxchg			M	v:ptr	V:...
+cmpxchg64		M	v:ptr	V:...
+try_cmpxchg		M	v:ptr	p:oldp	V:...
+cmpxchg_local		m	v:ptr	V:...
+cmpxchg64_local		m	v:ptr	V:...
+sync_cmpxchg		m	v:ptr	V:...
+cmpxchg_double		m	P:ptr	V:...
+cmpxchg_double_local	m	P:ptr	V:...


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ