-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8261966: macOS M1: report in hs_err log if we are running x86 code in emulation mode (Rosetta) #3077
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
Conversation
|
👋 Welcome back gziemski! A progress list of the required criteria for merging this PR into |
|
@gerard-ziemski The following label will be automatically applied to this pull request:
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. |
Webrevs
|
dcubed-ojdk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the bug report, @dholmes-ora mentions two different places where
"(EMULATED)" should show up. This change covers the first:
Host: MacBookPro17,1 x86_64 2400 MHz, 8 cores, 16G, Darwin 20.3.0
becomes
Host: MacBookPro17,1 x86_64 (EMULATED) 2400 MHz, 8 cores, 16G, Darwin 20.3.0
but I don't think that it covers the second:
CPU: total 8 (initial active 8) (1 cores per cpu, 1 threads per core) family 6 model 44 stepping 0 microcode 0x0, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, aes, clmul, tsc, tscinvbit, tscinv, clflush
becomes:
CPU: (EMULATED) total 8 (initial active 8) (1 cores per cpu, 1 threads per core) family 6 model 44 stepping 0 microcode 0x0, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, aes, clmul, tsc, tscinvbit, tscinv, clflush
Am I missing something here?
|
Thank you for the review Dan!
I wasn't sure the 2nd case was needed. The 1st case shows the architecture, so it's clearly needed there. In the 2nd case we just show CPU features, with no explicit mention of the architecture, so I didn't think it was 100% relevant there. Is the opinion here that we need to mark it as |
|
I would be okay if the second case was not tagged with "(EMULATED)", but |
|
Mailing list message from David Holmes on hotspot-runtime-dev: On 20/03/2021 12:56 am, Gerard Ziemski wrote:
It is perhaps an oversight that the actual architecture moniker is not
Yes please. Thanks, |
src/hotspot/os/bsd/os_bsd.cpp
Outdated
| char emulated[16] = "\0"; | ||
| #ifdef __APPLE__ | ||
| if (VM_Version::is_cpu_emulated()) { | ||
| strcpy(emulated, " (EMULATED)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think code checkers will complain about using strcpy() here.
I believe that strncpy() is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhaps:
const char* emulated = "";
#ifdef APPLE
if (VM_Version::is_cpu_emulated()) {
emulated = " (EMULATED)";
}
#endif
...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will work very nicely, thank you Mikael!
|
Do I need CSR for this fix? |
dcubed-ojdk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thumbs up!
I don't think you need a CSR for this change.
|
@gerard-ziemski 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 85 new commits pushed to the
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 |
|
Thank you Dan and Mikael for the feedback and reviews! |
dholmes-ora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too!
Thanks,
David
|
Thank you David. |
|
/integrate |
|
@gerard-ziemski Since your change was applied there have been 100 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 4d8e986. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this simple enhancement where we indicate in hs_err log file whether the CPU is being emulated. Right now the only use case is for Apple's M1 aarch64 running x64 code, i.e. "Rosetta" emulation.
This enhancement will insert
(EMULATED)label in the Host and CPU section, ex:Host: Oracles-MacBook-Pro-16.local, MacBookPro16,1 x86_64 2600 MHz, 12 cores, 32G, Darwin 19.6.0, macOS 10.15.7 (19H114)becomes
Host: Oracles-MacBook-Pro-16.local, "MacBookPro16,1" x86_64 (EMULATED) 2600 MHz, 12 cores, 32G, Darwin 19.6.0, macOS 10.15.7 (19H114)and
CPU: total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 10 microcode 0xde, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, fma, vzeroupper, clflush, clflushoptbecomes
CPU: (EMULATED) total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 10 microcode 0xde, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, fma, vzeroupper, clflush, clflushoptI also took the opportunity here to fix the model name by adding " around it as Apple uses commas in the name, which makes it harder to parse the Host section, since we also use commas to delineate, ex:
MacBookPro16,1becomes"MacBookPro16,1"Progress
Issue
Reviewers
Download
To checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3077/head:pull/3077$ git checkout pull/3077To update a local copy of the PR:
$ git checkout pull/3077$ git pull https://git.openjdk.java.net/jdk pull/3077/head