Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rseq/selftests: x86: Work-around bogus gcc-8 optimisation

gcc-8 version 8.1.0, 8.2.0, and 8.3.0 generate broken assembler with asm
goto that have a thread-local storage "m" input operand on both x86-32
and x86-64. For instance:

__thread int var;

static int fct(void)
{
asm goto ( "jmp %l[testlabel]\n\t"
: : [var] "m" (var) : : testlabel);
return 0;
testlabel:
return 1;
}

int main()
{
return fct();
}

% gcc-8 -O2 -o test-asm-goto test-asm-goto.c
/tmp/ccAdHJbe.o: In function `main':
test-asm-goto.c:(.text.startup+0x1): undefined reference to `.L2'
collect2: error: ld returned 1 exit status

% gcc-8 -m32 -O2 -o test-asm-goto test-asm-goto.c
/tmp/ccREsVXA.o: In function `main':
test-asm-goto.c:(.text.startup+0x1): undefined reference to `.L2'
collect2: error: ld returned 1 exit status

Work-around this compiler bug in the rseq-x86.h header by passing the
address of the __rseq_abi TLS as a register operand rather than using
the "m" input operand.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90193
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Joel Fernandes <joelaf@google.com>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Dave Watson <davejwatson@fb.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Shuah Khan <shuah@kernel.org>
CC: Andi Kleen <andi@firstfloor.org>
CC: linux-kselftest@vger.kernel.org
CC: "H . Peter Anvin" <hpa@zytor.com>
CC: Chris Lameter <cl@linux.com>
CC: Russell King <linux@arm.linux.org.uk>
CC: Michael Kerrisk <mtk.manpages@gmail.com>
CC: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
CC: Paul Turner <pjt@google.com>
CC: Boqun Feng <boqun.feng@gmail.com>
CC: Josh Triplett <josh@joshtriplett.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ben Maurer <bmaurer@fb.com>
CC: linux-api@vger.kernel.org
CC: Andy Lutomirski <luto@amacapital.net>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Mathieu Desnoyers and committed by
Shuah Khan
fe22983d 5821ba96

+70 -74
+70 -74
tools/testing/selftests/rseq/rseq-x86.h
··· 9 9 10 10 #define RSEQ_SIG 0x53053053 11 11 12 + /* 13 + * Due to a compiler optimization bug in gcc-8 with asm goto and TLS asm input 14 + * operands, we cannot use "m" input operands, and rather pass the __rseq_abi 15 + * address through a "r" input operand. 16 + */ 17 + 18 + /* Offset of cpu_id and rseq_cs fields in struct rseq. */ 19 + #define RSEQ_CPU_ID_OFFSET 4 20 + #define RSEQ_CS_OFFSET 8 21 + 12 22 #ifdef __x86_64__ 13 23 14 24 #define rseq_smp_mb() \ ··· 61 51 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs) \ 62 52 RSEQ_INJECT_ASM(1) \ 63 53 "leaq " __rseq_str(cs_label) "(%%rip), %%rax\n\t" \ 64 - "movq %%rax, %[" __rseq_str(rseq_cs) "]\n\t" \ 54 + "movq %%rax, " __rseq_str(rseq_cs) "\n\t" \ 65 55 __rseq_str(label) ":\n\t" 66 56 67 57 #define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label) \ 68 58 RSEQ_INJECT_ASM(2) \ 69 - "cmpl %[" __rseq_str(cpu_id) "], %[" __rseq_str(current_cpu_id) "]\n\t" \ 59 + "cmpl %[" __rseq_str(cpu_id) "], " __rseq_str(current_cpu_id) "\n\t" \ 70 60 "jnz " __rseq_str(label) "\n\t" 71 61 72 62 #define RSEQ_ASM_DEFINE_ABORT(label, teardown, abort_label) \ ··· 94 84 __asm__ __volatile__ goto ( 95 85 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 96 86 /* Start rseq by storing table entry pointer into rseq_cs. */ 97 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 98 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 87 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 88 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 99 89 RSEQ_INJECT_ASM(3) 100 90 "cmpq %[v], %[expect]\n\t" 101 91 "jnz %l[cmpfail]\n\t" 102 92 RSEQ_INJECT_ASM(4) 103 93 #ifdef RSEQ_COMPARE_TWICE 104 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 94 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 105 95 "cmpq %[v], %[expect]\n\t" 106 96 "jnz %l[error2]\n\t" 107 97 #endif ··· 112 102 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 113 103 : /* gcc asm goto does not allow outputs */ 114 104 : [cpu_id] "r" (cpu), 115 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 116 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 105 + [rseq_abi] "r" (&__rseq_abi), 117 106 [v] "m" (*v), 118 107 [expect] "r" (expect), 119 108 [newv] "r" (newv) ··· 150 141 __asm__ __volatile__ goto ( 151 142 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 152 143 /* Start rseq by storing table entry pointer into rseq_cs. */ 153 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 154 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 144 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 145 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 155 146 RSEQ_INJECT_ASM(3) 156 147 "movq %[v], %%rbx\n\t" 157 148 "cmpq %%rbx, %[expectnot]\n\t" 158 149 "je %l[cmpfail]\n\t" 159 150 RSEQ_INJECT_ASM(4) 160 151 #ifdef RSEQ_COMPARE_TWICE 161 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 152 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 162 153 "movq %[v], %%rbx\n\t" 163 154 "cmpq %%rbx, %[expectnot]\n\t" 164 155 "je %l[error2]\n\t" ··· 173 164 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 174 165 : /* gcc asm goto does not allow outputs */ 175 166 : [cpu_id] "r" (cpu), 176 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 177 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 167 + [rseq_abi] "r" (&__rseq_abi), 178 168 /* final store input */ 179 169 [v] "m" (*v), 180 170 [expectnot] "r" (expectnot), ··· 208 200 __asm__ __volatile__ goto ( 209 201 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 210 202 /* Start rseq by storing table entry pointer into rseq_cs. */ 211 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 212 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 203 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 204 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 213 205 RSEQ_INJECT_ASM(3) 214 206 #ifdef RSEQ_COMPARE_TWICE 215 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 207 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 216 208 #endif 217 209 /* final store */ 218 210 "addq %[count], %[v]\n\t" ··· 221 213 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 222 214 : /* gcc asm goto does not allow outputs */ 223 215 : [cpu_id] "r" (cpu), 224 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 225 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 216 + [rseq_abi] "r" (&__rseq_abi), 226 217 /* final store input */ 227 218 [v] "m" (*v), 228 219 [count] "er" (count) ··· 252 245 __asm__ __volatile__ goto ( 253 246 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 254 247 /* Start rseq by storing table entry pointer into rseq_cs. */ 255 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 256 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 248 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 249 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 257 250 RSEQ_INJECT_ASM(3) 258 251 "cmpq %[v], %[expect]\n\t" 259 252 "jnz %l[cmpfail]\n\t" 260 253 RSEQ_INJECT_ASM(4) 261 254 #ifdef RSEQ_COMPARE_TWICE 262 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 255 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 263 256 "cmpq %[v], %[expect]\n\t" 264 257 "jnz %l[error2]\n\t" 265 258 #endif ··· 273 266 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 274 267 : /* gcc asm goto does not allow outputs */ 275 268 : [cpu_id] "r" (cpu), 276 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 277 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 269 + [rseq_abi] "r" (&__rseq_abi), 278 270 /* try store input */ 279 271 [v2] "m" (*v2), 280 272 [newv2] "r" (newv2), ··· 321 315 __asm__ __volatile__ goto ( 322 316 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 323 317 /* Start rseq by storing table entry pointer into rseq_cs. */ 324 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 325 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 318 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 319 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 326 320 RSEQ_INJECT_ASM(3) 327 321 "cmpq %[v], %[expect]\n\t" 328 322 "jnz %l[cmpfail]\n\t" ··· 331 325 "jnz %l[cmpfail]\n\t" 332 326 RSEQ_INJECT_ASM(5) 333 327 #ifdef RSEQ_COMPARE_TWICE 334 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 328 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 335 329 "cmpq %[v], %[expect]\n\t" 336 330 "jnz %l[error2]\n\t" 337 331 "cmpq %[v2], %[expect2]\n\t" ··· 344 338 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 345 339 : /* gcc asm goto does not allow outputs */ 346 340 : [cpu_id] "r" (cpu), 347 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 348 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 341 + [rseq_abi] "r" (&__rseq_abi), 349 342 /* cmp2 input */ 350 343 [v2] "m" (*v2), 351 344 [expect2] "r" (expect2), ··· 390 385 "movq %[dst], %[rseq_scratch1]\n\t" 391 386 "movq %[len], %[rseq_scratch2]\n\t" 392 387 /* Start rseq by storing table entry pointer into rseq_cs. */ 393 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 394 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 388 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 389 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 395 390 RSEQ_INJECT_ASM(3) 396 391 "cmpq %[v], %[expect]\n\t" 397 392 "jnz 5f\n\t" 398 393 RSEQ_INJECT_ASM(4) 399 394 #ifdef RSEQ_COMPARE_TWICE 400 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f) 395 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 6f) 401 396 "cmpq %[v], %[expect]\n\t" 402 397 "jnz 7f\n\t" 403 398 #endif ··· 445 440 #endif 446 441 : /* gcc asm goto does not allow outputs */ 447 442 : [cpu_id] "r" (cpu), 448 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 449 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 443 + [rseq_abi] "r" (&__rseq_abi), 450 444 /* final store input */ 451 445 [v] "m" (*v), 452 446 [expect] "r" (expect), ··· 537 533 538 534 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs) \ 539 535 RSEQ_INJECT_ASM(1) \ 540 - "movl $" __rseq_str(cs_label) ", %[rseq_cs]\n\t" \ 536 + "movl $" __rseq_str(cs_label) ", " __rseq_str(rseq_cs) "\n\t" \ 541 537 __rseq_str(label) ":\n\t" 542 538 543 539 #define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label) \ 544 540 RSEQ_INJECT_ASM(2) \ 545 - "cmpl %[" __rseq_str(cpu_id) "], %[" __rseq_str(current_cpu_id) "]\n\t" \ 541 + "cmpl %[" __rseq_str(cpu_id) "], " __rseq_str(current_cpu_id) "\n\t" \ 546 542 "jnz " __rseq_str(label) "\n\t" 547 543 548 544 #define RSEQ_ASM_DEFINE_ABORT(label, teardown, abort_label) \ ··· 570 566 __asm__ __volatile__ goto ( 571 567 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 572 568 /* Start rseq by storing table entry pointer into rseq_cs. */ 573 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 574 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 569 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 570 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 575 571 RSEQ_INJECT_ASM(3) 576 572 "cmpl %[v], %[expect]\n\t" 577 573 "jnz %l[cmpfail]\n\t" 578 574 RSEQ_INJECT_ASM(4) 579 575 #ifdef RSEQ_COMPARE_TWICE 580 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 576 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 581 577 "cmpl %[v], %[expect]\n\t" 582 578 "jnz %l[error2]\n\t" 583 579 #endif ··· 588 584 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 589 585 : /* gcc asm goto does not allow outputs */ 590 586 : [cpu_id] "r" (cpu), 591 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 592 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 587 + [rseq_abi] "r" (&__rseq_abi), 593 588 [v] "m" (*v), 594 589 [expect] "r" (expect), 595 590 [newv] "r" (newv) ··· 626 623 __asm__ __volatile__ goto ( 627 624 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 628 625 /* Start rseq by storing table entry pointer into rseq_cs. */ 629 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 630 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 626 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 627 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 631 628 RSEQ_INJECT_ASM(3) 632 629 "movl %[v], %%ebx\n\t" 633 630 "cmpl %%ebx, %[expectnot]\n\t" 634 631 "je %l[cmpfail]\n\t" 635 632 RSEQ_INJECT_ASM(4) 636 633 #ifdef RSEQ_COMPARE_TWICE 637 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 634 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 638 635 "movl %[v], %%ebx\n\t" 639 636 "cmpl %%ebx, %[expectnot]\n\t" 640 637 "je %l[error2]\n\t" ··· 649 646 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 650 647 : /* gcc asm goto does not allow outputs */ 651 648 : [cpu_id] "r" (cpu), 652 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 653 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 649 + [rseq_abi] "r" (&__rseq_abi), 654 650 /* final store input */ 655 651 [v] "m" (*v), 656 652 [expectnot] "r" (expectnot), ··· 684 682 __asm__ __volatile__ goto ( 685 683 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 686 684 /* Start rseq by storing table entry pointer into rseq_cs. */ 687 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 688 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 685 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 686 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 689 687 RSEQ_INJECT_ASM(3) 690 688 #ifdef RSEQ_COMPARE_TWICE 691 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 689 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 692 690 #endif 693 691 /* final store */ 694 692 "addl %[count], %[v]\n\t" ··· 697 695 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 698 696 : /* gcc asm goto does not allow outputs */ 699 697 : [cpu_id] "r" (cpu), 700 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 701 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 698 + [rseq_abi] "r" (&__rseq_abi), 702 699 /* final store input */ 703 700 [v] "m" (*v), 704 701 [count] "ir" (count) ··· 728 727 __asm__ __volatile__ goto ( 729 728 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 730 729 /* Start rseq by storing table entry pointer into rseq_cs. */ 731 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 732 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 730 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 731 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 733 732 RSEQ_INJECT_ASM(3) 734 733 "cmpl %[v], %[expect]\n\t" 735 734 "jnz %l[cmpfail]\n\t" 736 735 RSEQ_INJECT_ASM(4) 737 736 #ifdef RSEQ_COMPARE_TWICE 738 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 737 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 739 738 "cmpl %[v], %[expect]\n\t" 740 739 "jnz %l[error2]\n\t" 741 740 #endif ··· 750 749 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 751 750 : /* gcc asm goto does not allow outputs */ 752 751 : [cpu_id] "r" (cpu), 753 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 754 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 752 + [rseq_abi] "r" (&__rseq_abi), 755 753 /* try store input */ 756 754 [v2] "m" (*v2), 757 755 [newv2] "m" (newv2), ··· 789 789 __asm__ __volatile__ goto ( 790 790 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 791 791 /* Start rseq by storing table entry pointer into rseq_cs. */ 792 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 793 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 792 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 793 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 794 794 RSEQ_INJECT_ASM(3) 795 795 "movl %[expect], %%eax\n\t" 796 796 "cmpl %[v], %%eax\n\t" 797 797 "jnz %l[cmpfail]\n\t" 798 798 RSEQ_INJECT_ASM(4) 799 799 #ifdef RSEQ_COMPARE_TWICE 800 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 800 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 801 801 "movl %[expect], %%eax\n\t" 802 802 "cmpl %[v], %%eax\n\t" 803 803 "jnz %l[error2]\n\t" ··· 813 813 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 814 814 : /* gcc asm goto does not allow outputs */ 815 815 : [cpu_id] "r" (cpu), 816 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 817 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 816 + [rseq_abi] "r" (&__rseq_abi), 818 817 /* try store input */ 819 818 [v2] "m" (*v2), 820 819 [newv2] "r" (newv2), ··· 853 854 __asm__ __volatile__ goto ( 854 855 RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */ 855 856 /* Start rseq by storing table entry pointer into rseq_cs. */ 856 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 857 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 857 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 858 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 858 859 RSEQ_INJECT_ASM(3) 859 860 "cmpl %[v], %[expect]\n\t" 860 861 "jnz %l[cmpfail]\n\t" ··· 863 864 "jnz %l[cmpfail]\n\t" 864 865 RSEQ_INJECT_ASM(5) 865 866 #ifdef RSEQ_COMPARE_TWICE 866 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1]) 867 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1]) 867 868 "cmpl %[v], %[expect]\n\t" 868 869 "jnz %l[error2]\n\t" 869 870 "cmpl %[expect2], %[v2]\n\t" ··· 877 878 RSEQ_ASM_DEFINE_ABORT(4, "", abort) 878 879 : /* gcc asm goto does not allow outputs */ 879 880 : [cpu_id] "r" (cpu), 880 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 881 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 881 + [rseq_abi] "r" (&__rseq_abi), 882 882 /* cmp2 input */ 883 883 [v2] "m" (*v2), 884 884 [expect2] "r" (expect2), ··· 924 926 "movl %[dst], %[rseq_scratch1]\n\t" 925 927 "movl %[len], %[rseq_scratch2]\n\t" 926 928 /* Start rseq by storing table entry pointer into rseq_cs. */ 927 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 928 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 929 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 930 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 929 931 RSEQ_INJECT_ASM(3) 930 932 "movl %[expect], %%eax\n\t" 931 933 "cmpl %%eax, %[v]\n\t" 932 934 "jnz 5f\n\t" 933 935 RSEQ_INJECT_ASM(4) 934 936 #ifdef RSEQ_COMPARE_TWICE 935 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f) 937 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 6f) 936 938 "movl %[expect], %%eax\n\t" 937 939 "cmpl %%eax, %[v]\n\t" 938 940 "jnz 7f\n\t" ··· 982 984 #endif 983 985 : /* gcc asm goto does not allow outputs */ 984 986 : [cpu_id] "r" (cpu), 985 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 986 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 987 + [rseq_abi] "r" (&__rseq_abi), 987 988 /* final store input */ 988 989 [v] "m" (*v), 989 990 [expect] "m" (expect), ··· 1031 1034 "movl %[dst], %[rseq_scratch1]\n\t" 1032 1035 "movl %[len], %[rseq_scratch2]\n\t" 1033 1036 /* Start rseq by storing table entry pointer into rseq_cs. */ 1034 - RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs) 1035 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f) 1037 + RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi])) 1038 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f) 1036 1039 RSEQ_INJECT_ASM(3) 1037 1040 "movl %[expect], %%eax\n\t" 1038 1041 "cmpl %%eax, %[v]\n\t" 1039 1042 "jnz 5f\n\t" 1040 1043 RSEQ_INJECT_ASM(4) 1041 1044 #ifdef RSEQ_COMPARE_TWICE 1042 - RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f) 1045 + RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 6f) 1043 1046 "movl %[expect], %%eax\n\t" 1044 1047 "cmpl %%eax, %[v]\n\t" 1045 1048 "jnz 7f\n\t" ··· 1090 1093 #endif 1091 1094 : /* gcc asm goto does not allow outputs */ 1092 1095 : [cpu_id] "r" (cpu), 1093 - [current_cpu_id] "m" (__rseq_abi.cpu_id), 1094 - [rseq_cs] "m" (__rseq_abi.rseq_cs), 1096 + [rseq_abi] "r" (&__rseq_abi), 1095 1097 /* final store input */ 1096 1098 [v] "m" (*v), 1097 1099 [expect] "m" (expect),