From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
Andi Kleen <ak@suse.de>, Chuck Ebbert <cebbert@redhat.com>,
Dave Jones <davej@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Len Brown <lenb@kernel.org>,
"Langsdorf, Mark" <mark.langsdorf@amd.com>
Subject: Re: [PATCH] x86-64: Disable local APIC timer use on AMD systems with C1E
Date: Tue, 25 Sep 2007 22:55:04 +0200 [thread overview]
Message-ID: <200709252255.06039.rjw@sisk.pl> (raw)
In-Reply-To: <1190749021.17409.35.camel@chaos>
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
On Tuesday, 25 September 2007 21:37, Thomas Gleixner wrote:
> commit 3556ddfa9284a86a59a9b78fe5894430f6ab4eef titled
>
> [PATCH] x86-64: Disable local APIC timer use on AMD systems with C1E
>
> solves a problem with AMD dual core laptops e.g. HP nx6325 (Turion 64
> X2) with C1E enabled:
>
> When both cores go into idle at the same time, then the system switches
> into C1E state, which is basically the same as C3. This stops the local
> apic timer.
>
> This was debugged right after the dyntick merge on i386 and despite the
> patch title it fixes only the 32 bit path.
>
> x86_64 is still missing this fix. It seems that mainline is not really
> affected by this issue, as the PIT is running and keeps jiffies
> incrementing, but that's just waiting for trouble.
>
> -mm suffers from this problem due to the x86_64 high resolution timer
> patches.
>
> This is a quick and dirty port of the i386 code to x86_64.
>
> I spent quite a time with Rafael to debug the -mm / hrt wreckage until
> someone pointed us to this. I really had forgotten that we debugged this
> half a year ago already.
>
> Sigh, is it just me or is there something yelling arch/x86 into my ear?
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
I have reworked the patch a bit so that it applies on top of 2.6.23-rc8-mm1
and compiles (my version is attached).
With this patch applied, the kernel boots correctly on the nx6325.
Greetings,
Rafael
[-- Attachment #2: x86-64-disable-local-APIC-timer-use-on-AMD-systems-with-C1E.patch --]
[-- Type: text/x-diff, Size: 2643 bytes --]
---
arch/x86_64/kernel/apic.c | 2 +-
arch/x86_64/kernel/setup.c | 34 ++++++++++++++++++++++++++++++++++
include/asm-x86_64/apic.h | 1 +
3 files changed, 36 insertions(+), 1 deletion(-)
Index: linux-2.6.23-rc8-mm1/arch/x86_64/kernel/setup.c
===================================================================
--- linux-2.6.23-rc8-mm1.orig/arch/x86_64/kernel/setup.c
+++ linux-2.6.23-rc8-mm1/arch/x86_64/kernel/setup.c
@@ -620,6 +620,37 @@ static void __cpuinit early_init_amd(str
#endif
}
+#define ENABLE_C1E_MASK 0x18000000
+#define CPUID_PROCESSOR_SIGNATURE 1
+#define CPUID_XFAM 0x0ff00000
+#define CPUID_XFAM_K8 0x00000000
+#define CPUID_XFAM_10H 0x00100000
+#define CPUID_XFAM_11H 0x00200000
+#define CPUID_XMOD 0x000f0000
+#define CPUID_XMOD_REV_F 0x00040000
+
+/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
+static __cpuinit int amd_apic_timer_broken(void)
+{
+ u32 lo, hi;
+ u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
+ switch (eax & CPUID_XFAM) {
+ case CPUID_XFAM_K8:
+ if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
+ break;
+ case CPUID_XFAM_10H:
+ case CPUID_XFAM_11H:
+ rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
+ if (lo & ENABLE_C1E_MASK)
+ return 1;
+ break;
+ default:
+ /* err on the side of caution */
+ return 1;
+ }
+ return 0;
+}
+
static void __cpuinit init_amd(struct cpuinfo_x86 *c)
{
unsigned level, flags, dummy;
@@ -692,6 +723,9 @@ static void __cpuinit init_amd(struct cp
if (c->x86 == 0x10 && !force_mwait)
clear_bit(X86_FEATURE_MWAIT, &c->x86_capability);
+ if (amd_apic_timer_broken())
+ disable_apic_timer = 1;
+
if (c->x86 >= 0xf && c->x86 <= 0x11 &&
!rdmsr_safe(MSR_VM_CR, &flags, &dummy) &&
(flags & 0x18))
Index: linux-2.6.23-rc8-mm1/include/asm-x86_64/apic.h
===================================================================
--- linux-2.6.23-rc8-mm1.orig/include/asm-x86_64/apic.h
+++ linux-2.6.23-rc8-mm1/include/asm-x86_64/apic.h
@@ -19,6 +19,7 @@
extern int apic_verbosity;
extern int apic_runs_main_timer;
extern int ioapic_force;
+extern int disable_apic_timer;
/*
* Define the default level of output to be very little
Index: linux-2.6.23-rc8-mm1/arch/x86_64/kernel/apic.c
===================================================================
--- linux-2.6.23-rc8-mm1.orig/arch/x86_64/kernel/apic.c
+++ linux-2.6.23-rc8-mm1/arch/x86_64/kernel/apic.c
@@ -41,8 +41,8 @@
#include <asm/apic.h>
int apic_verbosity;
+int disable_apic_timer __initdata;
static int apic_calibrate_pmtmr __initdata;
-static int disable_apic_timer __initdata;
/* Local APIC timer works in C2? */
int local_apic_timer_c2_ok;
next prev parent reply other threads:[~2007-09-25 20:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-25 19:37 [PATCH] x86-64: Disable local APIC timer use on AMD systems with C1E Thomas Gleixner
2007-09-25 20:55 ` Rafael J. Wysocki [this message]
2007-09-25 20:55 ` Thomas Gleixner
2007-09-25 21:32 ` Rafael J. Wysocki
2007-09-26 8:31 ` Ingo Molnar
2007-09-26 15:06 ` Rafael J. Wysocki
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=200709252255.06039.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=cebbert@redhat.com \
--cc=davej@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.langsdorf@amd.com \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox