On Wed, 10 Jun 2026 17:35:43 GMT, Mat Carter <[email protected]> wrote:

> With -UseLSE the Starvation test on Windows ARM64 timeouts close to 100% 
> whereas this only happens on Linux ARM64 on larger machines with many cores. 
> The issue is that C2 outputs an LDR following the CAS in LinkedTransferQueue 
> which can execute before the STLXR breaking the Dekker protocol.
> 
> Replacing the LDR with LADR by using getAcquire solves the issue as it won't 
> be reordered before the STLXR.  This does impact the +UseLSE case as the LADR 
> was not necessary and is slightly more expensive than LDR.  But to handle 
> this case would require larger changes to Hotspot
> 
> Starvation test passes on Windows ARM64 and Linux ARM64, with no regressions 
> on tier1
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Yes, the `LDAR` should prevent the `LDR[waiter]` from floating upwards.

I wrote the following herd7 test to ensure that `CASAL` doesn't suffer from the 
same problem:


AArch64 CASAL_no_STLXR_LDR_hole

{
x=0; y=0;
0:X1=x; 0:X3=y;
1:X1=y; 1:X3=x;
}

 P0                     | P1                          ;
 MOV   W0,#0            | LDXR  W8,[X1]               ;
 MOV   W2,#1            | MOV   W5,#1                 ;
 CASAL W0,W2,[X1]       | STLXR W6,W5,[X1]            ;
 LDR   W4,[X3]          | LDAR  W9,[X3]               ;

exists
(0:X0=0 /\ 0:X4=0 /\ 1:X6=0 /\ 1:X9=0)


Regardless of the fix for this PR, maybe we ought to reconsider the intrinsic 
for `-UseLSE` case on the basis that it has differing semantics depending on 
your particular ARM processor?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31465#issuecomment-4720288196
PR Comment: https://git.openjdk.org/jdk/pull/31465#issuecomment-4727176114

Reply via email to