lkml.org 
[lkml]   [2014]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86, TSC: Add a software TSC offset
On Mon, Jul 21, 2014 at 12:34:40PM -0700, Andy Lutomirski wrote:
> I'm sure I'm missing something, but where is tsc_offset used outside
> the tsc startup code? Is it somehow getting programmed into the TSC
> config registers?

Nah, we're programming the CPU number into the TSC_AUX MSR. However,
that approach might become obsolete for a simpler, preempt-disable
version which Peter suggested today. It should be comparatively cheap
and work on all CPUs, not only RDTSCP-supporting ones:

get_cycles() {
preempt_disable();
rdtscll() + this_cpu_read(tsc_offset);
preempt_disable()
}

So, to answer your question, the TSC offset will be used in get_cycles(). So
even on machines with a skewed TSC, we will have a stable TSC counter by
adding the per-cpu offset each time we read the TSC.

We'll see how it plays out in testing. :)

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--


\
 
 \ /
  Last update: 2014-07-22 00:21    [W:0.095 / U:3.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site