Update rseq critical section identifiers to match pseudo-code
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 23 Feb 2024 19:49:09 +0000 (14:49 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 27 Feb 2024 16:16:08 +0000 (11:16 -0500)
Apply the following mapping:

rseq_cmpeqv_storev -> rseq_load_cbne_store__ptr
rseq_addv -> rseq_load_add_store__ptr
rseq_cmpnev_storeoffp_load -> rseq_load_cbeq_store_add_load_store__ptr
rseq_offset_deref_addv -> rseq_load_add_load_add_store__ptr
rseq_cmpeqv_cmpeqv_storev -> rseq_load_cbne_load_cbne_store__ptr
rseq_cmpeqv_trystorev_storev -> rseq_load_cbne_store_store__ptr
rseq_cmpeqv_trymemcpy_storev -> rseq_load_cbne_memcpy_store__ptr

Summary of the identifier convention:
- Begin with an "rseq_" prefix,
- Followed by the pseudo-code,
- Followed by __ and the type (or eventually types) on which the API
  applies (similar to the approach taken for C++ mangling).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I59f251bcf177779ee5f8eb18c629dcd8bf1d633a

include/rseq/rseq-arm-bits.h
include/rseq/rseq-arm64-bits.h
include/rseq/rseq-mips-bits.h
include/rseq/rseq-ppc-bits.h
include/rseq/rseq-riscv-bits.h
include/rseq/rseq-s390-bits.h
include/rseq/rseq-x86-bits.h
include/rseq/rseq.h
tests/basic_percpu_ops_test.c
tests/param_test.c

index 9fbeeddd4a49bc1e580c9c332057f8c336f6a047..7eeb84574b15f109a51278ca95bfcdca150f9220 100644 (file)
@@ -17,7 +17,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -84,7 +84,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -157,7 +157,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -210,7 +210,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -300,7 +300,7 @@ error3:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -380,7 +380,7 @@ error2:
 
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
index 709990f4b298812e49b9926a3f1c76a62e670d26..8dfc853011c9de559043267050f60b312cc557cc 100644 (file)
@@ -18,7 +18,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -75,7 +75,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -137,7 +137,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -184,7 +184,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -258,7 +258,7 @@ error3:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -325,7 +325,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
index 529f380982bd9a372aef69f0dd4a2097cf0eaafc..dd2558055d98ece4e7546aaf985e494815f5a805 100644 (file)
@@ -18,7 +18,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -78,7 +78,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -144,7 +144,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -194,7 +194,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -274,7 +274,7 @@ error3:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -346,7 +346,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
index ad8559b028ed4452b950152dc7ca460fcf0e8a94..aebb234d627035f8022130a5e977cc4ccca394e4 100644 (file)
@@ -18,7 +18,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -82,7 +82,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -155,7 +155,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -210,7 +210,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -295,7 +295,7 @@ error3:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -372,7 +372,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
index 467781bcd15a551d00ccb83860d232a24c2a9ded..2afcc5a7a2f939591cb8fdc3b44a035e4008983e 100644 (file)
@@ -13,7 +13,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -66,7 +66,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               off_t voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -123,7 +123,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -167,7 +167,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -231,12 +231,8 @@ error3:
 
 #define RSEQ_ARCH_HAS_OFFSET_DEREF_ADDV
 
-/*
- *   pval = *(ptr+off)
- *  *pval += inc;
- */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_offset_deref_addv)(intptr_t *ptr, off_t off, intptr_t inc, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_load_add_store__ptr)(intptr_t *ptr, off_t off, intptr_t inc, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -285,7 +281,7 @@ error1:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -348,7 +344,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
index e94f60280d4a26d8ad720dd8bf909757220448ee..0d687f09eb352e8bf99551207e4c1a588ce40403 100644 (file)
@@ -13,7 +13,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -75,12 +75,8 @@ error2:
 #endif
 }
 
-/*
- * Compare @v against @expectnot. When it does _not_ match, load @v
- * into @load, and store the content of *@v + voffp into @v.
- */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -151,7 +147,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -203,7 +199,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -288,7 +284,7 @@ error3:
 
 /* s390 is TSO. */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -361,7 +357,7 @@ error2:
 
 /* s390 is TSO. */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
index 937092ee846ff2179ac19024823fc189fb235109..2bfa8518585758f0528aa0e38dd240e7b7ce58c5 100644 (file)
@@ -18,7 +18,7 @@
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -78,12 +78,8 @@ error2:
 #endif
 }
 
-/*
- * Compare @v against @expectnot. When it does _not_ match, load @v
- * into @load, and store the content of *@v + voffp into @v.
- */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -152,7 +148,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -201,12 +197,8 @@ error1:
 
 #define RSEQ_ARCH_HAS_OFFSET_DEREF_ADDV
 
-/*
- *   pval = *(ptr+off)
- *  *pval += inc;
- */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_offset_deref_addv)(intptr_t *ptr, long off, intptr_t inc, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_load_add_store__ptr)(intptr_t *ptr, long off, intptr_t inc, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -257,7 +249,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -339,7 +331,7 @@ error3:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
 {
@@ -409,7 +401,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
 {
@@ -530,7 +522,7 @@ error2:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store__ptr)(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -590,12 +582,8 @@ error2:
 #endif
 }
 
-/*
- * Compare @v against @expectnot. When it does _not_ match, load @v
- * into @load, and store the content of *@v + voffp into @v.
- */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t expectnot,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbeq_store_add_load_store__ptr)(intptr_t *v, intptr_t expectnot,
                               long voffp, intptr_t *load, int cpu)
 {
        RSEQ_INJECT_C(9)
@@ -664,7 +652,7 @@ error2:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_add_store__ptr)(intptr_t *v, intptr_t count, int cpu)
 {
        RSEQ_INJECT_C(9)
 
@@ -712,7 +700,7 @@ error1:
 }
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_load_cbne_store__ptr)(intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
 {
@@ -795,7 +783,7 @@ error3:
        (defined(RSEQ_TEMPLATE_CPU_ID) || defined(RSEQ_TEMPLATE_MM_CID))
 
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_store_store__ptr)(intptr_t *v, intptr_t expect,
                                         intptr_t *v2, intptr_t newv2,
                                         intptr_t newv, int cpu)
 {
@@ -872,7 +860,7 @@ error2:
 
 /* TODO: implement a faster memcpy. */
 static inline __attribute__((always_inline))
-int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t expect,
+int RSEQ_TEMPLATE_IDENTIFIER(rseq_load_cbne_memcpy_store__ptr)(intptr_t *v, intptr_t expect,
                                         void *dst, void *src, size_t len,
                                         intptr_t newv, int cpu)
 {
index 222c36a9589bfc573800b2e577e1389abce258b6..520005be7f226e289bc54608a57dc5bd9e5466a3 100644 (file)
@@ -275,7 +275,7 @@ static inline void rseq_prepare_unload(void)
 #include "rseq-pseudocode.h"
 
 static inline __attribute__((always_inline))
-int rseq_cmpeqv_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_cbne_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                       intptr_t *v, intptr_t expect,
                       intptr_t newv, int cpu)
 {
@@ -283,20 +283,16 @@ int rseq_cmpeqv_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                return -1;
        switch (percpu_mode) {
        case RSEQ_PERCPU_CPU_ID:
-               return rseq_cmpeqv_storev_relaxed_cpu_id(v, expect, newv, cpu);
+               return rseq_load_cbne_store__ptr_relaxed_cpu_id(v, expect, newv, cpu);
        case RSEQ_PERCPU_MM_CID:
-               return rseq_cmpeqv_storev_relaxed_mm_cid(v, expect, newv, cpu);
+               return rseq_load_cbne_store__ptr_relaxed_mm_cid(v, expect, newv, cpu);
        default:
                return -1;
        }
 }
 
-/*
- * Compare @v against @expectnot. When it does _not_ match, load @v
- * into @load, and store the content of *@v + voffp into @v.
- */
 static inline __attribute__((always_inline))
-int rseq_cmpnev_storeoffp_load(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_cbeq_store_add_load_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                               intptr_t *v, intptr_t expectnot, long voffp, intptr_t *load,
                               int cpu)
 {
@@ -304,46 +300,42 @@ int rseq_cmpnev_storeoffp_load(enum rseq_mo rseq_mo, enum rseq_percpu_mode percp
                return -1;
        switch (percpu_mode) {
        case RSEQ_PERCPU_CPU_ID:
-               return rseq_cmpnev_storeoffp_load_relaxed_cpu_id(v, expectnot, voffp, load, cpu);
+               return rseq_load_cbeq_store_add_load_store__ptr_relaxed_cpu_id(v, expectnot, voffp, load, cpu);
        case RSEQ_PERCPU_MM_CID:
-               return rseq_cmpnev_storeoffp_load_relaxed_mm_cid(v, expectnot, voffp, load, cpu);
+               return rseq_load_cbeq_store_add_load_store__ptr_relaxed_mm_cid(v, expectnot, voffp, load, cpu);
        default:
                return -1;
        }
 }
 
 static inline __attribute__((always_inline))
-int rseq_addv(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_add_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
              intptr_t *v, intptr_t count, int cpu)
 {
        if (rseq_mo != RSEQ_MO_RELAXED)
                return -1;
        switch (percpu_mode) {
        case RSEQ_PERCPU_CPU_ID:
-               return rseq_addv_relaxed_cpu_id(v, count, cpu);
+               return rseq_load_add_store__ptr_relaxed_cpu_id(v, count, cpu);
        case RSEQ_PERCPU_MM_CID:
-               return rseq_addv_relaxed_mm_cid(v, count, cpu);
+               return rseq_load_add_store__ptr_relaxed_mm_cid(v, count, cpu);
        default:
                return -1;
        }
 }
 
 #ifdef RSEQ_ARCH_HAS_OFFSET_DEREF_ADDV
-/*
- *   pval = *(ptr+off)
- *  *pval += inc;
- */
 static inline __attribute__((always_inline))
-int rseq_offset_deref_addv(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_add_load_add_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                           intptr_t *ptr, long off, intptr_t inc, int cpu)
 {
        if (rseq_mo != RSEQ_MO_RELAXED)
                return -1;
        switch (percpu_mode) {
        case RSEQ_PERCPU_CPU_ID:
-               return rseq_offset_deref_addv_relaxed_cpu_id(ptr, off, inc, cpu);
+               return rseq_load_add_load_add_store__ptr_relaxed_cpu_id(ptr, off, inc, cpu);
        case RSEQ_PERCPU_MM_CID:
-               return rseq_offset_deref_addv_relaxed_mm_cid(ptr, off, inc, cpu);
+               return rseq_load_add_load_add_store__ptr_relaxed_mm_cid(ptr, off, inc, cpu);
        default:
                return -1;
        }
@@ -351,7 +343,7 @@ int rseq_offset_deref_addv(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mo
 #endif
 
 static inline __attribute__((always_inline))
-int rseq_cmpeqv_trystorev_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_cbne_store_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                                 intptr_t *v, intptr_t expect,
                                 intptr_t *v2, intptr_t newv2,
                                 intptr_t newv, int cpu)
@@ -360,18 +352,18 @@ int rseq_cmpeqv_trystorev_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode per
        case RSEQ_MO_RELAXED:
                switch (percpu_mode) {
                case RSEQ_PERCPU_CPU_ID:
-                       return rseq_cmpeqv_trystorev_storev_relaxed_cpu_id(v, expect, v2, newv2, newv, cpu);
+                       return rseq_load_cbne_store_store__ptr_relaxed_cpu_id(v, expect, v2, newv2, newv, cpu);
                case RSEQ_PERCPU_MM_CID:
-                       return rseq_cmpeqv_trystorev_storev_relaxed_mm_cid(v, expect, v2, newv2, newv, cpu);
+                       return rseq_load_cbne_store_store__ptr_relaxed_mm_cid(v, expect, v2, newv2, newv, cpu);
                default:
                        return -1;
                }
        case RSEQ_MO_RELEASE:
                switch (percpu_mode) {
                case RSEQ_PERCPU_CPU_ID:
-                       return rseq_cmpeqv_trystorev_storev_release_cpu_id(v, expect, v2, newv2, newv, cpu);
+                       return rseq_load_cbne_store_store__ptr_release_cpu_id(v, expect, v2, newv2, newv, cpu);
                case RSEQ_PERCPU_MM_CID:
-                       return rseq_cmpeqv_trystorev_storev_release_mm_cid(v, expect, v2, newv2, newv, cpu);
+                       return rseq_load_cbne_store_store__ptr_release_mm_cid(v, expect, v2, newv2, newv, cpu);
                default:
                        return -1;
                }
@@ -385,7 +377,7 @@ int rseq_cmpeqv_trystorev_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode per
 }
 
 static inline __attribute__((always_inline))
-int rseq_cmpeqv_cmpeqv_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_cbne_load_cbne_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                              intptr_t *v, intptr_t expect,
                              intptr_t *v2, intptr_t expect2,
                              intptr_t newv, int cpu)
@@ -394,16 +386,16 @@ int rseq_cmpeqv_cmpeqv_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu
                return -1;
        switch (percpu_mode) {
        case RSEQ_PERCPU_CPU_ID:
-               return rseq_cmpeqv_cmpeqv_storev_relaxed_cpu_id(v, expect, v2, expect2, newv, cpu);
+               return rseq_load_cbne_load_cbne_store__ptr_relaxed_cpu_id(v, expect, v2, expect2, newv, cpu);
        case RSEQ_PERCPU_MM_CID:
-               return rseq_cmpeqv_cmpeqv_storev_relaxed_mm_cid(v, expect, v2, expect2, newv, cpu);
+               return rseq_load_cbne_load_cbne_store__ptr_relaxed_mm_cid(v, expect, v2, expect2, newv, cpu);
        default:
                return -1;
        }
 }
 
 static inline __attribute__((always_inline))
-int rseq_cmpeqv_trymemcpy_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
+int rseq_load_cbne_memcpy_store__ptr(enum rseq_mo rseq_mo, enum rseq_percpu_mode percpu_mode,
                                 intptr_t *v, intptr_t expect,
                                 void *dst, void *src, size_t len,
                                 intptr_t newv, int cpu)
@@ -412,18 +404,18 @@ int rseq_cmpeqv_trymemcpy_storev(enum rseq_mo rseq_mo, enum rseq_percpu_mode per
        case RSEQ_MO_RELAXED:
                switch (percpu_mode) {
                case RSEQ_PERCPU_CPU_ID:
-                       return rseq_cmpeqv_trymemcpy_storev_relaxed_cpu_id(v, expect, dst, src, len, newv, cpu);
+                       return rseq_load_cbne_memcpy_store__ptr_relaxed_cpu_id(v, expect, dst, src, len, newv, cpu);
                case RSEQ_PERCPU_MM_CID:
-                       return rseq_cmpeqv_trymemcpy_storev_relaxed_mm_cid(v, expect, dst, src, len, newv, cpu);
+                       return rseq_load_cbne_memcpy_store__ptr_relaxed_mm_cid(v, expect, dst, src, len, newv, cpu);
                default:
                        return -1;
                }
        case RSEQ_MO_RELEASE:
                switch (percpu_mode) {
                case RSEQ_PERCPU_CPU_ID:
-                       return rseq_cmpeqv_trymemcpy_storev_release_cpu_id(v, expect, dst, src, len, newv, cpu);
+                       return rseq_load_cbne_memcpy_store__ptr_release_cpu_id(v, expect, dst, src, len, newv, cpu);
                case RSEQ_PERCPU_MM_CID:
-                       return rseq_cmpeqv_trymemcpy_storev_release_mm_cid(v, expect, dst, src, len, newv, cpu);
+                       return rseq_load_cbne_memcpy_store__ptr_release_mm_cid(v, expect, dst, src, len, newv, cpu);
                default:
                        return -1;
                }
index d40729c129935d47667c8f748e6806e50d5a2028..ff260091f52e4c170d59eb3a0e15d0c193ecf265 100644 (file)
@@ -97,7 +97,7 @@ static int rseq_this_cpu_lock(struct percpu_lock *lock)
                int ret;
 
                cpu = get_current_cpu_id();
-               ret = rseq_cmpeqv_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbne_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                         &lock->c[cpu].v, 0, 1, cpu);
                if (rseq_likely(!ret))
                        break;
@@ -196,7 +196,7 @@ static void this_cpu_list_push(struct percpu_list *list,
                newval = (intptr_t)node;
                targetptr = (intptr_t *)&list->c[cpu].head;
                node->next = (struct percpu_list_node *)expect;
-               ret = rseq_cmpeqv_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbne_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                         targetptr, expect, newval, cpu);
                if (rseq_likely(!ret))
                        break;
@@ -225,7 +225,7 @@ static struct percpu_list_node *this_cpu_list_pop(struct percpu_list *list,
                expectnot = (intptr_t)NULL;
                offset = offsetof(struct percpu_list_node, next);
                load = (intptr_t *)&head;
-               ret = rseq_cmpnev_storeoffp_load(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbeq_store_add_load_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                                 targetptr, expectnot,
                                                 offset, load, cpu);
                if (rseq_likely(!ret)) {
index e2003567c614fe3e7499de669a89563f0ede72c7..9751667ed5dc089356e2d272009c45ffdc011f73 100644 (file)
@@ -439,7 +439,7 @@ static int rseq_this_cpu_lock(struct percpu_lock *lock)
                                getpid(), (int) rseq_gettid(), rseq_current_cpu_raw(), cpu);
                        abort();
                }
-               ret = rseq_cmpeqv_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbne_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                         &lock->c[cpu].v,
                                         0, 1, cpu);
                if (rseq_likely(!ret))
@@ -558,7 +558,7 @@ static void *test_percpu_inc_thread(void *arg)
                        int cpu;
 
                        cpu = get_current_cpu_id();
-                       ret = rseq_addv(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+                       ret = rseq_load_add_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                        &data->c[cpu].count, 1, cpu);
                } while (rseq_unlikely(ret));
 #ifndef BENCHMARK
@@ -634,7 +634,7 @@ static void this_cpu_list_push(struct percpu_list *list,
                newval = (intptr_t)node;
                targetptr = (intptr_t *)&list->c[cpu].head;
                node->next = (struct percpu_list_node *)expect;
-               ret = rseq_cmpeqv_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbne_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                         targetptr, expect, newval, cpu);
                if (rseq_likely(!ret))
                        break;
@@ -666,7 +666,7 @@ static struct percpu_list_node *this_cpu_list_pop(struct percpu_list *list,
                expectnot = (intptr_t)NULL;
                offset = offsetof(struct percpu_list_node, next);
                load = (intptr_t *)&head;
-               ret = rseq_cmpnev_storeoffp_load(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbeq_store_add_load_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                                 targetptr, expectnot,
                                                 offset, load, cpu);
                if (rseq_likely(!ret)) {
@@ -814,7 +814,7 @@ static bool this_cpu_buffer_push(struct percpu_buffer *buffer,
                targetptr_spec = (intptr_t *)&buffer->c[cpu].array[offset];
                newval_final = offset + 1;
                targetptr_final = &buffer->c[cpu].offset;
-               ret = rseq_cmpeqv_trystorev_storev(opt_mo, RSEQ_PERCPU,
+               ret = rseq_load_cbne_store_store__ptr(opt_mo, RSEQ_PERCPU,
                        targetptr_final, offset, targetptr_spec,
                        newval_spec, newval_final, cpu);
                if (rseq_likely(!ret)) {
@@ -849,7 +849,7 @@ static struct percpu_buffer_node *this_cpu_buffer_pop(struct percpu_buffer *buff
                head = RSEQ_READ_ONCE(buffer->c[cpu].array[offset - 1]);
                newval = offset - 1;
                targetptr = (intptr_t *)&buffer->c[cpu].offset;
-               ret = rseq_cmpeqv_cmpeqv_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbne_load_cbne_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                        targetptr, offset,
                        (intptr_t *)&buffer->c[cpu].array[offset - 1],
                        (intptr_t)head, newval, cpu);
@@ -1019,7 +1019,7 @@ static bool this_cpu_memcpy_buffer_push(struct percpu_memcpy_buffer *buffer,
                copylen = sizeof(item);
                newval_final = offset + 1;
                targetptr_final = &buffer->c[cpu].offset;
-               ret = rseq_cmpeqv_trymemcpy_storev(
+               ret = rseq_load_cbne_memcpy_store__ptr(
                        opt_mo, RSEQ_PERCPU,
                        targetptr_final, offset,
                        destptr, srcptr, copylen,
@@ -1059,7 +1059,7 @@ static bool this_cpu_memcpy_buffer_pop(struct percpu_memcpy_buffer *buffer,
                copylen = sizeof(*item);
                newval_final = offset - 1;
                targetptr_final = &buffer->c[cpu].offset;
-               ret = rseq_cmpeqv_trymemcpy_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+               ret = rseq_load_cbne_memcpy_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                        targetptr_final, offset, destptr, srcptr, copylen,
                        newval_final, cpu);
                if (rseq_likely(!ret)) {
@@ -1281,7 +1281,7 @@ void *test_membarrier_worker_thread(void *arg)
                do {
                        int cpu = get_current_cpu_id();
 
-                       ret = rseq_offset_deref_addv(RSEQ_MO_RELAXED, RSEQ_PERCPU,
+                       ret = rseq_load_add_load_add_store__ptr(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                &args->percpu_list_ptr,
                                sizeof(struct percpu_list_entry) * cpu, 1, cpu);
                } while (rseq_unlikely(ret));
@@ -1472,7 +1472,7 @@ void test_membarrier(void)
                                "Skipping membarrier test.\n");
                return;
        }
-       fprintf(stderr, "rseq_offset_deref_addv is not implemented on this architecture. "
+       fprintf(stderr, "rseq_load_add_load_add_store__ptr is not implemented on this architecture. "
                        "Skipping membarrier test.\n");
 }
 #endif
This page took 0.046963 seconds and 4 git commands to generate.