Re: [PATCH] x86, TSC: Add a software TSC offset

From: Andy Lutomirski
Date: Mon Jul 21 2014 - 18:14:37 EST


On Mon, Jul 21, 2014 at 3:11 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> On Tue, 22 Jul 2014, Thomas Gleixner wrote:
>> On Mon, 21 Jul 2014, Andy Lutomirski wrote:
>> > On Mon, Jul 21, 2014 at 2:52 PM, Borislav Petkov <bp@xxxxxxxxx> wrote:
>> > > On Mon, Jul 21, 2014 at 02:41:50PM -0700, Andy Lutomirski wrote:
>> > >> How will this be compatible with the vdso?
>> > >
>> > > I've never thought about it yet. How compatible would you want it to be
>> > > and what do you expect from it?
>> >
>> > I expect that users of __vdso_clock_gettime (e.g. glibc) will get the
>> > correct time :) They use vread_tsc, and they can't use
>> > preempt_disable, because they're in userspace. They also can't
>> > directly access per-cpu variables.
>> >
>> > Turning off vdso tsc support on these machines would be an option.
>>
>> Correct.
>>
>> So if we make the TSC usable that way we need to mark it unusable for
>> the VDSO and force vdso_*gettime* into the kernel. That will be way
>> better than forcing the whole machine onto HPET.
>>
>> And once we are using the real syscall, the whole thing just works ...
>
> So all it needs is to do
>
> clocksource_tsc.archdata.vclock_mode = VCLOCK_NONE;
>
> if we do the magic per cpu offset trick to make the fcked up TSC
> usable.

Just make sure this happens every time the tsc clocksource is selected
-- it's possible to go back and forth.

>
> Thanks,
>
> tglx
>



--
Andy Lutomirski
AMA Capital Management, LLC
--
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/