8382337: [CRaC] Add CPU features nicknames for microarch levels#309
8382337: [CRaC] Add CPU features nicknames for microarch levels#309antonvoznia wants to merge 8 commits intoopenjdk:cracfrom
Conversation
|
👋 Welcome back antonvoznia! A progress list of the required criteria for merging this PR into |
|
@antonvoznia 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: 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 no new commits pushed to the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@rvansa) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
rvansa
left a comment
There was a problem hiding this comment.
I see that you've followed the information on wiki, but from a practical point of you I am not sure if the FPU is present on modern CPUs. I will check AWS instance types and report my findings.
Also, I am somewhat concerned that v1 is not strictly superset of generic; we shall check out the FLUSH flag. Maybe these two could be equivalent?
Please add a test for the parsing; you can extend CheckCPUFeaturesTest or create a standalone one.
| #ifdef AMD64 | ||
| const char *microarch_prefix="x86-64-v"; | ||
| const size_t microarch_prefix_len = strlen(microarch_prefix); | ||
| if (strncmp(str, microarch_prefix, strlen(microarch_prefix)) == 0 && |
There was a problem hiding this comment.
replace the strlen(...) in here
| } | ||
|
|
||
| #if defined(LINUX) && defined(AMD64) | ||
| void VM_Version::set_microarch_features(const char microarch_level, VM_Version::VM_Features &features) { |
There was a problem hiding this comment.
Could this return VM_Features rather than just modify reference?
| uint32_t value; | ||
| struct { | ||
| uint32_t : 4, | ||
| uint32_t fpu : 1, |
There was a problem hiding this comment.
Could you add a link to the struct with some reference saying where the bit position comes from?
|
@rvansa , Thank you for reviewing!
I verified on my x86 vm
I followed this pages I also didn't include flags OSFXSR and SCE. To have them, we need priveledge access to registers CR4 and MRS
I'll add this |
|
I have verified that all Intel/AMD CPUs used for AWS instance types have the @jankratochvil Could you comment why is the FLUSH (clflush) "required by OpenJDK"? |
|
Actually the reason is documented in |
| union ExtCpuid1Edx { | ||
| uint32_t value; | ||
| struct { | ||
| uint32_t : 22, |
There was a problem hiding this comment.
fpu should not be added anywhere. It is only set, but nothing ever reads or queries it. The only code that queries it is already disabled.
// FPU is always present on i686+: _features.supports_feature(CPU_FPU) &&
|
There is an existing message in the code: The question is whether it should not say (which would make it a bit long and complicated suggestion for the user): or even just (which would make the performance sub-optimal due to some CPU features possibly missing): As otherwise I have some doubts anyone will ever find the |
| features.set_feature(CPU_MMX); | ||
| features.set_feature(CPU_SSE); | ||
| features.set_feature(CPU_SSE2); | ||
| break; |
There was a problem hiding this comment.
| break; | |
| // The following options are all in /proc/cpuinfo of one of the first 64-bit CPUs - Atom D2700 (and Opteron 1352): https://superuser.com/q/1572306/1015048 | |
| features.set_feature(CPU_FLUSH); | |
| features.set_feature(CPU_TSC); | |
| break; |
I do not know why they are not in the x86_64-v1 official set. I have already listed them for "generic" as they are required or useful for OpenJDK.
x86_64 defines microarchitecture levels v1-v4: https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
Let’s allow users to set -XX:CPUFeatures=x86-64-vX in addition to the current options (generic, native, ignore and bitmask).
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/crac.git pull/309/head:pull/309$ git checkout pull/309Update a local copy of the PR:
$ git checkout pull/309$ git pull https://git.openjdk.org/crac.git pull/309/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 309View PR using the GUI difftool:
$ git pr show -t 309Using diff file
Download this PR as a diff file:
https://git.openjdk.org/crac/pull/309.diff
Using Webrev
Link to Webrev Comment