Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532518 > unrolled thread

[tip:x86/timers] x86/tsc: Prepare warp test for TSC adjustment

Started bytip-bot for Thomas Gleixner <tipbot@zytor.com>
First post2016-11-29 18:00 +0100
Last post2016-11-29 18:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [tip:x86/timers] x86/tsc: Prepare warp test for TSC adjustment tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-11-29 18:00 +0100

#1532518 — [tip:x86/timers] x86/tsc: Prepare warp test for TSC adjustment

Fromtip-bot for Thomas Gleixner <tipbot@zytor.com>
Date2016-11-29 18:00 +0100
Subject[tip:x86/timers] x86/tsc: Prepare warp test for TSC adjustment
Message-ID<sITV8-2B3-29@gated-at.bofh.it>
Commit-ID:  1e849cff359ccd8b6f3096205e3759e70f8d30ea
Gitweb:     http://git.kernel.org/tip/1e849cff359ccd8b6f3096205e3759e70f8d30ea
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 19 Nov 2016 13:47:41 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Link: http://lkml.kernel.org/r/20161119134017.970859287@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 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;
 }
 
 /*

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web