lkml.org 
[lkml]   [2015]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v0 3/9] x86: Use freeze_active() instead of CPU_*_FROZEN
Date
The CPU state encodes if the CPU hotplug operation happens during suspend
or hibernate operations. Instead at looking at the encoded fields in the
CPU state variable, ask the PM subsystem directly.

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-edac@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/x86/kernel/cpu/mcheck/mce.c | 13 ++++++-------
arch/x86/kernel/cpu/microcode/core.c | 10 ++++++----
2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 9d014b82..1bd421b 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -18,6 +18,7 @@
#include <linux/rcupdate.h>
#include <linux/kobject.h>
#include <linux/uaccess.h>
+#include <linux/suspend.h>
#include <linux/kdebug.h>
#include <linux/kernel.h>
#include <linux/percpu.h>
@@ -2341,13 +2342,12 @@ static void mce_device_remove(unsigned int cpu)
/* Make sure there are no machine checks on offlined CPUs. */
static void mce_disable_cpu(void *h)
{
- unsigned long action = *(unsigned long *)h;
int i;

if (!mce_available(raw_cpu_ptr(&cpu_info)))
return;

- if (!(action & CPU_TASKS_FROZEN))
+ if (!freeze_active())
cmci_clear();
for (i = 0; i < mca_cfg.banks; i++) {
struct mce_bank *b = &mce_banks[i];
@@ -2359,13 +2359,12 @@ static void mce_disable_cpu(void *h)

static void mce_reenable_cpu(void *h)
{
- unsigned long action = *(unsigned long *)h;
int i;

if (!mce_available(raw_cpu_ptr(&cpu_info)))
return;

- if (!(action & CPU_TASKS_FROZEN))
+ if (!freeze_active())
cmci_reenable();
for (i = 0; i < mca_cfg.banks; i++) {
struct mce_bank *b = &mce_banks[i];
@@ -2395,15 +2394,15 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
mce_intel_hcpu_update(cpu);

/* intentionally ignoring frozen here */
- if (!(action & CPU_TASKS_FROZEN))
+ if (!freeze_active())
cmci_rediscover();
break;
case CPU_DOWN_PREPARE:
- smp_call_function_single(cpu, mce_disable_cpu, &action, 1);
+ smp_call_function_single(cpu, mce_disable_cpu, NULL, 1);
del_timer_sync(t);
break;
case CPU_DOWN_FAILED:
- smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
+ smp_call_function_single(cpu, mce_reenable_cpu, NULL, 1);
mce_start_timer(cpu, t);
break;
}
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 9e3f3c7..e49ec2c 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -18,6 +18,7 @@
#include <linux/platform_device.h>
#include <linux/miscdevice.h>
#include <linux/capability.h>
+#include <linux/suspend.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
@@ -442,6 +443,11 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
pr_debug("CPU%d removed\n", cpu);
break;

+ case CPU_UP_CANCELED:
+ /* The CPU refused to come up during a system resume */
+ if (freeze_active())
+ microcode_fini_cpu(cpu);
+ break;
/*
* case CPU_DEAD:
*
@@ -452,10 +458,6 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
*/
}

- /* The CPU refused to come up during a system resume */
- if (action == CPU_UP_CANCELED_FROZEN)
- microcode_fini_cpu(cpu);
-
return NOTIFY_OK;
}

--
2.4.3


\
 
 \ /
  Last update: 2015-09-04 16:01    [W:0.334 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site