From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751965AbbFMI6I (ORCPT ); Sat, 13 Jun 2015 04:58:08 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46667 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbbFMI6C (ORCPT ); Sat, 13 Jun 2015 04:58:02 -0400 Date: Sat, 13 Jun 2015 10:57:59 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: x86@kernel.org, Peter Zijlstra , John Stultz , linux-kernel@vger.kernel.org, Len Brown , Huang Rui , Denys Vlasenko Subject: Re: [PATCH v2 13/17] x86/tsc: Rename native_read_tsc() to rdtsc_unordered() Message-ID: <20150613085758.GB3796@pd.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ... > @@ -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. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --