LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Stefan Prechtel <stefan.prechtel@googlemail.com>
Cc: Andi Kleen <ak@suse.de>,
	Grzegorz Chwesewicz <grzegorz.chwesewicz@chilan.com>,
	linux-kernel@vger.kernel.org, mingo@elte.hu,
	Len Brown <lenb@kernel.org>, john stultz <johnstul@us.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Adrian Bunk <bunk@stusta.de>,
	Arjan van de Ven <arjan@infradead.org>
Subject: [PATCH] i386: disable local apic timer via command line or dmi quirk
Date: Wed, 21 Mar 2007 15:14:43 +0100	[thread overview]
Message-ID: <1174486483.10840.89.camel@localhost.localdomain> (raw)
In-Reply-To: <b93822910703210604w6bcc2e1dt4cac7f9f9295edf8@mail.gmail.com>

The local APIC timer stops to work in deeper C-States. This is handled
by the ACPI code and a broadcast mechanism in the clockevents / tick
managment code.

Some systems do not expose the deeper C-States to the kernel, but switch
into deeper C-States behind the kernels back. This delays the local apic
timer interrupts for ever and makes the systems unusable.

Add a command line option to disable the local apic timer and a dmi
quirk for known broken systems.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 856c8b1..06377c7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1117,6 +1117,8 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	nolapic		[IA-32,APIC] Do not enable or use the local APIC.
 
+	nolapic_timer	[IA-32,APIC] Do not use the local APIC timer.
+
 	noltlbs		[PPC] Do not use large page/tlb entries for kernel
 			lowmem mapping on PPC40x.
 
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 5cff797..3682511 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -28,6 +28,7 @@
 #include <linux/clockchips.h>
 #include <linux/acpi_pmtmr.h>
 #include <linux/module.h>
+#include <linux/dmi.h>
 
 #include <asm/atomic.h>
 #include <asm/smp.h>
@@ -61,6 +62,8 @@ static int enable_local_apic __initdata = 0;
 
 /* Local APIC timer verification ok */
 static int local_apic_timer_verify_ok;
+/* Disable local APIC timer from the kernel commandline or via dmi quirk */
+static int local_apic_timer_disabled;
 
 /*
  * Debug level, exported for io_apic.c
@@ -266,6 +269,32 @@ static void __devinit setup_APIC_timer(void)
 }
 
 /*
+ * Detect systems with known broken BIOS implementations
+ */
+static int __init lapic_check_broken_bios(struct dmi_system_id *d)
+{
+	printk(KERN_NOTICE "%s detected: disabling lapic timer.\n",
+		       d->ident);
+	local_apic_timer_disabled = 1;
+	return 0;
+}
+
+static struct dmi_system_id __initdata broken_bios_dmi_table[] = {
+	{
+		/*
+		 * BIOS exports only C1 state, but uses deeper power
+		 * modes behind the kernels back.
+		 */
+		  .callback = lapic_check_broken_bios,
+		  .ident = "HP nx6325",
+		  .matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
+		  },
+	 },
+	 {}
+};
+
+/*
  * In this functions we calibrate APIC bus clocks to the external timer.
  *
  * We want to do the calibration only once since we want to have local timer
@@ -340,6 +369,22 @@ void __init setup_boot_APIC_clock(void)
 	long delta, deltapm;
 	int pm_referenced = 0;
 
+	/* Detect know broken systems */
+	dmi_check_system(broken_bios_dmi_table);
+
+	/*
+	 * The local apic timer can be disabled via the kernel
+	 * commandline or from the dmi quirk above. Register the lapic
+	 * timer as a dummy clock event source on SMP systems, so the
+	 * broadcast mechanism is used. On UP systems simply ignore it.
+	 */
+	if (local_apic_timer_disabled) {
+		/* No broadcast on UP ! */
+		if (num_possible_cpus() > 1)
+			setup_APIC_timer();
+		return;
+	}
+
 	apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
 		    "calibrating APIC timer ...\n");
 
@@ -1179,6 +1224,13 @@ static int __init parse_nolapic(char *arg)
 }
 early_param("nolapic", parse_nolapic);
 
+static int __init parse_disable_lapic_timer(char *arg)
+{
+	local_apic_timer_disabled = 1;
+	return 0;
+}
+early_param("nolapic_timer", parse_disable_lapic_timer);
+
 static int __init apic_set_verbosity(char *str)
 {
 	if (strcmp("debug", str) == 0)



  parent reply	other threads:[~2007-03-21 14:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19 17:10 BUG lapic: Can't boot on battery (2.6.21-rc{1,2,3,4}) Stefan Prechtel
2007-03-19 17:36 ` Thomas Gleixner
2007-03-19 17:48   ` Thomas Gleixner
2007-03-19 18:53     ` Stefan Prechtel
2007-03-19 19:17       ` Stefan Prechtel
2007-03-19 19:27       ` Thomas Gleixner
2007-03-19 19:49         ` Stefan Prechtel
2007-03-19 20:04           ` Thomas Gleixner
2007-03-19 20:35             ` Stefan Prechtel
2007-03-19 20:56               ` Thomas Gleixner
2007-03-19 21:51                 ` Stefan Prechtel
2007-03-20  1:15                   ` Thomas Gleixner
2007-03-20  8:23                     ` Stefan Prechtel
2007-03-20 16:47                       ` Grzegorz Chwesewicz
2007-03-21  9:24                         ` Thomas Gleixner
2007-03-21  9:46                           ` Andi Kleen
2007-03-21 10:10                             ` Thomas Gleixner
2007-03-21 10:37                               ` Andi Kleen
2007-03-21 11:14                                 ` Thomas Gleixner
2007-03-21 12:15                                   ` Thomas Gleixner
2007-03-21 12:33                                     ` Thomas Gleixner
2007-03-21 12:42                                   ` Andi Kleen
2007-03-21 13:04                                     ` Stefan Prechtel
2007-03-21 13:15                                       ` Thomas Gleixner
2007-03-21 14:14                                       ` Thomas Gleixner [this message]
2007-03-21 14:09                                         ` [PATCH] i386: disable local apic timer via command line or dmi quirk Ingo Molnar
2007-03-21 15:14                                           ` Grzegorz Chwesewicz
2007-03-22 20:42                                             ` Stefan Prechtel
2007-03-28  3:28                                         ` Len Brown
2007-03-28  3:38                                           ` Len Brown
2007-03-28  9:13                                           ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1174486483.10840.89.camel@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=bunk@stusta.de \
    --cc=grzegorz.chwesewicz@chilan.com \
    --cc=johnstul@us.ibm.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stefan.prechtel@googlemail.com \
    --subject='Re: [PATCH] i386: disable local apic timer via command line or dmi quirk' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).