Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755773AbbGFPqZ (ORCPT ); Mon, 6 Jul 2015 11:46:25 -0400 Received: from terminus.zytor.com ([198.137.202.10]:49555 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755722AbbGFPqS (ORCPT ); Mon, 6 Jul 2015 11:46:18 -0400 Date: Mon, 6 Jul 2015 08:45:08 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: brgerst@gmail.com, peterz@infradead.org, lenb@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de, dvlasenk@redhat.com, john.stultz@linaro.org, ralf@linux-mips.org, kvm@vger.kernel.org, bp@alien8.de, mingo@kernel.org, luto@kernel.org, mtosatti@redhat.com, luto@amacapital.net, ray.huang@amd.com, linux-kernel@vger.kernel.org, bp@suse.de, torvalds@linux-foundation.org, hpa@zytor.com Reply-To: mtosatti@redhat.com, luto@kernel.org, luto@amacapital.net, ray.huang@amd.com, linux-kernel@vger.kernel.org, bp@suse.de, torvalds@linux-foundation.org, hpa@zytor.com, brgerst@gmail.com, lenb@kernel.org, pbonzini@redhat.com, peterz@infradead.org, rkrcmar@redhat.com, tglx@linutronix.de, dvlasenk@redhat.com, john.stultz@linaro.org, ralf@linux-mips.org, kvm@vger.kernel.org, mingo@kernel.org, bp@alien8.de In-Reply-To: <678981cc4761fb38a793c217c9cac42503cf3719.1434501121.git.luto@kernel.org> References: <678981cc4761fb38a793c217c9cac42503cf3719.1434501121.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/asm/tsc, x86/kvm: Drop open-coded barrier and use rdtsc_ordered() in kvmclock Git-Commit-ID: 502dfeff239e8313bfbe906ca0a1a6827ac8481b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3051 Lines: 73 Commit-ID: 502dfeff239e8313bfbe906ca0a1a6827ac8481b Gitweb: http://git.kernel.org/tip/502dfeff239e8313bfbe906ca0a1a6827ac8481b Author: Andy Lutomirski AuthorDate: Thu, 25 Jun 2015 18:44:11 +0200 Committer: Ingo Molnar CommitDate: Mon, 6 Jul 2015 15:23:30 +0200 x86/asm/tsc, x86/kvm: Drop open-coded barrier and use rdtsc_ordered() in kvmclock __pvclock_read_cycles() used to have two barriers, one of which was unnecessary, which got removed after an initial version of this patch was sent. But the barrier is still open-coded unnecessarily - get rid of that barrier and clean up the code by just using rdtsc_ordered(). Signed-off-by: Andy Lutomirski Signed-off-by: Borislav Petkov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang Rui Cc: John Stultz Cc: Len Brown Cc: Linus Torvalds Cc: Marcelo Tosatti Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Radim Krcmar Cc: Ralf Baechle Cc: Thomas Gleixner Cc: kvm ML Link: http://lkml.kernel.org/r/678981cc4761fb38a793c217c9cac42503cf3719.1434501121.git.luto@kernel.org [ Ported it to v4.2-rc1. ] Signed-off-by: Ingo Molnar --- arch/x86/include/asm/pvclock.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h index 5c490db..7a6bed5 100644 --- a/arch/x86/include/asm/pvclock.h +++ b/arch/x86/include/asm/pvclock.h @@ -62,7 +62,7 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) static __always_inline u64 pvclock_get_nsec_offset(const struct pvclock_vcpu_time_info *src) { - u64 delta = rdtsc() - src->tsc_timestamp; + u64 delta = rdtsc_ordered() - src->tsc_timestamp; return pvclock_scale_delta(delta, src->tsc_to_system_mul, src->tsc_shift); } @@ -76,13 +76,7 @@ unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src, u8 ret_flags; version = src->version; - /* Note: emulated platforms which do not advertise SSE2 support - * result in kvmclock not using the necessary RDTSC barriers. - * Without barriers, it is possible that RDTSC instruction reads from - * the time stamp counter outside rdtsc_barrier protected section - * below, resulting in violation of monotonicity. - */ - rdtsc_barrier(); + offset = pvclock_get_nsec_offset(src); ret = src->system_time + offset; ret_flags = src->flags; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/