[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1295534572-10730-1-git-send-email-bp@amd64.org>
Date: Thu, 20 Jan 2011 15:42:52 +0100
From: Borislav Petkov <bp@...64.org>
To: <x86@...nel.org>
Cc: <linux-kernel@...r.kernel.org>, <andreas.herrmann3@....com>,
Borislav Petkov <borislav.petkov@....com>,
"H. Peter Anvin" <hpa@...ux.intel.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Len Brown <lenb@...nel.org>,
Venkatesh Pallipadi <venki@...gle.com>,
Peter Zijlstra <a.p.zijlstra@...llo.hl>
Subject: [PATCH] x86, hotplug: Fix powersavings with offlined cores on AMD
From: Borislav Petkov <borislav.petkov@....com>
ea53069231f9317062910d6e772cca4ce93de8c8 made a CPU use monitor/mwait
when offline. This is not the optimal choice for AMD wrt to powersavings
and we'd prefer our cores to halt (i.e. enter C1) instead. For this, the
same selection whether to use monitor/mwait has to be used as when we
select the idle routine for the machine.
With this patch, offlining cores 1-5 on a X6 machine allows core0 to
boost again.
Reported-by: Andreas Herrmann <andreas.herrmann3@....com>
Cc: stable@...nel.org # 37.x
Cc: H. Peter Anvin <hpa@...ux.intel.com>
Cc: Arjan van de Ven <arjan@...ux.intel.com>
Cc: Len Brown <lenb@...nel.org>
Cc: Venkatesh Pallipadi <venki@...gle.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.hl>
Signed-off-by: Borislav Petkov <borislav.petkov@....com>
---
arch/x86/include/asm/cpu.h | 1 +
arch/x86/kernel/process.c | 3 ++-
arch/x86/kernel/smpboot.c | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index 4fab24d..6e6e755 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -32,5 +32,6 @@ extern void arch_unregister_cpu(int);
DECLARE_PER_CPU(int, cpu_state);
+int __cpuinit mwait_usable(const struct cpuinfo_x86 *);
#endif /* _ASM_X86_CPU_H */
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index d8286ed..e764fc0 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -14,6 +14,7 @@
#include <linux/utsname.h>
#include <trace/events/power.h>
#include <linux/hw_breakpoint.h>
+#include <asm/cpu.h>
#include <asm/system.h>
#include <asm/apic.h>
#include <asm/syscalls.h>
@@ -505,7 +506,7 @@ static void poll_idle(void)
#define MWAIT_ECX_EXTENDED_INFO 0x01
#define MWAIT_EDX_C1 0xf0
-static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
+int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
{
u32 eax, ebx, ecx, edx;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 763df77..0cbe8c0 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1402,8 +1402,9 @@ static inline void mwait_play_dead(void)
unsigned int highest_subcstate = 0;
int i;
void *mwait_ptr;
+ struct cpuinfo_x86 *c = __this_cpu_ptr(&cpu_info);
- if (!cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_MWAIT))
+ if (!(cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)))
return;
if (!cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_CLFLSH))
return;
--
1.7.4.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists