lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrW91Q=ivYRVFb0WKXgHQO7O+x_HHDy67e90TU6Bte_ecg@mail.gmail.com>
Date:	Mon, 21 Jul 2014 14:41:50 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	Borislav Petkov <bp@...en8.de>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>, x86-ml <x86@...nel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH] x86, TSC: Add a software TSC offset

On Mon, Jul 21, 2014 at 2:35 PM, Borislav Petkov <bp@...en8.de> wrote:
> 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. :)

How will this be compatible with the vdso?

Also, IIRC, rdtscp does not need rdtsc_barrier(), whereas rdtsc does.
Getting this wrong will be a significant slowdown.

--Andy

>
> --
> Regards/Gruss,
>     Boris.
>
> Sent from a fat crate under my desk. Formatting is fine.
> --



-- 
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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ