rpms/kernel/devel linux-2.6-x86-disable-local-apic-amd-c1e.patch, NONE, 1.1 kernel.spec, 1.185, 1.186

Dave Jones (davej) fedora-extras-commits at redhat.com
Tue Sep 25 19:51:37 UTC 2007


Author: davej

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20849

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-x86-disable-local-apic-amd-c1e.patch 
Log Message:
* Tue Sep 25 2007 Dave Jones <davej at redhat.com>
- x86-64: Disable local APIC timer use on AMD systems with C1E.


linux-2.6-x86-disable-local-apic-amd-c1e.patch:

--- NEW FILE linux-2.6-x86-disable-local-apic-amd-c1e.patch ---
>From davej  Tue Sep 25 15:44:00 2007
Return-Path: <tglx at linutronix.de>
X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on
	gelk.kernelslacker.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,
	UNPARSEABLE_RELAY autolearn=ham version=3.2.3
Received: from pobox.devel.redhat.com [10.11.255.8]
	by gelk.kernelslacker.org with IMAP (fetchmail-6.3.7)
	for <davej at localhost> (single-drop); Tue, 25 Sep 2007 15:44:00 -0400 (EDT)
Received: from pobox.devel.redhat.com ([unix socket])
	 by pobox.devel.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-8.1.RHEL4) with LMTPA;
	 Tue, 25 Sep 2007 15:37:08 -0400
X-Sieve: CMU Sieve 2.2
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
	by pobox.devel.redhat.com (8.13.1/8.13.1) with ESMTP id l8PJb8qa020820
	for <davej at pobox.devel.redhat.com>; Tue, 25 Sep 2007 15:37:08 -0400
Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32])
	by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l8PJb7X2009192;
	Tue, 25 Sep 2007 15:37:07 -0400
Received: from mail.tglx.de (www.osadl.org [213.239.205.134])
	by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id l8PJb5GW020058;
	Tue, 25 Sep 2007 15:37:06 -0400
Received: from [127.0.0.1] (debian [213.239.205.147])
	by mail.tglx.de (Postfix) with ESMTP id 32A6265C003;
	Tue, 25 Sep 2007 21:37:04 +0200 (CEST)
Subject: [PATCH] x86-64: Disable local APIC timer use on AMD systems with
	C1E
From: Thomas Gleixner <tglx at linutronix.de>
To: LKML <linux-kernel at vger.kernel.org>
Cc: Andrew Morton <akpm at osdl.org>, Linus Torvalds <torvalds at osdl.org>,
        Andi Kleen <ak at suse.de>, Chuck Ebbert <cebbert at redhat.com>,
        Dave Jones <davej at redhat.com>, Ingo Molnar <mingo at elte.hu>,
        "Rafael J. Wysocki" <rjw at sisk.pl>, Len Brown <lenb at kernel.org>,
        "Langsdorf, Mark" <mark.langsdorf at amd.com>
Content-Type: text/plain
Date: Tue, 25 Sep 2007 21:37:01 +0200
Message-Id: <1190749021.17409.35.camel at chaos>
Mime-Version: 1.0
X-Mailer: Evolution 2.12.0 (2.12.0-3.fc8) 
Content-Transfer-Encoding: 7bit
X-RedHat-Spam-Score: 0 
X-Scanned-By: MIMEDefang 2.58 on 172.16.48.32
Status: RO
Content-Length: 2997
Lines: 96

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 at linutronix.de>

diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index af838f6..32054bf 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -546,6 +546,37 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
 #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;
@@ -617,6 +648,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 	/* Family 10 doesn't support C states in MWAIT so don't use it */
 	if (c->x86 == 0x10 && !force_mwait)
 		clear_bit(X86_FEATURE_MWAIT, &c->x86_capability);
+
+	if (amd_apic_timer_broken())
+		disable_apic_timer = 1;
 }
 
 static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
--- linux-2.6.22.noarch/include/asm-x86_64/apic.h~	2007-09-25 15:47:01.000000000 -0400
+++ linux-2.6.22.noarch/include/asm-x86_64/apic.h	2007-09-25 15:47:23.000000000 -0400
@@ -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: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -r1.185 -r1.186
--- kernel.spec	25 Sep 2007 01:28:29 -0000	1.185
+++ kernel.spec	25 Sep 2007 19:51:00 -0000	1.186
@@ -555,7 +555,8 @@
 
 %if !%{nopatches}
 
-Patch20: linux-2.6-highres-timers.patch
+Patch19: linux-2.6-highres-timers.patch
+Patch20: linux-2.6-x86-disable-local-apic-amd-c1e.patch
 
 Patch21: linux-2.6-utrace-tracehook.patch
 Patch22: linux-2.6-utrace-tracehook-ia64.patch
@@ -968,6 +969,7 @@
 
 # patch-2.6.23-rc3-hrt2.patch
 ApplyPatch linux-2.6-highres-timers.patch
+ApplyPatch linux-2.6-x86-disable-local-apic-amd-c1e.patch
 
 # Roland's utrace ptrace replacement.
 # Main patch includes i386, x86_64, powerpc.
@@ -1809,6 +1811,9 @@
 
 
 %changelog
+* Tue Sep 25 2007 Dave Jones <davej at redhat.com>
+- x86-64: Disable local APIC timer use on AMD systems with C1E.
+
 * Mon Sep 24 2007 Dave Jones <davej at redhat.com>
 - 2.6.23-rc8
 




More information about the fedora-extras-commits mailing list