mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
To: linux-kernel@vger.kernel.org
Cc: Daniel Wagner <daniel.wagner@bmw-carit.de>,
	Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	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	[thread overview]
Message-ID: <1441373702-31796-4-git-send-email-daniel.wagner@bmw-carit.de> (raw)
In-Reply-To: <1441373702-31796-1-git-send-email-daniel.wagner@bmw-carit.de>

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


  parent reply	other threads:[~2015-09-04 13:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04 13:34 [RFC v0 0/9] Remove CPU_*_FROZEN Daniel Wagner
2015-09-04 13:34 ` [RFC v0 1/9] smpboot: Add a separate CPU state when a surviving CPU times out Daniel Wagner
2015-09-04 13:34 ` [RFC v0 2/9] suspend: Add getter function to report if freezing is active Daniel Wagner
2015-09-05  2:11   ` Rafael J. Wysocki
2015-09-07  8:55     ` Daniel Wagner
2015-09-07 13:42       ` Rafael J. Wysocki
2015-09-07 21:44       ` Rafael J. Wysocki
2015-09-08  8:19         ` Daniel Wagner
2015-09-04 13:34 ` Daniel Wagner [this message]
2015-09-04 13:34 ` [RFC v0 4/9] smpboot: Use freeze_active() instead CPU_DEAD_FROZEN state information Daniel Wagner
2015-09-08  8:49   ` Daniel Wagner
2015-09-04 13:34 ` [RFC v0 5/9] sched: Use freeze_active() instead CPU_*_FROZEN " Daniel Wagner
2015-09-04 13:34 ` [RFC v0 6/9] cpu: Restructure FROZEN state handling Daniel Wagner
2015-09-04 13:35 ` [RFC v0 7/9] cpu: Remove unused CPU_*_FROZEN states Daniel Wagner
2015-09-04 13:35 ` [RFC v0 8/9] cpu: Do not set CPU_TASKS_FROZEN anymore Daniel Wagner
2015-09-04 13:35 ` [RFC v0 9/9] doc: Update cpu-hotplug documents on removal of CPU_TASKS_FROZEN Daniel Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441373702-31796-4-git-send-email-daniel.wagner@bmw-carit.de \
    --to=daniel.wagner@bmw-carit.de \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®