Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 4028

kernel-2.6.18-194.11.1.el5.src.rpm

From: Bhavna Sarathy <bnagendr@redhat.com>
Date: Mon, 9 Nov 2009 20:42:18 -0500
Subject: [x86] support amd magny-cours power-aware scheduler fix
Message-id: <4AF87EAA.1040008@redhat.com>
Patchwork-id: 21334
O-Subject: Re: [RHEL5.5 PATCH] Support AMD Magny-cours power-aware scheduler fix
Bugzilla: 513685
RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com>
RH-Acked-by: Chuck Ebbert <cebbert@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>

Resolves BZ 513685

This patch is workaround for the broken sched domain creation on Magny-cours,
that has the correct topology.  Current sched domain creation code can't
handle multi-node processors.  When switching to power savings scheduling
errors show up and system might hang (due to broken sched domain hierarchy).

Note that Linux scheduler works fine without any M-C patches as the SRAT provides
the correct information from the BIOS.  The patch is fixing the hang that occurs
when performing this command.

echo 1 >> /sys/devices/system/cpu/sched_mc_power_savings

Patch dependency note:
The patch is dependent on the topology patches and need to be applied after
RHEL5.5_AMD_MC_topology1.patch, RHEL5.5_AMD_MC_topology2.patch, and
RHEL5.5_AMD_MC_topology3.patch are all applied.

Upstream link:
http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-tip.git;a=commit;h=5a925b4282d7f805deafde62001a83dbaf8be275

Testing:
The patch has been tested on 2 processor Magny-cours processor, Dinar,
and log is attached to the BZ.  The patch fixes the hang, and provides the proper
sched-domain hierarchy.
The patch has also been regression tested on older processor revs.

diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 7babd56..e568e74 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -454,7 +454,8 @@ cpumask_t cpu_coregroup_map(int cpu)
 	 * For perf, we return last level cache shared map.
 	 * And for power savings, we return cpu_core_map
 	 */
-	if (sched_mc_power_savings || sched_smt_power_savings)
+	if ((sched_mc_power_savings || sched_smt_power_savings) &&
+		!(cpu_has(c, X86_FEATURE_AMD_DCM)))
 		return cpu_core_map[cpu];
 	else
 		return c->llc_shared_map;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index a1c1899..5f05cc8 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -457,7 +457,8 @@ cpumask_t cpu_coregroup_map(int cpu)
 	 * For perf, we return last level cache shared map.
 	 * And for power savings, we return cpu_core_map
 	 */
-	if (sched_mc_power_savings || sched_smt_power_savings)
+	if ((sched_mc_power_savings || sched_smt_power_savings) &&
+		!(cpu_has(c, X86_FEATURE_AMD_DCM)))
 		return cpu_core_map[cpu];
 	else
 		return c->llc_shared_map;