Re: [PATCH] Blacklist TSC from systems where it is known to be bad

From: john stultz
Date: Thu Jan 19 2006 - 18:23:32 EST


On Thu, 2006-01-19 at 15:23 -0800, john stultz wrote:
> 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

Oops, forgot the signoff.

Signed-off-by: John Stultz <johnstul@xxxxxxxxxx>

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);
> }
>
>
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/