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

8324304: RISC-V: add hw probe flags #17519

Closed
wants to merge 4 commits into from

Conversation

Hamlin-Li
Copy link

@Hamlin-Li Hamlin-Li commented Jan 22, 2024

Hi,
Can you help to review this simple patch to add hw probe flags?
Thanks!

Per https://github.com/torvalds/linux/blob/master/arch/riscv/include/uapi/asm/hwprobe.h, several extensions were already added in kernel code, we have several intrinsics or funtionalities depends on these extension, it's ready to add these hw probe flags already used in jdk into jdk code.


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

Issue

  • JDK-8324304: RISC-V: add hw probe flags (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17519/head:pull/17519
$ git checkout pull/17519

Update a local copy of the PR:
$ git checkout pull/17519
$ git pull https://git.openjdk.org/jdk.git pull/17519/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17519

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17519.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 22, 2024

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

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

openjdk bot commented Jan 22, 2024

@Hamlin-Li The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Jan 22, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 22, 2024

Webrevs

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Any test performed?
BTW: Seems that probe for option UseZvkn could also be added which consists of Zvkned, Zvknhb, Zvkb and Zvkt. I see these are also there in https://github.com/torvalds/linux/blob/master/arch/riscv/include/uapi/asm/hwprobe.h.

@openjdk
Copy link

openjdk bot commented Jan 23, 2024

@Hamlin-Li This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8324304: RISC-V: add hw probe flags

Reviewed-by: fyang, rehn

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 60 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 23, 2024
@RealFYang
Copy link
Member

RealFYang commented Jan 23, 2024

PS: I just realized that this will auto-enable experimental RV-specific JVM options like UseZtso, UseZacas, etc. if the features are available, something which I think we shouldn't do for now. These experimental options are not fully tested on real hardwares yet. Maybe remove UPDATE_DEFAULT(UseZtso), UPDATE_DEFAULT(UseZtso) from ext_Ztso, ext_Zacas declarations at the same time? Or postpone this change for some time until we have the hardware?

@Hamlin-Li
Copy link
Author

I just tested on Lichee Pi 4A, seems the default behaviour is to disable them.

echo "enable explicitly ......"
TEST_OPTIONS="-XX:+UseZicboz -XX:+UseZtso -XX:+UseZacas -XX:+UseZfh"
$J_H/bin/java -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions ${TEST_OPTIONS} -version | grep -e UseZicboz -e UseZtso -e UseZacas -e UseZfh

echo "by default ......"
TEST_OPTIONS=""
$J_H/bin/java -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions ${TEST_OPTIONS} -version | grep -e UseZicboz -e UseZtso -e UseZacas -e UseZfh

output is as below:

enable explicitly ......
     bool UseZacas                                 = true                            {ARCH experimental} {command line}
     bool UseZfh                                   = true                                 {ARCH product} {command line}
     bool UseZicboz                                = true                            {ARCH experimental} {command line}
     bool UseZtso                                  = true                            {ARCH experimental} {command line}
by default ......
     bool UseZacas                                 = false                           {ARCH experimental} {default}
     bool UseZfh                                   = false                                {ARCH product} {default}
     bool UseZicboz                                = false                           {ARCH experimental} {default}
     bool UseZtso                                  = false                           {ARCH experimental} {default}

@Hamlin-Li
Copy link
Author

LGTM. Any test performed? BTW: Seems that probe for option UseZvkn could also be added which consists of Zvkned, Zvknhb, Zvkb and Zvkt. I see these are also there in https://github.com/torvalds/linux/blob/master/arch/riscv/include/uapi/asm/hwprobe.h.

Yes, I tested test/hotspot/jtreg/compiler/ via qemu, no failures related to this options are found.
The reason other flags are not added is that we don't have them in jdk yet.

@RealFYang
Copy link
Member

RealFYang commented Jan 24, 2024

I just tested on Lichee Pi 4A, seems the default behaviour is to disable them.

echo "enable explicitly ......"
TEST_OPTIONS="-XX:+UseZicboz -XX:+UseZtso -XX:+UseZacas -XX:+UseZfh"
$J_H/bin/java -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions ${TEST_OPTIONS} -version | grep -e UseZicboz -e UseZtso -e UseZacas -e UseZfh

echo "by default ......"
TEST_OPTIONS=""
$J_H/bin/java -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions ${TEST_OPTIONS} -version | grep -e UseZicboz -e UseZtso -e UseZacas -e UseZfh

output is as below:

enable explicitly ......
     bool UseZacas                                 = true                            {ARCH experimental} {command line}
     bool UseZfh                                   = true                                 {ARCH product} {command line}
     bool UseZicboz                                = true                            {ARCH experimental} {command line}
     bool UseZtso                                  = true                            {ARCH experimental} {command line}
by default ......
     bool UseZacas                                 = false                           {ARCH experimental} {default}
     bool UseZfh                                   = false                                {ARCH product} {default}
     bool UseZicboz                                = false                           {ARCH experimental} {default}
     bool UseZtso                                  = false                           {ARCH experimental} {default}

Say, when you are running some latest kernel with the hwprobe capability on some new RISC-V hardwares with those extensions.
Then these JVM options will be auto-enabled, right? But I think we need some time to manually enable and fully test them (especially, -XX:+UseZtso and -XX:+UseZacas) before that happens. AFAIK, Lichee Pi 4A is not equipped with those extensions and is running some older kernel.

@Hamlin-Li
Copy link
Author

It makes sense, removed UPDATE_DEFAULT for these extensions.

@RealFYang
Copy link
Member

It makes sense, removed UPDATE_DEFAULT for these extensions.

Thanks for the update. Would you mind one more tweak? I think we should also remove the auto-enablement of UseZic64b, UseZicbom, UseZicbop and UseZihintpause which are also experimental options for now.

@Hamlin-Li
Copy link
Author

I'm not sure, as these vm options (UseZic64b, UseZicbom, UseZicbop and UseZihintpause) are not enabled in RiscvHwprobe::add_features_from_query_result(), so I think they are not enabled automatically even if the hw supports these features, unless a vendor want to enable them.

So, I think it's good to keep auto-enablement of Zicboz/Ztso/Zacas in vm_version_riscv.hpp, and remove the enable code of these options in RiscvHwprobe::add_features_from_query_result() in this patch?

@RealFYang
Copy link
Member

I'm not sure, as these vm options (UseZic64b, UseZicbom, UseZicbop and UseZihintpause) are not enabled in RiscvHwprobe::add_features_from_query_result(), so I think they are not enabled automatically even if the hw supports these features, unless a vendor want to enable them.

Sorry, I missed that before. I think you are right.

So, I think it's good to keep auto-enablement of Zicboz/Ztso/Zacas in vm_version_riscv.hpp, and remove the enable code of these options in RiscvHwprobe::add_features_from_query_result() in this patch?

Yeah, that will be more consistent.

@Hamlin-Li
Copy link
Author

Updated, please take a look again.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Copy link
Contributor

@robehn robehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems alright, thanks!

@Hamlin-Li
Copy link
Author

Thanks @RealFYang @robehn for your reviewing.

/integrate

@openjdk
Copy link

openjdk bot commented Jan 29, 2024

Going to push as commit b39b876.
Since your change was applied there have been 67 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 29, 2024
@openjdk openjdk bot closed this Jan 29, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 29, 2024
@openjdk
Copy link

openjdk bot commented Jan 29, 2024

@Hamlin-Li Pushed as commit b39b876.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Hamlin-Li Hamlin-Li deleted the hw-probe-code branch January 29, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants