RFR: 8249675: x86: frequency extraction from cpu brand string is incomplete
Markus Grönlund
mgronlun at openjdk.java.net
Mon Oct 19 12:20:17 UTC 2020
Greetings,
`VM_Version_Ext::max_qualified_cpu_freq_from_brand_string()` attempts to extract the CPU frequency, by inspecting the
CPU brand string (as per the document "Intel® Processor Identification and the CPUID Instruction. Application note 845
May 2012").
There is a bug with the current implementation, because it is naive in using the following construct:
const char* Hz_location = strchr(brand_string, 'H');
This likely works for most CPU models / brands, but not when the brand string is for example of the following form:
"Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz"
The 'H' in "9850H" will be matched, but since there is no 'z' in the next position, the code will fall through and
report a frequency of 0.
Testing:
- [x] jdk_jfr
- [x] debug verification for brand string "Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz"
Comment: The doc link is stale and therefore removed. No stable links for the Application note 845 versions could be
located, hence the doc is here referenced by name instead.
Thanks
Markus
-------------
Commit messages:
- 8249675: x86: frequency extraction from cpu brand string is incomplete
Changes: https://git.openjdk.java.net/jdk/pull/736/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=736&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8249675
Stats: 50 lines in 2 files changed: 6 ins; 12 del; 32 mod
Patch: https://git.openjdk.java.net/jdk/pull/736.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/736/head:pull/736
PR: https://git.openjdk.java.net/jdk/pull/736
More information about the hotspot-dev
mailing list