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]
Date:	Sat, 13 Jun 2015 11:25:49 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	Borislav Petkov <bp@...e.de>
Cc:	Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	John Stultz <john.stultz@...aro.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Len Brown <lenb@...nel.org>, Huang Rui <ray.huang@....com>,
	Denys Vlasenko <dvlasenk@...hat.com>
Subject: Re: [PATCH v2 13/17] x86/tsc: Rename native_read_tsc() to rdtsc_unordered()

On Sat, Jun 13, 2015 at 1:57 AM, Borislav Petkov <bp@...e.de> wrote:
> On Fri, Jun 12, 2015 at 04:44:53PM -0700, Andy Lutomirski wrote:
>> Now that there is no paravirt TSC, the "native" is inappropriate.
>> The fact that rdtsc is not ordered can catch people by surprise, so
>> call it rdtsc_unordered().
>>
>> Signed-off-by: Andy Lutomirski <luto@...nel.org>
>
> ...
>
>> @@ -109,7 +109,16 @@ notrace static inline int native_write_msr_safe(unsigned int msr,
>>  extern int rdmsr_safe_regs(u32 regs[8]);
>>  extern int wrmsr_safe_regs(u32 regs[8]);
>>
>> -static __always_inline unsigned long long native_read_tsc(void)
>> +/**
>> + * rdtsc_unordered() - returns the current TSC without ordering constraints
>> + *
>> + * rdtsc_unordered() returns the result of RDTSC as a 64-bit integer.  The
>> + * only ordering constraint it supplies is the ordering implied by
>> + * "asm volatile": it will put the RDTSC in the place you expect.  The
>> + * CPU can and will speculatively execute that RDTSC, though, so the
>> + * results can be non-monotonic if compared on different CPUs.
>> + */
>> +static __always_inline unsigned long long rdtsc_unordered(void)
>
> I like the rdtsc_ordered() thing because it wraps the barrier and people
> cannot just forget it. But let's call this not rdtsc_unordered() but
> simply
>
>         rdtsc()
>
> The "_unordered" suffix is unnecessary IMO since this function is a
> simple wrapper around the hw insn and we do that naming scheme with all
> such wrappers.

I could go either way here.  rdtsc() is weird because people seem to
forget about the barrier.  Maybe I'm being unnecessarily paranoid.

--Andy

>
> --
> Regards/Gruss,
>     Boris.
>
> ECO tip #101: Trim your mails when you reply.
> --



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