[aarch64-port-dev ] RFR: 8224828: aarch64: save and restore the rflags register in push_CPU_state and pop_CPU_state
Yangfei (Felix)
felix.yang at huawei.com
Mon May 27 12:42:45 UTC 2019
Hi,
Please review:
JBS: https://bugs.openjdk.java.net/browse/JDK-8224828
Webrev: http://cr.openjdk.java.net/~fyang/8224828/webrev.00/
Currently, the rflags register is not handled in push_CPU_state and pop_CPU_state for the aarch64 port (including aarch64-8u, jdk11 and jdk13).
This is causing random Hadoop Terasort failure using an aarch64-8u jvm.
After some further investigation, we located the problematic C2 JIT code snippet:
1190 0x0000ffff785f8a1c: lsr x14, x15, x11
1191 0x0000ffff785f8a20: lsr x11, x6, x11
1192 0x0000ffff785f8a24: and x11, x11, #0xff
1193 0x0000ffff785f8a28: and x14, x14, #0xff
1194 0x0000ffff785f8a2c: sub x11, x14, x11
1195 0x0000ffff785f8a30: mov w14, w11
1196 0x0000ffff785f8a34: cmp w14, #0x0
1197 0x0000ffff785f8a38: cset w15, lt ;*invokeinterface compare
1198 ; - org.apache.hadoop.mapred.Merger$MergeQueue::lessThan at 70 (line 658)
1199 ; - org.apache.hadoop.util.PriorityQueue::downHeap at 41 (line 141)
1200 ; - org.apache.hadoop.util.PriorityQueue::adjustTop at 1 (line 108)
1201 ; - org.apache.hadoop.mapred.Merger$MergeQueue::adjustPriorityQueue at 59 (line 595)
1202 ; - org.apache.hadoop.mapred.Merger$MergeQueue::next at 25 (line 618)
1203
1204 0x0000ffff785f8a3c: cmp w14, #0x0 <====================
1205 0x0000ffff785f8a40: adrp x11, 0x0000ffff88830000
1206 ; {poll}
1207 0x0000ffff785f8a44: mov w17, w20 ; OopMap{r17=NarrowOop [32]=Oop [40]=Oop [56]=Oop [64]=Oop [80]=NarrowOop off=1224}
1208 ;*ifeq
1209 ; - org.apache.hadoop.util.PriorityQueue::downHeap at 121 (line 149)
1210 ; - org.apache.hadoop.util.PriorityQueue::adjustTop at 1 (line 108)
1211 ; - org.apache.hadoop.mapred.Merger$MergeQueue::adjustPriorityQueue at 59 (line 595)
1212 ; - org.apache.hadoop.mapred.Merger$MergeQueue::next at 25 (line 618)
1213
1214 0x0000ffff785f8a48: ldr wzr, [x11] ; {poll} <====================
1215 0x0000ffff785f8a4c: csel w24, w12, w10, lt ;*invokevirtual compareTo <====================
1216 ; - org.apache.hadoop.io.FastByteComparisons$LexicographicalComparerHolder$UnsafeComparer::compareTo at 16 ( line 132)
1217 ; - org.apache.hadoop.io.FastByteComparisons::compareTo at 11 (line 46)
1218 ; - org.apache.hadoop.io.WritableComparator::compareBytes at 8 (line 188)
1219 ; - org.apache.hadoop.io.Text$Comparator::compare at 39 (line 368)
1220 ; - org.apache.hadoop.mapred.Merger$MergeQueue::lessThan at 70 (line 658)
1221 ; - org.apache.hadoop.util.PriorityQueue::downHeap at 41 (line 141)
1222 ; - org.apache.hadoop.util.PriorityQueue::adjustTop at 1 (line 108)
1223 ; - org.apache.hadoop.mapred.Merger$MergeQueue::adjustPriorityQueue at 59 (line 595)
1224 ; - org.apache.hadoop.mapred.Merger$MergeQueue::next at 25 (line 618)
At line 1204, the rflags register is defined and it will be used at line 1215. There is a safepoint poll in between at line 1214.
Safepoint is requested at line 1214 and control flow continues in the code generated by SafepointBlob* SharedRuntime::generate_handler_blob.
This blob calls save_live_register and restore_live_registers which will finally calls push_CPU_state and pop_CPU_state.
As the rflags register is not saved and restored by push_CPU_state and pop_CPU_state, we got an invalid rflags at line 1215.
Patch fixes the issue for jdk13 by saving and restoring the rflags register in push_CPU_state and pop_CPU_state respectively.
Thanks,
Felix
More information about the aarch64-port-dev
mailing list