diff options
author | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2023-06-27 18:29:23 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2023-08-08 23:42:12 +0300 |
commit | 2b2fe6052dd01fdb4e9a31031c2c9d8f03cf7753 (patch) | |
tree | 309adc858a2cd3f8c78312330e3ea9d671466b6c /tools/testing/selftests/rseq/rseq-s390.h | |
parent | 0fbbf07ce67d2edb869572bf41b507a5f6851c72 (diff) | |
download | linux-2b2fe6052dd01fdb4e9a31031c2c9d8f03cf7753.tar.xz |
selftests/rseq: Use rseq_unqual_scalar_typeof in macros
Use rseq_unqual_scalar_typeof() rather than typeof() in macros to remove
the volatile qualifier (if there is one in the input argument), thus
generating better assembly code in those scenarios.
Also add extra brackets around the "p" parameter in RSEQ_READ_ONCE(),
RSEQ_WRITE_ONCE(), and rseq_unqual_scalar_typeof() across architectures
to preserve expectations of operator priority. Here is an example that
shows how operator priority may be an issue with missing parentheses:
#define m(p) \
do { \
__typeof__(*p) v = 0; \
} while (0)
void fct(unsigned long long *p1)
{
m(p1 + 1); /* works */
m(1 + p1); /* broken */
}
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/rseq/rseq-s390.h')
-rw-r--r-- | tools/testing/selftests/rseq/rseq-s390.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/rseq/rseq-s390.h b/tools/testing/selftests/rseq/rseq-s390.h index 46c92598acc7..33baaa9f9997 100644 --- a/tools/testing/selftests/rseq/rseq-s390.h +++ b/tools/testing/selftests/rseq/rseq-s390.h @@ -15,7 +15,7 @@ #define rseq_smp_load_acquire(p) \ __extension__ ({ \ - __typeof(*p) ____p1 = RSEQ_READ_ONCE(*p); \ + rseq_unqual_scalar_typeof(*(p)) ____p1 = RSEQ_READ_ONCE(*(p)); \ rseq_barrier(); \ ____p1; \ }) @@ -25,7 +25,7 @@ __extension__ ({ \ #define rseq_smp_store_release(p, v) \ do { \ rseq_barrier(); \ - RSEQ_WRITE_ONCE(*p, v); \ + RSEQ_WRITE_ONCE(*(p), v); \ } while (0) #ifdef __s390x__ |