RFR: JDK-8158502: aarch32: detect QEMU user-mode emulation

Alex Kashchenko akashche at redhat.com
Thu Jun 2 11:21:30 UTC 2016


Hi,

This patch detects that jvm runs on x86_64 hardware using QEMU user-mode 
emulation and prevents (ignores) assertions that currently happen in 
that environment:

  - issue: https://bugs.openjdk.java.net/browse/JDK-8158502
  - webrev: 
http://cr.openjdk.java.net/~akasko/aarch32/jdk8u/8158502/webrev.00/

QEMU allows to run arm32 programs on x86_64 hardware with user-mode 
emulation tools (qemu-arm-static). Along with binfmt_misc setup it 
allows to run aarch32 jvm on x86_64 hardware transparently like a native 
binary (albeit at the much slower speed). That may be useful during the 
cross-compilation for smoke testing aarch32 changes.

Currently jvm asserts on startup in that environment. Proposed change is 
to detect QEMU user-mode emulation and prevent (ignore) assertions in 
that case.

Detection is done looking into "lm" (64-bit) or "tm" (32-bit) entry in 
"flags" field in /proc/cpuinfo. It is assumed that if we can see 
x86(_64) CPU from aarch32 JVM - we are running in user-mode emulation as 
QEMU+kernel emulation reports its own /proc/cpuinfo. Detection result is 
saved as FT_UMEmu (User Mode Emulation) flag in VMVersion.

Actual changes are in relocInfo_aarch32.cpp , they are deliberately 
non-intrusive to mainline execution code - effectively just assertions 
are ignored. It may (or may not) be better to implement proper support 
for user-mode emulation in that code in future.

Checks before printing warnings have been required, because these 
warnings (all 4 of them) being printed in release builds - that breaks 
jdk version detection.

Running in user-mode emulation aarch32 vm is stable - during testing I 
bootstrapped slowdebug aarch32-jdk8u using fastdebug aarch32-jdk8u as a 
boot jdk on x86_64 hardware.

Webrev is done against the current state of jdk8u forest. Changes to 
vm_version part may conflict with other patches. After the review I'll 
rebase this patch onto the new state and will create committed webrevs 
for jdk8u and jdk9.

-- 
-Alex


More information about the aarch32-port-dev mailing list