Restartable sequences: don't clear rseq_cs after c.s.
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 16 Oct 2016 06:22:56 +0000 (08:22 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Oct 2016 22:28:18 +0000 (18:28 -0400)
We can remove this rseq_cs=NULL clearing step at the end of the critical
section, since the kernel checks for lower and upper address ranges when
it preempts or delivers a signals. The kernel will either take care of
clearing it at the next preemption or signal delivery, or the next
critical section will either change its value, or set it to the same
value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tools/testing/selftests/rseq/rseq-arm.h
tools/testing/selftests/rseq/rseq-ppc.h
tools/testing/selftests/rseq/rseq-x86.h

index a8af6def22e7b80a5074fbfe0dbe452961d4d14b..b5f57d2500715c718ca33d49fa5389310dcfb44a 100644 (file)
@@ -47,11 +47,6 @@ do {                                                                 \
 /*
  * The __rseq_table section can be used by debuggers to better handle
  * single-stepping through the restartable critical sections.
- *
- * Load the immediate value 0 into register r1 right after the ldr
- * instruction to improve instruction-level parallelism: load the
- * constant while the processor is stalled waiting for the load to
- * complete, which is required by the following comparison and branch.
  */
 
 #define RSEQ_FINISH_ASM(_target_final, _to_write_final, _start_value, \
@@ -72,7 +67,6 @@ do { \
                "str r0, [%[rseq_cs]]\n\t" \
                RSEQ_INJECT_ASM(2) \
                "ldr r0, %[current_event_counter]\n\t" \
-               "mov r1, #0\n\t" \
                "cmp %[start_event_counter], r0\n\t" \
                "bne 5f\n\t" \
                RSEQ_INJECT_ASM(3) \
@@ -80,15 +74,12 @@ do { \
                _final_store \
                "2:\n\t" \
                RSEQ_INJECT_ASM(5) \
-               "str r1, [%[rseq_cs]]\n\t" \
                _teardown \
                "b 4f\n\t" \
                ".balign 32\n\t" \
                "3:\n\t" \
                ".word 1b, 0x0, 2b, 0x0, 5f, 0x0, 0x0, 0x0\n\t" \
                "5:\n\t" \
-               "mov r1, #0\n\t" \
-               "str r1, [%[rseq_cs]]\n\t" \
                _teardown \
                "b %l[failure]\n\t" \
                "4:\n\t" \
@@ -99,7 +90,7 @@ do { \
                  _spec_input \
                  _final_input \
                  RSEQ_INJECT_INPUT \
-               : "r0", "r1", "memory", "cc" \
+               : "r0", "memory", "cc" \
                  _extra_clobber \
                  RSEQ_INJECT_CLOBBER \
                : _failure \
index 287ab75ca77b3fad7c4339d0e790e21e4d71ae99..29498b559d663ac74b5227392a39e7f5245c305e 100644 (file)
@@ -86,13 +86,9 @@ do {                                                                 \
                _final_store \
                "2:\n\t" \
                RSEQ_INJECT_ASM(5) \
-               "li %%r17, 0\n\t" \
-               "std %%r17, 0(%[rseq_cs])\n\t" \
                _teardown \
                "b 5f\n\t" \
                "4:\n\t" \
-               "li %%r17, 0\n\t" \
-               "std %%r17, 0(%[rseq_cs])\n\t" \
                _teardown \
                "b %l[failure]\n\t" \
                "5:\n\t" \
@@ -192,13 +188,9 @@ do {                                                                       \
                _final_store \
                "2:\n\t" \
                RSEQ_INJECT_ASM(5) \
-               "li %%r17, 0\n\t" \
-               "stw %%r17, 0(%[rseq_cs])\n\t" \
                _teardown \
                "b 5f\n\t" \
                "4:\n\t" \
-               "li %%r17, 0\n\t" \
-               "stw %%r17, 0(%[rseq_cs])\n\t" \
                _teardown \
                "b %l[failure]\n\t" \
                "5:\n\t" \
index 9dab0946a35abf8eac9e41890f1ffcf475a0f98e..f5a792a16963373c8430d775f87a692f36647f22 100644 (file)
@@ -75,11 +75,9 @@ do { \
                _final_store \
                "2:\n\t" \
                RSEQ_INJECT_ASM(5) \
-               "movq $0, %[rseq_cs]\n\t" \
                _teardown \
                ".pushsection __rseq_failure, \"a\"\n\t" \
                "4:\n\t" \
-               "movq $0, %[rseq_cs]\n\t" \
                _teardown \
                "jmp %l[failure]\n\t" \
                ".popsection\n\t" \
@@ -219,11 +217,9 @@ do { \
                _final_store \
                "2:\n\t" \
                RSEQ_INJECT_ASM(5) \
-               "movl $0, %[rseq_cs]\n\t" \
                _teardown \
                ".pushsection __rseq_failure, \"a\"\n\t" \
                "4:\n\t" \
-               "movl $0, %[rseq_cs]\n\t" \
                _teardown \
                "jmp %l[failure]\n\t" \
                ".popsection\n\t" \
This page took 0.035362 seconds and 5 git commands to generate.