RFR: 8261966: macOS M1: report in hs_err log if we are running x86 code in emulation mode (Rosetta) [v4]

Daniel D.Daugherty dcubed at openjdk.java.net
Mon Mar 22 19:52:40 UTC 2021


On Mon, 22 Mar 2021 17:33:55 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> 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, clflushopt
>> `
>> 
>> becomes
>> 
>> `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, clflushopt
>> `
>> 
>> I 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,1` becomes `"MacBookPro16,1"`
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove white space

Changes requested by dcubed (Reviewer).

src/hotspot/os/bsd/os_bsd.cpp line 1407:

> 1405: #ifdef __APPLE__
> 1406:   if (VM_Version::is_cpu_emulated()) {
> 1407:     strcpy(emulated, " (EMULATED)");

I think code checkers will complain about using `strcpy()` here.
I believe that `strncpy()` is preferred.

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

PR: https://git.openjdk.java.net/jdk/pull/3077


More information about the hotspot-runtime-dev mailing list