mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Blacklist TSC from systems where it is known to be bad
@ 2006-01-19 23:23 john stultz
  2006-01-19 23:24 ` john stultz
  0 siblings, 1 reply; 2+ messages in thread
From: john stultz @ 2006-01-19 23:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml

	This patch adds a blacklist infrastructure to the TSC clocksource as
well as an entry for the 380XD Thinkpad. This allows us to manually add
systems (mainly older-laptops) where the TSC frequency is changed by the
BIOS without any notification to the OS.

The justification for using a blacklist instead of trying to detect the
problem is because the detectable symptoms are exactly the same as what
is observed when interrupts arrive too frequently (a semi-common issue
w/ broken PIT hardware), and the number of other older laptops with this
issue is likely small.

This patch resolves bugme bug #5868.

thanks
-john


diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index cab2546..7e72219 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -9,6 +9,7 @@
 #include <linux/cpufreq.h>
 #include <linux/jiffies.h>
 #include <linux/init.h>
+#include <linux/dmi.h>
 
 #include <asm/delay.h>
 #include <asm/tsc.h>
@@ -359,6 +360,27 @@ static int tsc_update_callback(void)
 	return change;
 }
 
+static int __init dmi_mark_tsc_unstable(struct dmi_system_id *d)
+{
+	printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
+		       d->ident);
+	mark_tsc_unstable();
+	return 0;
+}
+
+/* List of systems that have known TSC problems */
+static struct dmi_system_id __initdata bad_tsc_dmi_table[] = {
+	{
+	 .callback = dmi_mark_tsc_unstable,
+	 .ident = "IBM Thinkpad 380XD",
+	 .matches = {
+		     DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+		     DMI_MATCH(DMI_BOARD_NAME, "2635FA0"),
+		     },
+	 },
+	 {}
+};
+
 /*
  * Make an educated guess if the TSC is trustworthy and synchronized
  * over all CPUs.
@@ -376,16 +398,21 @@ static __init int unsynchronized_tsc(voi
  	return num_possible_cpus() > 1;
 }
 
-/* NUMAQ can't use TSC: */
 static int __init init_tsc_clocksource(void)
 {
-	/* TSC initialization is done in arch/i386/kernel/tsc.c */
+
 	if (cpu_has_tsc && tsc_khz && !tsc_disable) {
-		if (unsynchronized_tsc()) /* lower rating if unsynced */
+		/* check blacklist */
+		dmi_check_system(bad_tsc_dmi_table);
+
+		if (unsynchronized_tsc()) /* mark unstable if unsynced */
 			mark_tsc_unstable();
 		current_tsc_khz = tsc_khz;
 		clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
 							clocksource_tsc.shift);
+		/* lower the rating if we already know its unstable: */
+		if (check_tsc_unstable())
+			clocksource_tsc.rating = 50;
 		register_clocksource(&clocksource_tsc);
 	}
 





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-19 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 23:23 [PATCH] Blacklist TSC from systems where it is known to be bad john stultz
2006-01-19 23:24 ` john stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®