[kernel] r18052 - in dists/squeeze/linux-2.6/debian: . patches/bugfix/x86 patches/series
Ben Hutchings
benh at alioth.debian.org
Mon Sep 5 03:59:04 UTC 2011
Author: benh
Date: Mon Sep 5 03:59:02 2011
New Revision: 18052
Log:
[x86] Revert "x86, hotplug: Use mwait to offline a processor, fix the legacy case" (Closes: #622259)
Added:
dists/squeeze/linux-2.6/debian/patches/bugfix/x86/revert-x86-hotplug-Use-mwait-to-offline-a-processor-.patch
Modified:
dists/squeeze/linux-2.6/debian/changelog
dists/squeeze/linux-2.6/debian/patches/series/36
Modified: dists/squeeze/linux-2.6/debian/changelog
==============================================================================
--- dists/squeeze/linux-2.6/debian/changelog Mon Sep 5 03:36:39 2011 (r18051)
+++ dists/squeeze/linux-2.6/debian/changelog Mon Sep 5 03:59:02 2011 (r18052)
@@ -85,6 +85,8 @@
http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.32/ChangeLog-2.6.32.45
and the bug report which this closes: #639426.
* sched: Work around sched_group::cpu_power == 0 (Ameliorates: #636797)
+ * [x86] Revert "x86, hotplug: Use mwait to offline a processor, fix the
+ legacy case" (Closes: #622259)
-- maximilian attems <maks at debian.org> Sat, 25 Jun 2011 10:22:27 +0200
Added: dists/squeeze/linux-2.6/debian/patches/bugfix/x86/revert-x86-hotplug-Use-mwait-to-offline-a-processor-.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/bugfix/x86/revert-x86-hotplug-Use-mwait-to-offline-a-processor-.patch Mon Sep 5 03:59:02 2011 (r18052)
@@ -0,0 +1,149 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 5 Sep 2011 04:51:04 +0100
+Subject: [PATCH] Revert "x86, hotplug: Use mwait to offline a processor, fix
+ the legacy case"
+
+This reverts commit 226917b0735f31cf5c704e07fdd590d99bbfae58, which
+was found to break hibernation on some systems.
+---
+ arch/x86/include/asm/processor.h | 23 ++++++++++
+ arch/x86/kernel/smpboot.c | 85 +-------------------------------------
+ 2 files changed, 24 insertions(+), 84 deletions(-)
+
+diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
+index da35a70..fa04dea 100644
+--- a/arch/x86/include/asm/processor.h
++++ b/arch/x86/include/asm/processor.h
+@@ -765,6 +765,29 @@ extern unsigned long boot_option_idle_override;
+ extern unsigned long idle_halt;
+ extern unsigned long idle_nomwait;
+
++/*
++ * on systems with caches, caches must be flashed as the absolute
++ * last instruction before going into a suspended halt. Otherwise,
++ * dirty data can linger in the cache and become stale on resume,
++ * leading to strange errors.
++ *
++ * perform a variety of operations to guarantee that the compiler
++ * will not reorder instructions. wbinvd itself is serializing
++ * so the processor will not reorder.
++ *
++ * Systems without cache can just go into halt.
++ */
++static inline void wbinvd_halt(void)
++{
++ mb();
++ /* check for clflush to determine if wbinvd is legal */
++ if (cpu_has_clflush)
++ asm volatile("cli; wbinvd; 1: hlt; jmp 1b" : : : "memory");
++ else
++ while (1)
++ halt();
++}
++
+ extern void enable_sep_cpu(void);
+ extern int sysenter_setup(void);
+
+diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
+index 539bb6c..7e8e905 100644
+--- a/arch/x86/kernel/smpboot.c
++++ b/arch/x86/kernel/smpboot.c
+@@ -1338,94 +1338,11 @@ void play_dead_common(void)
+ local_irq_disable();
+ }
+
+-#define MWAIT_SUBSTATE_MASK 0xf
+-#define MWAIT_SUBSTATE_SIZE 4
+-
+-#define CPUID_MWAIT_LEAF 5
+-#define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
+-
+-/*
+- * We need to flush the caches before going to sleep, lest we have
+- * dirty data in our caches when we come back up.
+- */
+-static inline void mwait_play_dead(void)
+-{
+- unsigned int eax, ebx, ecx, edx;
+- unsigned int highest_cstate = 0;
+- unsigned int highest_subcstate = 0;
+- int i;
+- void *mwait_ptr;
+-
+- if (!cpu_has(¤t_cpu_data, X86_FEATURE_MWAIT))
+- return;
+- if (!cpu_has(¤t_cpu_data, X86_FEATURE_CLFLSH))
+- return;
+- if (current_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
+- return;
+-
+- eax = CPUID_MWAIT_LEAF;
+- ecx = 0;
+- native_cpuid(&eax, &ebx, &ecx, &edx);
+-
+- /*
+- * eax will be 0 if EDX enumeration is not valid.
+- * Initialized below to cstate, sub_cstate value when EDX is valid.
+- */
+- if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED)) {
+- eax = 0;
+- } else {
+- edx >>= MWAIT_SUBSTATE_SIZE;
+- for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {
+- if (edx & MWAIT_SUBSTATE_MASK) {
+- highest_cstate = i;
+- highest_subcstate = edx & MWAIT_SUBSTATE_MASK;
+- }
+- }
+- eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
+- (highest_subcstate - 1);
+- }
+-
+- /*
+- * This should be a memory location in a cache line which is
+- * unlikely to be touched by other processors. The actual
+- * content is immaterial as it is not actually modified in any way.
+- */
+- mwait_ptr = ¤t_thread_info()->flags;
+-
+- wbinvd();
+-
+- while (1) {
+- /*
+- * The CLFLUSH is a workaround for erratum AAI65 for
+- * the Xeon 7400 series. It's not clear it is actually
+- * needed, but it should be harmless in either case.
+- * The WBINVD is insufficient due to the spurious-wakeup
+- * case where we return around the loop.
+- */
+- clflush(mwait_ptr);
+- __monitor(mwait_ptr, 0, 0);
+- mb();
+- __mwait(eax, 0);
+- }
+-}
+-
+-static inline void hlt_play_dead(void)
+-{
+- if (current_cpu_data.x86 >= 4)
+- wbinvd();
+-
+- while (1) {
+- native_halt();
+- }
+-}
+-
+ void native_play_dead(void)
+ {
+ play_dead_common();
+ tboot_shutdown(TB_SHUTDOWN_WFS);
+-
+- mwait_play_dead(); /* Only returns on failure */
+- hlt_play_dead();
++ wbinvd_halt();
+ }
+
+ #else /* ... !CONFIG_HOTPLUG_CPU */
+--
+1.7.5.4
+
Modified: dists/squeeze/linux-2.6/debian/patches/series/36
==============================================================================
--- dists/squeeze/linux-2.6/debian/patches/series/36 Mon Sep 5 03:36:39 2011 (r18051)
+++ dists/squeeze/linux-2.6/debian/patches/series/36 Mon Sep 5 03:59:02 2011 (r18052)
@@ -686,3 +686,4 @@
+ bugfix/all/atm-br2864-sent-packets-truncated-in-VC-routed-mode.patch
+ bugfix/all/sched-work-around-sched_group-cpu_power-0.patch
++ bugfix/x86/revert-x86-hotplug-Use-mwait-to-offline-a-processor-.patch
More information about the Kernel-svn-changes
mailing list