Re: [PATCH] tsc_khz= boot option to avoid TSC calibration variance

From: Serge Belyshev
Date: Tue May 12 2009 - 09:49:36 EST


john stultz <johnstul@xxxxxxxxxx> writes:

> Once the tsc_khz value is set in grub, the box will always boot with the
^^^^^^
> same value, so the NTP drift value prior to reboot will still be correct
> after rebooting.
No, it won't, because...

> tsc_khz = calibrate_tsc();
> +
> + /*
> + * If the calibrated TSC freq and user specified
> + * TSC freq are close enough, pick the what the
> + * user told us.
> + */
> + difference = abs(tsc_khz - tsc_khz_specified);
> + if (difference <= tsc_khz >> 10) { /* 1/1024 = 976 ppm */
> + printk(KERN_INFO "Using user defined TSC freq: %lu.%03lu MHz\n",
> + tsc_khz_specified/1000,
> + tsc_khz_specified%1000);
> + tsc_khz = tsc_khz_specified;
> + }
> +

... of this "if".

Please *please* don't set arbitrary limits. Just use user supplied value.

Or at the very least print big red warning if you are going to ignore a user
supplied option (and have another tsc_khz_really= option to override faulty
calibration routine).
--
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/