Re: [RFC PATCH 4/4] x86/TSC: Use RDTSCP
From: Alexey Dobriyan
Date: Tue Dec 11 2018 - 18:38:00 EST
> And I had a bit of a WTF moment, as in "WTF does
> RDTSC have to do with a speculation protection barrier".
> Does it actually make sense?
It doesn't. There was too much s/lfence/barrier_nospec/ apparently.
> + asm volatile(ALTERNATIVE_3("rdtsc",
> + "mfence; rdtsc", X86_FEATURE_MFENCE_RDTSC,
> + "lfence; rdtsc", X86_FEATURE_LFENCE_RDTSC,
> + "rdtscp", X86_FEATURE_RDTSCP)
> + : EAX_EDX_RET(val, low, high)
> + /* RDTSCP clobbers ECX with MSR_TSC_AUX. */
> + :: "ecx");
I have a question: does alternatives ordering matter? CPU can have
both features.
And other code in this file uses "c" for clobber.