RFR: 8329823: RISC-V: Need to sync CPU features with related JVM flags

Gui Cao gcao at openjdk.org
Mon Apr 8 04:57:22 UTC 2024


Hi, As described by [8329823](https://bugs.openjdk.org/browse/JDK-8329823), currently, "features" string is not accurate in that the RISC-V CPU features/extensions which are disabled by user on the command are still added. We need to synchronize these features with related JVM flags so that "features" string can reflect actual usable CPU features. 


### Testing
- [x] Run tier1 tests on SOPHON SG2042 (release)

Results without specifying any jvm flags(After applying this patch)


$ /home/zifeihan/jtreg/bin/jtreg -jdk:/home/zifeihan/jre/jdk /home/zifeihan/jdk/test/lib-test/jdk/test/whitebox/CPUInfoTest.java

----------System.out:(4/178)----------
WB.getCPUFeatures(): "rv64 i m a f d c v zba zbb zbs zvkn"
CPUInfo.getAdditionalCPUInfo(): ""
CPUInfo.getFeatures(): [rv64, i, m, a, f, d, c, v, zba, zbb, zbs, zvkn]
TEST PASSED


Results with specifying `-XX:-UseZba`(After applying this patch)


$ /home/zifeihan/jtreg/bin/jtreg -javaoption:-XX:-UseZba -jdk:/home/zifeihan/jre/jdk /home/zifeihan/jdk/test/lib-test/jdk/test/whitebox/CPUInfoTest.java

----------System.out:(4/158)----------
----------System.out:(4/169)----------
WB.getCPUFeatures(): "rv64 i m a f d c v zbb zbs zvkn"
CPUInfo.getAdditionalCPUInfo(): ""
CPUInfo.getFeatures(): [rv64, i, m, a, f, d, c, v, zbb, zbs, zvkn]
TEST PASSED


Results with specifying `-XX:+UseZba`(After applying this patch)


$ /home/zifeihan/jtreg/bin/jtreg -javaoption:-XX:+UseZba -jdk:/home/zifeihan/jre/jdk /home/zifeihan/jdk/test/lib-test/jdk/test/whitebox/CPUInfoTest.java

----------System.out:(4/178)----------
WB.getCPUFeatures(): "rv64 i m a f d c v zba zbb zbs zvkn"
CPUInfo.getAdditionalCPUInfo(): ""
CPUInfo.getFeatures(): [rv64, i, m, a, f, d, c, v, zba, zbb, zbs, zvkn]
TEST PASSED

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

Commit messages:
 - 8329823: RISC-V: Need to sync CPU features with related JVM flags

Changes: https://git.openjdk.org/jdk/pull/18668/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18668&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8329823
  Stats: 29 lines in 2 files changed: 18 ins; 2 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/18668.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18668/head:pull/18668

PR: https://git.openjdk.org/jdk/pull/18668


More information about the hotspot-dev mailing list