Commit:     bae19fe033b0c5ed99b1ed27a4cce84625a24606
Parent:     77f2878b4f78c0b29c4a2580665a446c77901152
Author:     Andreas Herrmann <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 14 17:00:44 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Nov 14 18:45:44 2007 -0800

    x86: don't call mce_create_device on CPU_UP_PREPARE
    Fix regression introduced with d435d862baca3e25e5eec236762a43251b1e7ffc
    ("cpu hotplug: mce: fix cpu hotplug error handling").
    A CPU which was not brought up during boot (using maxcpus and
    additional_cpus parameters) couldn't be onlined anymore.  For such a CPU it
    seemed that MCE was not supported during CPU_UP_PREPARE-time which caused
    mce_cpu_callback to return NOTIFY_BAD to notifier_call_chain.  To fix this
     - call mce_create_device for CPU_ONLINE event (instead of CPU_UP_PREPARE),
     - avoid mce_remove_device() for the CPU that is not correctly initialized
       by mce_create_device() failure,
     - make mce_cpu_callback always return NOTIFY_OK for CPU_ONLINE event.
       Because CPU_ONLINE callback return value is always ignored.
    [EMAIL PROTECTED]: avoid mce_remove_device() for not initialized device]
    [EMAIL PROTECTED]: make mce_cpu_callback always return NOTIFY_OK]
    Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>
    Signed-off-by: Andreas Herrmann <[EMAIL PROTECTED]>
    Cc: Thomas Gleixner <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 arch/x86/kernel/cpu/mcheck/mce_64.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c 
index b9f802e..447b351 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -802,6 +802,8 @@ static struct sysdev_attribute *mce_attributes[] = {
+static cpumask_t mce_device_initialized = CPU_MASK_NONE;
 /* Per cpu sysdev init.  All of the cpus still share the same ctl bank */
 static __cpuinit int mce_create_device(unsigned int cpu)
@@ -825,6 +827,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
                if (err)
                        goto error;
+       cpu_set(cpu, mce_device_initialized);
        return 0;
@@ -841,10 +844,14 @@ static void mce_remove_device(unsigned int cpu)
        int i;
+       if (!cpu_isset(cpu, mce_device_initialized))
+               return;
        for (i = 0; mce_attributes[i]; i++)
+       cpu_clear(cpu, mce_device_initialized);
 /* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -852,21 +859,18 @@ static int
 mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
        unsigned int cpu = (unsigned long)hcpu;
-       int err = 0;
        switch (action) {
-       case CPU_UP_PREPARE:
-               err = mce_create_device(cpu);
+       case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
+               mce_create_device(cpu);
-       case CPU_UP_CANCELED:
        case CPU_DEAD:
        case CPU_DEAD_FROZEN:
-       return err ? NOTIFY_BAD : NOTIFY_OK;
+       return NOTIFY_OK;
 static struct notifier_block mce_cpu_notifier = {
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to