Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8309258: RISC-V: Add riscv_hwprobe syscall #20

Closed
wants to merge 4 commits into from

Conversation

zifeihan
Copy link
Member

@zifeihan zifeihan commented Apr 10, 2024

Hi,
Please help review this backport to riscv-port-jdk11u.
Backport of 8309258, 8315206, 8316859, 8324280, 8315652

Since 8315195 hasn't been backported yet, the RVV,Zba,Zbb extension hasn't been turned on automatically yet.

This backport adds the syscall, uses the syscall in combination with the aux and cpuinfo to enable features by default.

The following changes were added to the original patch to avoid build errors:

  1. Use enum VM_MODE instead of enum UNALIGNED_ACCESS : int to avoid c++ build warnings, this is c++11 feature. build log like this :
/home/zifeihan/riscv-port-jdk11u/src/hotspot/cpu/riscv/vm_version_riscv.hpp:168:27: warning: scoped enums only available with '-std=c++11' or '-std=gnu++11'
  168 |   enum UNALIGNED_ACCESS : int {
      |                           ^~~
In file included from /home/zifeihan/riscv-port-jdk11u/src/hotspot/share/runtime/vm_version.hpp:29
  1. Use NULL instead of nullptr
/home/zifeihan/riscv-port-jdk11u/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp:86:79: error: 'nullptr' was not declared in this scope
   86 |   int ret = sys_riscv_hwprobe(&query[0], sizeof(query) / sizeof(query[0]), 0, nullptr, 0);
      |
  1. Use #include "memory/allocation.hpp" instead of #include "memory/allStatic.hpp"

Testing on SOPHON SG2042

$ ./java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version | grep Use
     bool UseRVC                                   = true                            {ARCH experimental} {default}
     bool UseRVV                                   = false                           {ARCH experimental} {default}
     bool UseZba                                   = false                           {ARCH experimental} {default}
     bool UseZbb                                   = false                           {ARCH experimental} {default}

test/lib/sun/hotspot/cpuinfo/CPUInfo.java log like this:

----------System.out:(13/2767)----------
WB.getCPUFeatures(): "qemu rv64 i m a f d c"
CPUInfo.getFeatures(): [qemu, rv64, i, m, a, f, d, c]

Testing on qemu-system

$ ./java -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version | grep Use
     bool UseRVC                                   = true                            {ARCH experimental} {default}
     bool UseRVV                                   = false                           {ARCH experimental} {default}
     bool UseZba                                   = false                           {ARCH experimental} {default}
     bool UseZbb                                   = false                           {ARCH experimental} {default}

test/lib/sun/hotspot/cpuinfo/CPUInfo.java log like this:

----------System.out:(13/2290)----------
WB.getCPUFeatures(): "rv64 i m a f d c"
CPUInfo.getFeatures(): [rv64, i, m, a, f, d, c]

Testing

  • Run tier1 tests on SOPHON SG2042 (release)

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issues

  • JDK-8309258: RISC-V: Add riscv_hwprobe syscall (Enhancement - P4)
  • JDK-8315206: RISC-V: hwprobe query is_set return wrong value (Bug - P2)
  • JDK-8316859: RISC-V: Disable detection of V through HWCAP (Task - P4)
  • JDK-8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode (Bug - P4)
  • JDK-8315652: RISC-V: Features string uses wrong separator for jtreg (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/riscv-port-jdk11u.git pull/20/head:pull/20
$ git checkout pull/20

Update a local copy of the PR:
$ git checkout pull/20
$ git pull https://git.openjdk.org/riscv-port-jdk11u.git pull/20/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20

View PR using the GUI difftool:
$ git pr show -t 20

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/riscv-port-jdk11u/pull/20.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 10, 2024

👋 Welcome back gcao! A progress list of the required criteria for merging this PR into riscv-port will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 10, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 31b6fd775f1c4f2841d9a52ad5f275ad446ee661 8309258: RISC-V: Add riscv_hwprobe syscall Apr 10, 2024
@openjdk
Copy link

openjdk bot commented Apr 10, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport label Apr 10, 2024
@zifeihan
Copy link
Member Author

/issue add 8315206
/issue add 8316859
/issue add 8324280
/issue add 8315652

@openjdk
Copy link

openjdk bot commented Apr 10, 2024

@zifeihan
Adding additional issue to issue list: 8315206: RISC-V: hwprobe query is_set return wrong value.

@zifeihan zifeihan marked this pull request as ready for review April 10, 2024 05:31
@openjdk
Copy link

openjdk bot commented Apr 10, 2024

@zifeihan
Adding additional issue to issue list: 8316859: RISC-V: Disable detection of V through HWCAP.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 10, 2024
@openjdk
Copy link

openjdk bot commented Apr 10, 2024

@zifeihan
Adding additional issue to issue list: 8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode.

@openjdk
Copy link

openjdk bot commented Apr 10, 2024

@zifeihan
Adding additional issue to issue list: 8315652: RISC-V: Features string uses wrong separator for jtreg.

@mlbridge
Copy link

mlbridge bot commented Apr 10, 2024

Webrevs

@RealFYang
Copy link
Member

RealFYang commented Apr 10, 2024

I see the original commit of https://bugs.openjdk.org/browse/JDK-8309258 touches UseZbs which is not there in this repo yet. So I think you should backport https://bugs.openjdk.org/browse/JDK-8297715 first.

@zifeihan
Copy link
Member Author

I see the original commit of https://bugs.openjdk.org/browse/JDK-8309258 touches UseZbs which is not there in this repo yet. So I think you should backport https://bugs.openjdk.org/browse/JDK-8297715 first.

Hi, Thanks for your review. You are right, I've submitted #21 backport pr.

@zifeihan zifeihan marked this pull request as draft April 12, 2024 03:46
@openjdk openjdk bot removed the rfr Pull request is ready for review label Apr 12, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Jun 7, 2024

@zifeihan This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 2, 2024

@zifeihan This pull request has been inactive for more than 16 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants