RFR: 8264412: AArch64: CPU description should refer DMI [v2]
Gerard Ziemski
gziemski at openjdk.java.net
Mon Apr 5 18:17:08 UTC 2021
On Wed, 31 Mar 2021 13:23:44 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>> `jdk.CPUInformation` event on AArch64 has valid CPU description in [JDK-8262491](https://bugs.openjdk.java.net/browse/JDK-8262491), however it does not work on UEFI booted machine.
>>
>> [JDK-8262491](https://bugs.openjdk.java.net/browse/JDK-8262491) refers device tree to get board name, however it does not exist on UEFI. We need to refer DMI.
>> However we need to have root privilege, so we refer /sys/devices/virtual/dmi/id to avoid it.
>>
>> We can get board name from /sys/devices/virtual/dmi/id/board_name, but some machine set empty string to it. So we will refer /sys/devices/virtual/dmi/id/product_name as a fallback.
>>
>> For example, we can get following CPU description on AWS A1 instance after this change:
>>
>> jdk.CPUInformation {
>> startTime = 05:28:24.506
>> cpu = "AArch64"
>> description = "AArch64 a1.2xlarge 0x41:0x0:0xd08:3, simd, crc, aes, sha1, sha256"
>> sockets = 8
>> cores = 8
>> hwThreads = 8
>> }
>
> Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
>
> refactoring
2 small nitpicks, but otherwise the functionality of the code looks good to me, though I will have to trust you on using the files to get the CPU description, since I'm no Linux expert:
"/proc/device-tree/compatible",
"/sys/devices/virtual/dmi/id/board_name",
"/sys/devices/virtual/dmi/id/product_name"
src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp line 174:
> 172: assert(buf != NULL, "invalid argument");
> 173: assert(buflen >= 1, "invalid argument");
> 174: int fd = open(fname, O_RDONLY);
Should be:
` int fd = os::open(fname, O_RDONLY);`
src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp line 176:
> 174: int fd = open(fname, O_RDONLY);
> 175: if (fd != -1) {
> 176: ssize_t read_sz = read(fd, buf, buflen);
Should be:
`ssize_t read_sz = os::read(fd, buf, buflen);`
-------------
Changes requested by gziemski (Committer).
PR: https://git.openjdk.java.net/jdk/pull/3259
More information about the hotspot-runtime-dev
mailing list