Re: [PATCH] x86, tsc add an initial read offset to __cycles_2_ns()calculations

From: Borislav Petkov
Date: Fri Jul 26 2013 - 06:26:33 EST


On Wed, Jul 24, 2013 at 12:03:20PM -0400, Prarit Bhargava wrote:
> +/*
> + * TSC can have non-zero values at boot time on Intel Xeon E5 (family 6,
> + * model 45) aka "SandyBridge" processors. This is documented in the
> + * Errata for the processors as BT81. As a result, we need to snapshot
> + * the TSC's initial value to avoid calculation overflows in the conversions
> + * of cycles to nanoseconds.
> + */
> +unsigned long long tsc_initial_value;
> +
> /*
> * Scheduler clock - returns current time in nanosec units.
> */
> @@ -979,6 +989,9 @@ void __init tsc_init(void)
> return;
> }
>
> + tsc_initial_value = get_cycles();
> + pr_info("TSC: tsc initial value = %lld\n", tsc_initial_value);
> +

And we probably don't need that info on processors unaffected by the
erratum...

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/