From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965856AbcKJRqf (ORCPT ); Thu, 10 Nov 2016 12:46:35 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:34015 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965761AbcKJRqe (ORCPT ); Thu, 10 Nov 2016 12:46:34 -0500 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, rt@linutronix.de, Sebastian Andrzej Siewior , Tony Luck , Borislav Petkov , linux-edac@vger.kernel.org, x86@kernel.org Subject: [PATCH 7/7] x86/mcheck: Move CPU_DEAD to hotplug state machine Date: Thu, 10 Nov 2016 18:44:47 +0100 Message-Id: <20161110174447.11848-8-bigeasy@linutronix.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161110174447.11848-1-bigeasy@linutronix.de> References: <20161110091809.vxyf3yiuxtjy3vqv@pd.tnic> <20161110174447.11848-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This moves the last piece of the old hotplug notifier code in MCE to the new hotplug state machine. Cc: Tony Luck Cc: Borislav Petkov Cc: linux-edac@vger.kernel.org Cc: x86@kernel.org Signed-off-by: Sebastian Andrzej Siewior --- arch/x86/kernel/cpu/mcheck/mce.c | 42 ++++++++++++++----------------------= ---- include/linux/cpuhotplug.h | 1 + 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/= mce.c index 444177cafb65..d31e3a7d8866 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -2501,26 +2501,14 @@ static void mce_reenable_cpu(void) } } =20 -/* Get notified when a cpu comes on/off. Be hotplug friendly. */ -static int -mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *h= cpu) +static int mce_cpu_dead(unsigned int cpu) { - unsigned int cpu =3D (unsigned long)hcpu; + mce_intel_hcpu_update(cpu); =20 - switch (action & ~CPU_TASKS_FROZEN) { - case CPU_DEAD: - mce_intel_hcpu_update(cpu); - - /* intentionally ignoring frozen here */ - if (!(action & CPU_TASKS_FROZEN)) - cmci_rediscover(); - break; - case CPU_DOWN_PREPARE: - - break; - } - - return NOTIFY_OK; + /* intentionally ignoring frozen here */ + if (!cpuhp_tasks_frozen) + cmci_rediscover(); + return 0; } =20 static int mce_cpu_online(unsigned int cpu) @@ -2551,10 +2539,6 @@ static int mce_cpu_pre_down(unsigned int cpu) return 0; } =20 -static struct notifier_block mce_cpu_notifier =3D { - .notifier_call =3D mce_cpu_callback, -}; - static __init void mce_init_banks(void) { int i; @@ -2594,16 +2578,17 @@ static __init int mcheck_init_device(void) if (err) goto err_out_mem; =20 + err =3D cpuhp_setup_state(CPUHP_X86_MCE_DEAD, "x86/mce:dead", NULL, + mce_cpu_dead); + if (err) + goto err_out_mem; + err =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/mce:online", mce_cpu_online, mce_cpu_pre_down); if (err < 0) - goto err_out_mem; + goto err_out_online; hp_online =3D err; =20 - cpu_notifier_register_begin(); - __register_hotcpu_notifier(&mce_cpu_notifier); - cpu_notifier_register_done(); - register_syscore_ops(&mce_syscore_ops); =20 /* register character device /dev/mcelog */ @@ -2617,6 +2602,9 @@ static __init int mcheck_init_device(void) unregister_syscore_ops(&mce_syscore_ops); cpuhp_remove_state(hp_online); =20 +err_out_online: + cpuhp_remove_state(CPUHP_X86_MCE_DEAD); + err_out_mem: free_cpumask_var(mce_device_initialized); =20 diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 3410d83cc2e2..79b96f647d64 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -16,6 +16,7 @@ enum cpuhp_state { CPUHP_PERF_SUPERH, CPUHP_X86_HPET_DEAD, CPUHP_X86_APB_DEAD, + CPUHP_X86_MCE_DEAD, CPUHP_VIRT_NET_DEAD, CPUHP_SLUB_DEAD, CPUHP_MM_WRITEBACK_DEAD, --=20 2.10.2