Skip to contentSkip to conversation

x86: Reenable TSC sync check at boot, even with NONSTOP_TSC

PATCH In review Pallipadi, Venkatesh 2 participants 3 messages Dec 17, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Reenable TSC sync check at boot, even with NONSTOP_TSC

Commit 83ce4009 did the following change
If the TSC is constant and non-stop, also set it reliable.

But, there seems to be few systems that will end up with TSC warp across sockets, depending on how the cpus come out of reset. Skipping TSC sync test on such systems may result in time inconsistency later.

So, reenable TSC sync test even on constant and non-stop TSC systems. Set, sched_clock_stable to 1 by default and reset it in mark_tsc_unstable, if TSC sync fails.

This change still gives perf benefit mentioned in 83ce4009 for systems where TSC is reliable.

---
 arch/x86/kernel/cpu/intel.c |    1 -
 arch/x86/kernel/tsc.c       |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/intel.c +0 -1
index 9c31e8b..879666f 100644
@@ -70,7 +70,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
 	if (c->x86_power & (1 << 8)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 		set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-		set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
 		sched_clock_stable = 1;
 	}
 
arch/x86/kernel/tsc.c +1 -0
index cd982f4..597683a 100644
@@ -763,6 +763,7 @@ void mark_tsc_unstable(char *reason)
 {
 	if (!tsc_unstable) {
 		tsc_unstable = 1;
+		sched_clock_stable = 0;
 		printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
 		/* Change only the rating, when not registered */
 		if (clocksource_tsc.mult)
Signature · 1 line
1.6.0.6
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Venkatesh

Commit 83ce4009 did the following change
If the TSC is constant and non-stop, also set it reliable.

But, there seems to be few systems that will end up with TSC warp across sockets, depending on how the cpus come out of reset. Skipping TSC sync test on such systems may result in time inconsistency later.

Quoted 8 lines

So, reenable TSC sync test even on constant and non-stop TSC systems. Set, sched_clock_stable to 1 by default and reset it in mark_tsc_unstable, if TSC sync fails.

This change still gives perf benefit mentioned in 83ce4009 for systems where TSC is reliable.

#2 lore raw
In reply to Pallipadi, Venkatesh
Commit-ID:  6c56ccecf05fafe100ab4ea94f6fccbf5ff00db7
Gitweb:     http://git.kernel.org/tip/6c56ccecf05fafe100ab4ea94f6fccbf5ff00db7
Author:     Pallipadi, Venkatesh <[email protected]>
AuthorDate: Thu, 17 Dec 2009 12:27:02 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 17 Dec 2009 14:44:35 -0800

x86: Reenable TSC sync check at boot, even with NONSTOP_TSC

Commit 83ce4009 did the following change
If the TSC is constant and non-stop, also set it reliable.

But, there seems to be few systems that will end up with TSC warp across sockets, depending on how the cpus come out of reset. Skipping TSC sync test on such systems may result in time inconsistency later.

So, reenable TSC sync test even on constant and non-stop TSC systems. Set, sched_clock_stable to 1 by default and reset it in mark_tsc_unstable, if TSC sync fails.

This change still gives perf benefit mentioned in 83ce4009 for systems where TSC is reliable.

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/cpu/intel.c |    1 -
 arch/x86/kernel/tsc.c       |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/intel.c +0 -1
index 9c31e8b..879666f 100644
@@ -70,7 +70,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
 	if (c->x86_power & (1 << 8)) {
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 		set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-		set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
 		sched_clock_stable = 1;
 	}
 
arch/x86/kernel/tsc.c +1 -0
index cd982f4..597683a 100644
@@ -763,6 +763,7 @@ void mark_tsc_unstable(char *reason)
 {
 	if (!tsc_unstable) {
 		tsc_unstable = 1;
+		sched_clock_stable = 0;
 		printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
 		/* Change only the rating, when not registered */
 		if (clocksource_tsc.mult)