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

David Holmes david.holmes at oracle.com
Fri Mar 19 22:48:26 UTC 2021


On 20/03/2021 12:56 am, Gerard Ziemski wrote:
> On Thu, 18 Mar 2021 19:03:26 GMT, Daniel D. Daugherty <dcubed 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 after we print host CPU type, ex:
>>>
>>> `Host: Oracles-MacBook-Pro-16.local, MacBookPro16,1 x86_64 2600 MHz (EMULATED), 12 cores, 32G, Darwin 19.6.0, macOS 10.15.7 (19H114)`
>>
>> 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!
> 
>> 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?
> 
> 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.

It is perhaps an oversight that the actual architecture moniker is not 
mentioned in that line, but " family 6 model 44 " refers to the CPU that 
is actually being emulated in this case so we need to know that this 
line is for the emulated x64 CPU not the physical ARM cpu.

> Is the opinion here that we need to mark it as `EMULATED` in both of these cases?

Yes please.

Thanks,
David

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


More information about the hotspot-runtime-dev mailing list