> From: Christian Weisgerber <[email protected]>
> Date: Sat, 20 Jun 2020 01:20:33 -0000 (UTC)
>
> On 2020-06-19, Mark Kettenis <[email protected]> wrote:
>
> > I'm talking about *skew*, not drift. If there is a significant drift
> > you already knock out the TSC.
> >
> > What's needed is:
> >
> > 1. A bit of research of what an acceptable skew is. My hypothesis is
> > that on many machines with a single socket the TSCs are actually in
> > synch. But the way we measure the skew isn't 100% accurate so we
> > still get a small skew. If we sample these values on a couple of
> > machines across a couple of reboots we can probably tell what the
> > uncertainty in the measurement of the skew is and define a cutoff
> > based on that.
>
> So we need amd64 snapshots to enable TSC_DEBUG, maybe a bit prettier
> like below, and then reports:
>
> cpu0: Intel(R) Xeon(R) CPU E3-1225 v3 @ 3.20GHz, 3392.69 MHz, 06-3c-03
>
> cpu0: TSC skew=0 observed drift=0
> cpu1: TSC skew=-24 observed drift=0
> cpu2: TSC skew=-27 observed drift=0
> cpu3: TSC skew=-25 observed drift=0
>
> cpu0: TSC skew=0 observed drift=0
> cpu1: TSC skew=-1 observed drift=0
> cpu2: TSC skew=0 observed drift=0
> cpu3: TSC skew=25 observed drift=0
>
> cpu0: TSC skew=0 observed drift=0
> cpu1: TSC skew=-30 observed drift=0
> cpu2: TSC skew=-39 observed drift=0
> cpu3: TSC skew=-41 observed drift=0
>
> cpu0: TSC skew=0 observed drift=0
> cpu1: TSC skew=-31 observed drift=0
> cpu2: TSC skew=-37 observed drift=0
> cpu3: TSC skew=-39 observed drift=0
>
> cpu0: TSC skew=0 observed drift=0
> cpu1: TSC skew=-31 observed drift=0
> cpu2: TSC skew=-34 observed drift=0
> cpu3: TSC skew=-23 observed drift=0
Yes, enabling that for a bit would help us get an idea. We probably
should have it print the TSC frequency as well though.
> Index: sys/arch/amd64/amd64/tsc.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/tsc.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 tsc.c
> --- sys/arch/amd64/amd64/tsc.c 6 Apr 2020 00:01:08 -0000 1.16
> +++ sys/arch/amd64/amd64/tsc.c 19 Jun 2020 23:49:06 -0000
> @@ -217,7 +217,7 @@ void
> tsc_timecounter_init(struct cpu_info *ci, uint64_t cpufreq)
> {
> #ifdef TSC_DEBUG
> - printf("%s: TSC skew=%lld observed drift=%lld\n", __func__,
> + printf("%s: TSC skew=%lld observed drift=%lld\n", ci->ci_dev->dv_xname,
> (long long)ci->ci_tsc_skew, (long long)tsc_drift_observed);
> #endif
>
> --
> Christian "naddy" Weisgerber [email protected]
>
>