From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933682AbbIDNhA (ORCPT ); Fri, 4 Sep 2015 09:37:00 -0400 Received: from mail.bmw-carit.de ([62.245.222.98]:45800 "EHLO linuxmail.bmw-carit.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933523AbbIDNfO (ORCPT ); Fri, 4 Sep 2015 09:35:14 -0400 From: Daniel Wagner To: linux-kernel@vger.kernel.org Cc: Daniel Wagner , Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-edac@vger.kernel.org Subject: [RFC v0 3/9] x86: Use freeze_active() instead of CPU_*_FROZEN Date: Fri, 4 Sep 2015 15:34:56 +0200 Message-Id: <1441373702-31796-4-git-send-email-daniel.wagner@bmw-carit.de> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1441373702-31796-1-git-send-email-daniel.wagner@bmw-carit.de> References: <1441373702-31796-1-git-send-email-daniel.wagner@bmw-carit.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Tony Luck Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" 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 #include #include +#include #include #include #include @@ -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 #include #include +#include #include #include #include @@ -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