From: Boqun Feng <boqun.feng@gmail.com>
To: Andrew Murray <andrew.murray@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Ard.Biesheuvel@arm.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/5] arm64: atomics: avoid out-of-line ll/sc atomics
Date: Thu, 1 Aug 2019 11:10:04 +0800 [thread overview]
Message-ID: <20190801031004.GD26905@tardis> (raw)
In-Reply-To: <20190731161256.22210-4-andrew.murray@arm.com>
[-- Attachment #1.1: Type: text/plain, Size: 2534 bytes --]
Hi Andrew,
On Wed, Jul 31, 2019 at 05:12:54PM +0100, Andrew Murray wrote:
[...]
> +
> +#define __lse_ll_sc_body(op, ...) \
> +({ \
> + system_uses_lse_atomics() ? \
> + __lse_##op(__VA_ARGS__) : \
> + __ll_sc_##op(__VA_ARGS__); \
> +})
> +
> +#define ATOMIC_OP(op) \
> +static inline void arch_##op(int i, atomic_t *v) \
> +{ \
> + __lse_ll_sc_body(op, i, v); \
> +}
> +
> +ATOMIC_OP(atomic_andnot)
> +ATOMIC_OP(atomic_or)
> +ATOMIC_OP(atomic_xor)
> +ATOMIC_OP(atomic_add)
> +ATOMIC_OP(atomic_and)
> +ATOMIC_OP(atomic_sub)
> +
> +
> +#define ATOMIC_FETCH_OP(name, op) \
> +static inline int arch_##op##name(int i, atomic_t *v) \
> +{ \
> + return __lse_ll_sc_body(op, i, v); \
Color me blind if I'm wrong, but should't this be:
return __lse_ll_sc_body(op##name, i, v); \
? Otherwise all variants will use the fully-ordered implementation.
> +}
> +
> +#define ATOMIC_FETCH_OPS(op) \
> + ATOMIC_FETCH_OP(_relaxed, op) \
> + ATOMIC_FETCH_OP(_acquire, op) \
> + ATOMIC_FETCH_OP(_release, op) \
> + ATOMIC_FETCH_OP( , op)
> +
> +ATOMIC_FETCH_OPS(atomic_fetch_andnot)
> +ATOMIC_FETCH_OPS(atomic_fetch_or)
> +ATOMIC_FETCH_OPS(atomic_fetch_xor)
> +ATOMIC_FETCH_OPS(atomic_fetch_add)
> +ATOMIC_FETCH_OPS(atomic_fetch_and)
> +ATOMIC_FETCH_OPS(atomic_fetch_sub)
> +ATOMIC_FETCH_OPS(atomic_add_return)
> +ATOMIC_FETCH_OPS(atomic_sub_return)
> +
> +
> +#define ATOMIC64_OP(op) \
> +static inline void arch_##op(long i, atomic64_t *v) \
> +{ \
> + __lse_ll_sc_body(op, i, v); \
> +}
> +
> +ATOMIC64_OP(atomic64_andnot)
> +ATOMIC64_OP(atomic64_or)
> +ATOMIC64_OP(atomic64_xor)
> +ATOMIC64_OP(atomic64_add)
> +ATOMIC64_OP(atomic64_and)
> +ATOMIC64_OP(atomic64_sub)
> +
> +
> +#define ATOMIC64_FETCH_OP(name, op) \
> +static inline long arch_##op##name(long i, atomic64_t *v) \
> +{ \
> + return __lse_ll_sc_body(op, i, v); \
Ditto.
Regards,
Boqun
> +}
> +
> +#define ATOMIC64_FETCH_OPS(op) \
> + ATOMIC64_FETCH_OP(_relaxed, op) \
> + ATOMIC64_FETCH_OP(_acquire, op) \
> + ATOMIC64_FETCH_OP(_release, op) \
> + ATOMIC64_FETCH_OP( , op)
> +
> +ATOMIC64_FETCH_OPS(atomic64_fetch_andnot)
> +ATOMIC64_FETCH_OPS(atomic64_fetch_or)
> +ATOMIC64_FETCH_OPS(atomic64_fetch_xor)
> +ATOMIC64_FETCH_OPS(atomic64_fetch_add)
> +ATOMIC64_FETCH_OPS(atomic64_fetch_and)
> +ATOMIC64_FETCH_OPS(atomic64_fetch_sub)
> +ATOMIC64_FETCH_OPS(atomic64_add_return)
> +ATOMIC64_FETCH_OPS(atomic64_sub_return)
> +
> +
[...]
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-01 3:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-31 16:12 [PATCH v2 0/5] arm64: avoid out-of-line ll/sc atomics Andrew Murray
2019-07-31 16:12 ` [PATCH v2 1/5] jump_label: Don't warn on __exit jump entries Andrew Murray
2019-07-31 16:41 ` Peter Zijlstra
2019-08-02 8:22 ` Andrew Murray
2019-07-31 16:12 ` [PATCH v2 2/5] arm64: Use correct ll/sc atomic constraints Andrew Murray
2019-07-31 16:12 ` [PATCH v2 3/5] arm64: atomics: avoid out-of-line ll/sc atomics Andrew Murray
2019-08-01 3:10 ` Boqun Feng [this message]
2019-08-01 8:12 ` Andrew Murray
2019-07-31 16:12 ` [PATCH v2 4/5] arm64: avoid using hard-coded registers for LSE atomics Andrew Murray
2019-07-31 16:12 ` [PATCH v2 5/5] arm64: atomics: remove atomic_ll_sc compilation unit Andrew Murray
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=20190801031004.GD26905@tardis \
--to=boqun.feng@gmail.com \
--cc=Ard.Biesheuvel@arm.com \
--cc=andrew.murray@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.