From: Mark Rutland <mark.rutland@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: will@kernel.org, boqun.feng@gmail.com,
linux-kernel@vger.kernel.org, x86@kernel.org, elver@google.com,
keescook@chromium.org, hch@infradead.org,
torvalds@linux-foundation.org, axboe@kernel.dk
Subject: Re: [PATCH v2 2/9] atomic: Add xchg.tbl
Date: Mon, 13 Dec 2021 09:50:13 +0000 [thread overview]
Message-ID: <YbcXVXGDCSyu2NxA@FVFF77S0Q05N> (raw)
In-Reply-To: <20211210162313.377798220@infradead.org>
On Fri, Dec 10, 2021 at 05:16:20PM +0100, Peter Zijlstra wrote:
> 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@infradead.org>
Nice!
I had a look as to whether it was worthwhile passing in xhcg.tbl as a script
argument as with atomics.tbl, but that meant either padding a redundant arg to
the other scripts or complicating gen-atomics.sh, and would need more
refactoring of scripting, so I think this is fine as-is.
This all looks good to me, and I can confirm no changes when regenerating the
headers:
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
> ---
> 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:...
>
>
next prev parent reply other threads:[~2021-12-13 9:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 16:16 [PATCH v2 0/9] refcount: Improve code-gen Peter Zijlstra
2021-12-10 16:16 ` [PATCH v2 1/9] atomic: Prepare scripts for macro ops Peter Zijlstra
2021-12-10 17:27 ` Mark Rutland
2021-12-10 17:43 ` Marco Elver
2021-12-10 16:16 ` [PATCH v2 2/9] atomic: Add xchg.tbl Peter Zijlstra
2021-12-13 9:50 ` Mark Rutland [this message]
2021-12-10 16:16 ` [PATCH v2 3/9] atomic: Introduce atomic_{inc,dec,dec_and_test}_overflow() Peter Zijlstra
2021-12-13 10:06 ` Mark Rutland
2021-12-13 10:57 ` Peter Zijlstra
2021-12-13 10:59 ` Peter Zijlstra
2021-12-13 11:09 ` Mark Rutland
2021-12-10 16:16 ` [PATCH v2 4/9] refcount: Use atomic_*_overflow() Peter Zijlstra
2021-12-13 10:35 ` Mark Rutland
2021-12-10 16:16 ` [PATCH v2 5/9] atomic,x86: Implement atomic_dec_and_test_overflow() Peter Zijlstra
2021-12-13 11:04 ` Mark Rutland
2021-12-10 16:16 ` [PATCH v2 6/9] refcount: Fix refcount_dec_not_one() Peter Zijlstra
2021-12-10 16:16 ` [PATCH v2 7/9] refcount: Prepare for atomic_*_overflow() offsets Peter Zijlstra
2021-12-10 16:16 ` [PATCH v2 8/9] atomic,x86: Alternative atomic_*_overflow() scheme Peter Zijlstra
2021-12-10 16:53 ` Linus Torvalds
2021-12-10 17:27 ` Linus Torvalds
2021-12-17 3:38 ` Herbert Xu
2021-12-13 16:43 ` Peter Zijlstra
2021-12-13 17:29 ` Marco Elver
2021-12-13 18:11 ` Linus Torvalds
2021-12-13 18:18 ` Marco Elver
2021-12-13 18:24 ` Linus Torvalds
2021-12-13 19:35 ` Marco Elver
2021-12-13 18:21 ` Linus Torvalds
2021-12-10 16:16 ` [PATCH v2 9/9] refcount: Optimize __refcount_add_not_zero(.i=1) Peter Zijlstra
2021-12-10 19:37 ` [PATCH v2 0/9] refcount: Improve code-gen Peter Zijlstra
2021-12-13 12:15 ` [PATCH v2 10/9] atomic: Document the atomic_{}_overflow() functions Peter Zijlstra
2021-12-13 12:20 ` [PATCH v2 0/9] refcount: Improve code-gen Peter Zijlstra
2021-12-13 14:42 ` Marco Elver
2021-12-13 16:11 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YbcXVXGDCSyu2NxA@FVFF77S0Q05N \
--to=mark.rutland@arm.com \
--cc=axboe@kernel.dk \
--cc=boqun.feng@gmail.com \
--cc=elver@google.com \
--cc=hch@infradead.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox