RFR: 8268228: TSC is not used for CPUTimeStampCounter on AMD processor [v2]
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Fri Jun 4 05:24:15 UTC 2021
> I ran JVM on Ryzen 3300X, and I got following `jdk.CPUTimeStampCounter` event.
>
>
> jdk.CPUTimeStampCounter {
> startTime = 10:41:14.993
> fastTimeEnabled = false
> fastTimeAutoEnabled = true
> osFrequency = 1000000000
> fastTimeFrequency = 1000000000
> }
>
>
> I confirmed 3300X supports Invariant TSC (so `fastTimeAutoEnabled` is set to `true`), however it does not seem to be used (`fastTimeEnabled` is `false`).
>
> Frequency is come from brand string from CPUID (e.g. "Intel(R) Core(TM) i3-8145U CPU @ 2.10GHz"). However AMD processor (Ryzen at least) does not have it ("AMD Ryzen 3 3300X 4-Core Processor").
> Fortunately rdtsc_x86.cpp can calculate the frequency like bogomips. We should fallback to it if we cannot get the frequency even if invariant TSC is supported.
>
> After this change, I got following `jdk.CPUTimeStampCounter` event. Base clock of Ryzen 3 3300X is 3.8GHz, so `fastTimeFrequency` looks good.
>
>
> jdk.CPUTimeStampCounter {
> startTime = 10:33:52.884
> fastTimeEnabled = true
> fastTimeAutoEnabled = true
> osFrequency = 10000000 Hz
> fastTimeFrequency = 3792929124 Hz
> }
>
>
> This problem is not only for JFR. I confirmed `Rdtsc` class is used in ticks.cpp , and it relates to GC code at least.
Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
Fix comments
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/4350/files
- new: https://git.openjdk.java.net/jdk/pull/4350/files/1bb8226e..768ac458
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4350&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4350&range=00-01
Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/4350.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4350/head:pull/4350
PR: https://git.openjdk.java.net/jdk/pull/4350
More information about the hotspot-dev
mailing list