RFR: 8369467: Rdtsc: Avoid initialize_elapsed_counter when UseFastUnorderedTimeStamps will be disabled

Markus Grönlund mgronlun at openjdk.org
Thu Oct 9 09:28:08 UTC 2025


On Thu, 9 Oct 2025 06:31:05 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> The feature to use rdtsc when it is not invariant requires us to set `UseFastUnorderedTimeStamps`. However, the current implementation always does `do_time_measurements` first, which adds an accumulative 3 ms of sleeps during bootstrapping. While most modern hardware supports invariant tsc, we have observed that many virtualized environments disable this even if it is running on supported hardware. Which means that doing this adds to our startup time even if the feature is never used on many common deployments.
> 
> I suggest we do some checking before deciding to call `initialize_elapsed_counter` and avoid it if we know we will not use rdtsc regardless of the outcome.

Hi Axel,

The else branch for VM_Version::supports_tscinv_ext(), i.e., the do_time_measurements() loop, is unreliable and should be removed. 

Rdtsc should only be used when INV_TSC is reported by the HW.

Can you remove that piece, please?

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

PR Comment: https://git.openjdk.org/jdk/pull/27713#issuecomment-3384966128


More information about the hotspot-dev mailing list