Project

General

Profile

Actions

Bug #14554

closed

TSC calibration is the PITs

Added by Joshua M. Clulow 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

We have received some reports after the integration of #13961 that suggest the HPET calibration routine is producing values that are higher than the classical PIT-based calibration. These reports are from a fairly diverse range of systems, and appear to be causing NTP to malfunction as the detected drift exceeds the hard clamp of 500 PPM and the discipline cannot keep up.

You can see your current calibration values with MDB:

vulcan # mdb -ke 'tsc_calibration_source/p; tsc_freq/E; pit_tsc_hz/E'
tsc_calibration_source:
tsc_calibration_source:         tsc_calibration_hpet
tsc_freq:
tsc_freq:       2803077848
pit_tsc_hz:
pit_tsc_hz:     2799922209

In the above example, if we assume the round number 2800000000 is the target for this CPU (psrinfo -vp reports clock 2800 MHz) we can see that the HPET figure has a greater error than the PIT:

HPET: 2803077848 - 2800000000 = 3077848
PIT:  2799922209 - 2800000000 = -77791

Regrettably we did not take three clocks to sea, but the combination of the documented clock rate and the NTP issues suggests we should revert to preferring the PIT in the calibration priority until we can figure out what's going on with the HPET routine.


Related issues

Related to illumos gate - Bug #13961: Add HPET as a TSC calibration sourceClosedJason King

Actions
Related to illumos gate - Bug #14556: TSC calibration from HPET includes too much errorNewJoshua M. Clulow

Actions
Actions #1

Updated by Joshua M. Clulow 5 months ago

  • Related to Bug #13961: Add HPET as a TSC calibration source added
Actions #3

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 2062
Actions #4

Updated by Joshua M. Clulow 5 months ago

  • Related to Bug #14556: TSC calibration from HPET includes too much error added
Actions #5

Updated by Joshua M. Clulow 5 months ago

Testing Notes

I built and installed this change in a VM, which I ensured had the HPET enabled.

Old Bits

# mdb -ke 'tsc_calibration_source/p; tsc_freq/E; pit_tsc_hz/E'
tsc_calibration_source:
tsc_calibration_source:         tsc_calibration_hpet
tsc_freq:
tsc_freq:       3601014040
pit_tsc_hz:
pit_tsc_hz:     3599669507

# mdb -ke '::linkerset tsc_calibration_set | ::print tsc_calibrate_t'
{
    tscc_source = 0xfffffffffb960f48 "HPET" 
    tscc_preference = 0x32
    tscc_calibrate = tsc_calibrate_hpet
}
{
    tscc_source = 0xfffffffffb9610f3 "PIT" 
    tscc_preference = 0xa
    tscc_calibrate = tsc_calibrate_pit
}
{
    tscc_source = 0xfffffffffb960b5a "VMware" 
    tscc_preference = 0x64
    tscc_calibrate = tsc_calibrate_vmware
}

New Bits

# mdb -ke 'tsc_calibration_source/p; tsc_freq/E; pit_tsc_hz/E'
tsc_calibration_source:
tsc_calibration_source:         tsc_calibration_pit
tsc_freq:
tsc_freq:       3599670131
pit_tsc_hz:
pit_tsc_hz:     3599670131

# mdb -ke '::linkerset tsc_calibration_set | ::print tsc_calibrate_t'
{
    tscc_source = 0xfffffffffb960f48 "HPET" 
    tscc_preference = 0x1
    tscc_calibrate = tsc_calibrate_hpet
}
{
    tscc_source = 0xfffffffffb9610f3 "PIT" 
    tscc_preference = 0xa
    tscc_calibrate = tsc_calibrate_pit
}
{
    tscc_source = 0xfffffffffb960b5a "VMware" 
    tscc_preference = 0x64
    tscc_calibrate = tsc_calibrate_vmware
}
Actions #6

Updated by Electric Monk 5 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 236cb9a89d936b4b681853751c9af1adccc35ef9

commit  236cb9a89d936b4b681853751c9af1adccc35ef9
Author: Joshua M. Clulow <josh@sysmgr.org>
Date:   2022-03-10T05:35:21.000Z

    14554 TSC calibration is the PITs
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF