Modify

#20531 closed defect (fixed)

Clock drift on Geode LX

Reported by: dwmw2 Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: kernel Version: Trunk
Keywords: Cc:

Description

The Geos ADSL router has a Geode LX CPU. Its TSC is reliable. In fact, *all* the Geode platforms we supported until quite recently were LX, not GX.

But because we build for Geode GX not LX, the code in arch/x86/kernel/tsc.c::check_system_tsc_reliable() doesn't trigger, and thus I seem to end up falling back to the PIT. And the clock then drifts forward quite nastily.

Something like this should fix it:

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 7437b41..d9449af 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -21,6 +21,7 @@
 #include <asm/hypervisor.h>
 #include <asm/nmi.h>
 #include <asm/x86_init.h>
+#include <asm/geode.h>
 
 unsigned int __read_mostly cpu_khz;	/* TSC clocks / usec, not used here */
 EXPORT_SYMBOL(cpu_khz);
@@ -1013,15 +1014,17 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
 
 static void __init check_system_tsc_reliable(void)
 {
-#ifdef CONFIG_MGEODE_LX
-	/* RTSC counts during suspend */
+#if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || defined(CONFIG_X86_GENERIC)
+	if (is_geode_lx()) {
+		/* RTSC counts during suspend */
 #define RTSC_SUSP 0x100
-	unsigned long res_low, res_high;
+		unsigned long res_low, res_high;
 
-	rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
-	/* Geode_LX - the OLPC CPU has a very reliable TSC */
-	if (res_low & RTSC_SUSP)
-		tsc_clocksource_reliable = 1;
+		rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
+		/* Geode_LX - the OLPC CPU has a very reliable TSC */
+		if (res_low & RTSC_SUSP)
+			tsc_clocksource_reliable = 1;
+	}
 #endif
 	if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
 		tsc_clocksource_reliable = 1;

Attachments (0)

Change History (2)

comment:1 Changed 22 months ago by dwmw2

Testing... without the patch, if I go back to CONFIG_MGEODEGX1, I see:

[    8.893307] xt_time: kernel timezone is -0000                                
[   14.522754] clocksource: timekeeping watchdog: Marking clocksource 'tsc' as u
nstable because the skew is too large:                                          
[   14.555090] clocksource:                       'pit' wd_now: eba5b2f7 wd_last
: eb9ca2c8 mask: ffffffff                                                       
[   14.564406] clocksource:                       'tsc' cs_now: 29eb8ba17 cs_las
t: 28c61a5f6 mask: ffffffffffffffff                                             
[   14.598508] clocksource: Switched to clocksource pit  
[   14.947946] pppoa-ppp1: renamed from ppp0                                    

With the patch I get:

[    8.833017] xt_time: kernel timezone is -0000                                
[   14.949452] pppoa-ppp0: renamed from ppp0                                    

comment:2 Changed 22 months ago by nbd

  • Resolution set to fixed
  • Status changed from new to closed

fixed in r46985, r46987

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.