RFR: 8249675: x86: frequency extraction from cpu brand string is incomplete

Erik Gahlin egahlin at openjdk.java.net
Mon Oct 19 12:51:16 UTC 2020


On Mon, 19 Oct 2020 12:12:51 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

> 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

Marked as reviewed by egahlin (Reviewer).

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

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


More information about the hotspot-dev mailing list