All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Cal Peake <cp@absolutedigital.net>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drop unneeded variable in amd_apic_timer_broken
Date: Wed, 8 Aug 2007 16:36:20 +0200	[thread overview]
Message-ID: <200708081636.20223.ak@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0708072030440.28681@lancer.cnet.absolutedigital.net>

On Wednesday 08 August 2007 02:53:21 Cal Peake wrote:
> On Wed, 8 Aug 2007, Andi Kleen wrote:
> 
> > Not sure why the MSR varies between cores though.
> 
> Yeah that boggled me too.
> 
> > It's better to just make it a global instead.
> 
> Haven't gotten to figuring out how to do *that* yet... but here's a 
> cleanup for the detection function:

Can you please test if this patch works?

BTW I checked with AMD and they seem to think it's just a buggy BIOS.

-Andi

Use global flag to disable broken local apic timer on AMD CPUs.

The Averatec 2370 laptop BIOS seems to program the ENABLE_C1E
MSR inconsistently between cores. This confuses the lapic
use heuristics wants to know if C1E is enabled anywhere.

Use a global flag instead of a per cpu flag to handle this.
If any CPU has C1E enabled disabled lapic use.

Thanks to Cal Peake for debugging.
Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux/arch/i386/kernel/apic.c
===================================================================
--- linux.orig/arch/i386/kernel/apic.c
+++ linux/arch/i386/kernel/apic.c
@@ -61,8 +61,9 @@ static int enable_local_apic __initdata 
 
 /* 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;
+/* Disable local APIC timer from the kernel commandline or via dmi quirk
+   or using CPU MSR check */
+int local_apic_timer_disabled;
 /* Local APIC timer works in C2 */
 int local_apic_timer_c2_ok;
 EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -370,9 +371,6 @@ void __init setup_boot_APIC_clock(void)
 	long delta, deltapm;
 	int pm_referenced = 0;
 
-	if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
-		local_apic_timer_disabled = 1;
-
 	/*
 	 * The local apic timer can be disabled via the kernel
 	 * commandline or from the test above. Register the lapic
Index: linux/arch/i386/kernel/cpu/amd.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/amd.c
+++ linux/arch/i386/kernel/cpu/amd.c
@@ -3,6 +3,7 @@
 #include <linux/mm.h>
 #include <asm/io.h>
 #include <asm/processor.h>
+#include <asm/apic.h>
 
 #include "cpu.h"
 
@@ -22,6 +23,7 @@
 extern void vide(void);
 __asm__(".align 4\nvide: ret");
 
+#ifdef CONFIG_X86_LOCAL_APIC
 #define ENABLE_C1E_MASK         0x18000000
 #define CPUID_PROCESSOR_SIGNATURE       1
 #define CPUID_XFAM              0x0ff00000
@@ -52,6 +54,7 @@ static __cpuinit int amd_apic_timer_brok
         }
 	return 0;
 }
+#endif
 
 int force_mwait __cpuinitdata;
 
@@ -282,8 +285,10 @@ static void __cpuinit init_amd(struct cp
 			num_cache_leaves = 3;
 	}
 
+#ifdef CONFIG_X86_LOCAL_APIC
 	if (amd_apic_timer_broken())
-		set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
+		local_apic_timer_disabled = 1;
+#endif
 
 	if (c->x86 == 0x10 && !force_mwait)
 		clear_bit(X86_FEATURE_MWAIT, c->x86_capability);
Index: linux/include/asm-i386/apic.h
===================================================================
--- linux.orig/include/asm-i386/apic.h
+++ linux/include/asm-i386/apic.h
@@ -116,6 +116,8 @@ extern void enable_NMI_through_LVT0 (voi
 extern int timer_over_8254;
 extern int local_apic_timer_c2_ok;
 
+extern int local_apic_timer_disabled;
+
 #else /* !CONFIG_X86_LOCAL_APIC */
 static inline void lapic_shutdown(void) { }
 
Index: linux/include/asm-i386/cpufeature.h
===================================================================
--- linux.orig/include/asm-i386/cpufeature.h
+++ linux/include/asm-i386/cpufeature.h
@@ -79,7 +79,7 @@
 #define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
 #define X86_FEATURE_PEBS	(3*32+12)  /* Precise-Event Based Sampling */
 #define X86_FEATURE_BTS		(3*32+13)  /* Branch Trace Store */
-#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
+/* 14 free */
 #define X86_FEATURE_SYNC_RDTSC	(3*32+15)  /* RDTSC synchronizes the CPU */
 #define X86_FEATURE_REP_GOOD   (3*32+16) /* rep microcode works well on this CPU */
 

  reply	other threads:[~2007-08-08 14:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-29 18:05 ACPI on Averatec 2370 Frank Hale
2007-07-29 18:13 ` Gabriel C
2007-07-29 18:45   ` Cal Peake
2007-07-29 18:58     ` Frank Hale
2007-07-29 19:58       ` Frank Hale
2007-07-30 15:20   ` Cal Peake
2007-08-02 17:50     ` Cal Peake
2007-08-02 19:09       ` Chuck Ebbert
2007-08-02 19:42         ` Cal Peake
2007-08-02 20:26           ` Chuck Ebbert
2007-08-02 20:30             ` Cal Peake
2007-08-02 20:51               ` Frank Hale
2007-08-02 21:07               ` Linus Torvalds
2007-08-02 21:53                 ` Cal Peake
2007-08-03 21:56                   ` Linus Torvalds
2007-08-04  9:30                     ` Andi Kleen
2007-08-04 13:50                       ` Frank Hale
2007-08-05 14:26                       ` Thomas Renninger
2007-08-07 22:15                     ` Cal Peake
2007-08-08  0:06                       ` Andi Kleen
2007-08-08  0:53                         ` [PATCH] drop unneeded variable in amd_apic_timer_broken Cal Peake
2007-08-08 14:36                           ` Andi Kleen [this message]
2007-08-08 16:00                             ` Cal Peake
2007-08-08 18:25                               ` Tim Gardner
2007-08-08 14:41                         ` ACPI on Averatec 2370 Joachim Deguara
2007-08-08 23:52                           ` Frank Hale
2007-08-09  1:26                             ` DJA
2007-08-09  9:45                             ` Joachim Deguara
2007-08-03 15:52                 ` Ben Collins
2007-08-03 18:19                   ` Chuck Ebbert

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=200708081636.20223.ak@suse.de \
    --to=ak@suse.de \
    --cc=cp@absolutedigital.net \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.