Re: [PATCH] x86: Export tsc related information in sysfs

From: john stultz
Date: Wed May 26 2010 - 12:25:24 EST


On Wed, 2010-05-26 at 12:02 -0400, Brian Bloniarz wrote:
> On 05/26/2010 11:04 AM, john stultz wrote:
> > Right but having applications add "Linux on x86 where the TSC is being
> > used" logic is pretty poor solution. Its an issue that should be
> > addressed from the kernel side.
>
> Yeah, sure.
>
> > And really, if apps really wanted this info, they can fish it out
> > of /proc/cpuinfo.
> Really? I was under the impression that tsc_khz can differ
> from cpu_mhz (invariant tsc?), and cpu_mhz can differ from what
> shows up in /proc/cpuinfo cpuMHz due to cpufreq scaling. I was
> also under the impression that knowing or controlling tsc_khz
> is what NTP needs to ensure stability (assuming the TSC is
> otherwise stable, i.e. no halts-in-idle, NMI etc etc weirdness).

Bah. You're right. I shouldn't be emailing this early :)

Even so, I'm still not a fan of the "expose raw details so userland apps
can hack around the kernel's inadequacies" approach.

> Dan Magenheimer wrote:
> > /sys/devices/system/clocksource/clocksource0/current_khz
> >
> > is that an acceptable arch-independent patch? (And which do
> > you prefer?)
>
> Thomas Gleixner:
> > I'd rather see a generic solution which provides the information of
> > the current (and possibly those of the available) clock source(s).

While I'm not a huge fan of it, Thomas' way would be a bit more
palatable.

NTP can check the initial freq the clocksource was registered and if its
different from the last boot decide if it can recalculate that into a
new correction factor, or just throw out the drift file value.

Brian: is this something the NTPd folks actually want? Has anyone
checked with them before we hand down the solution from high upon on
lkml mountain?

Personally I think NTPd should be a little more savvy about how far it
trusts the drift file when it starts up. Since I believe its
fast-startup mode can quickly estimate the drift well within 100ppm,
which is about the maximum variance I've seen from the calibration code.

thanks
-john

--
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/