From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757424AbcK2QuU (ORCPT ); Tue, 29 Nov 2016 11:50:20 -0500 Received: from terminus.zytor.com ([198.137.202.10]:37664 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753128AbcK2QuG (ORCPT ); Tue, 29 Nov 2016 11:50:06 -0500 Date: Tue, 29 Nov 2016 08:49:19 -0800 From: tip-bot for Thomas Gleixner Message-ID: Cc: bp@alien8.de, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, yinghai@kernel.org, peterz@infradead.org, tglx@linutronix.de Reply-To: hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org, tglx@linutronix.de, yinghai@kernel.org In-Reply-To: <20161119134017.970859287@linutronix.de> References: <20161119134017.970859287@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/timers] x86/tsc: Prepare warp test for TSC adjustment Git-Commit-ID: 1e849cff359ccd8b6f3096205e3759e70f8d30ea 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 Commit-ID: 1e849cff359ccd8b6f3096205e3759e70f8d30ea Gitweb: http://git.kernel.org/tip/1e849cff359ccd8b6f3096205e3759e70f8d30ea Author: Thomas Gleixner AuthorDate: Sat, 19 Nov 2016 13:47:41 +0000 Committer: Thomas Gleixner CommitDate: Tue, 29 Nov 2016 17:29:48 +0100 x86/tsc: Prepare warp test for TSC adjustment To allow TSC compensation cross nodes its necessary to know in which direction the TSC warp was observed. Return the maximum observed value on the calling CPU so the caller can determine the direction later. Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Cc: Peter Zijlstra Cc: Yinghai Lu Cc: Borislav Petkov Link: http://lkml.kernel.org/r/20161119134017.970859287@linutronix.de Signed-off-by: Thomas Gleixner --- arch/x86/kernel/tsc_sync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c index 8642223..8a4ef7e 100644 --- a/arch/x86/kernel/tsc_sync.c +++ b/arch/x86/kernel/tsc_sync.c @@ -166,9 +166,9 @@ static int random_warps; * TSC-warp measurement loop running on both CPUs. This is not called * if there is no TSC. */ -static void check_tsc_warp(unsigned int timeout) +static cycles_t check_tsc_warp(unsigned int timeout) { - cycles_t start, now, prev, end; + cycles_t start, now, prev, end, cur_max_warp = 0; int i, cur_warps = 0; start = rdtsc_ordered(); @@ -209,6 +209,7 @@ static void check_tsc_warp(unsigned int timeout) if (unlikely(prev > now)) { arch_spin_lock(&sync_lock); max_warp = max(max_warp, prev - now); + cur_max_warp = max_warp; /* * Check whether this bounces back and forth. Only * one CPU should observe time going backwards. @@ -223,6 +224,7 @@ static void check_tsc_warp(unsigned int timeout) WARN(!(now-start), "Warning: zero tsc calibration delta: %Ld [max: %Ld]\n", now-start, end-start); + return cur_max_warp; } /*