Seeing error in one test on ARM: org.openjdk.jcstress.tests.volatiles.ReadTwiceOverVolatileReadTest

White, Derek Derek.White at cavium.com
Wed Feb 22 22:49:50 UTC 2017


Hi All,

I'm seeing a consistent failure on variant of an aarch64 machine in the test org.openjdk.jcstress.tests.volatiles.ReadTwiceOverVolatileReadTest. I'm trying to understand what the "Observed state" values mean (in particular 1, 0, 0), and furthermore what they imply.

JVM options: [-client, -XX:-TieredCompilation] Iterations: 5 Time: 1000
Observed state      Occurrence   Expectation Interpretation
0, 0, 0      10098236     ACCEPTABLE   Default value for the fields. Observers are allowed to see the default value for the field, because there is the data race between reader and writer.
0, 0, 1      3225   ACCEPTABLE   Write to $y is still in flight, $x is arriving late.
0, 1, 0      0      FORBIDDEN    Volatile write to $y had happened, and update to $x had been lost.
0, 1, 1      4584   ACCEPTABLE   The writes appear the the writers' order.
1, 0, 0      1      FORBIDDEN    No default case provided, assume FORBIDDEN
1, 0, 1      84720 ACCEPTABLE   Write to $y is still in flight, $x has arrived.
1, 1, 0      0      FORBIDDEN    Volatile write to $y had happened, and update to $x had been lost.
1, 1, 1      9168594      ACCEPTABLE   Both updates are visible.

For more background, the test fails with C1 only, succeeds with C2. C1 is handling the volatile field using load-acquire/store-release instructions, while C2 is using the more verbose and potentially slower explicit memory barrier instructions. The code is nearly trivial.

Could this be a test bug? Thanks!


  *   Derek White


public class ReadTwiceOverVolatileReadTest {
    int x;
    volatile int y;

    @Actor
    public void actor1() {
        x = 1;
        y = 1;
    }
    @Actor
    public void actor2(IntResult3 r) {
        r.r1 = x;
        r.r2 = y;
        r.r3 = x;
    }
}

=== actor1() ===
--- C1 ---:
  0x0000ffff6c9ad65c: orr     w11, wzr, #0x1
  0x0000ffff6c9ad660: str     w11, [x1,#12]     // x = 1;
  0x0000ffff6c9ad664: add     x10, x1, #0x10
  0x0000ffff6c9ad668: stlr    w11, [x10]      ;*putfield y {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 58)
--- C2 ---:
  0x0000ffff87dfc0e8: orr     w7, wzr, #0x1
  0x0000ffff87dfc0ec: dmb     ish
  0x0000ffff87dfc0f0: str     w7, [x6,#16]
  0x0000ffff87dfc0f4: dmb     ish             ;*putfield y {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 58)
                                                ; - (line 146)

=== actor2() ===
--- C1 ---:
  0x0000ffff6c9ad068: ldr     w11, [x1,#12]   ;*getfield x {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 63)
  0x0000ffff6c9ad06c: cbz     x2, 0x0000ffff6c9ad09c
                                                ;*putfield r1 {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 63)
  0x0000ffff6c9ad070: add     x10, x1, #0x10
  0x0000ffff6c9ad074: ldar    w10, [x10]
  0x0000ffff6c9ad078: str     w11, [x2,#12]   ;*getfield y {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 64)
  0x0000ffff6c9ad07c: ldr     w12, [x1,#12]
  0x0000ffff6c9ad080: str     w12, [x2,#20]   ;*putfield r3 {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 65)

  0x0000ffff6c9ad084: str     w10, [x2,#16]   ;*getfield x {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 63)
--- C2 ---:
  0x0000ffff87d8923c: ldr     w0, [x1,#12]    ;*getfield x {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 63)
  0x0000ffff87d89240: str     w0, [x2,#12]    ;*putfield r1 {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 63)
                                                ; implicit exception:
  0x0000ffff87d89244: ldr     w0, [x1,#16]
  0x0000ffff87d89248: dmb     ishld           ;*getfield y {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 64)
  0x0000ffff87d8924c: str     w0, [x2,#16]    ;*putfield r2 {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 64)
  0x0000ffff87d89250: ldr     w0, [x1,#12]    ;*getfield x {reexecute=0 rethrow=0 return_oop=0}
                                                ; - (line 65)
  0x0000ffff87d89254: str     w0, [x2,#20]    ;*putfield r3 {reexecute=0 rethrow=0 return_oop=0}



More information about the jcstress-dev mailing list