Re: [PATCH] x86/mce: Don't unregister CPU hotplug notifier in error path

From: Borislav Petkov
Date: Fri Jun 20 2014 - 16:29:16 EST


On Fri, Jun 20, 2014 at 04:16:50PM -0400, Boris Ostrovsky wrote:
> Sorry, mce_device_create().
>
> We can't call it in the notifier until mcheck_init_device() has been
> successfully executed (we need subsys_system_register(&mce_subsys)). I don't
> know whether we can call subsys_system_register() in mcheck_init() -- it is
> quite early in the boot.

I don't think it matters: we want to add only this oneliner to
mcheck_init():

__register_hotcpu_notifier(&mce_cpu_notifier);

and remove it from mcheck_init_device(), nothing else. And we don't need
the synchronization even because we're BSP only then.

I mean, we won't be able to offline CPUs that early anyway - thus
call mce_device_create() in the notifier callback - as we don't have
userspace to do "echo 0 > ..."

The rest of the code remains and mcheck_init_device() executes when it
does. Unless I'm missing something, of course...

Oh, not quite. We probably should remove the

__unregister_hotcpu_notifier(&mce_cpu_notifier);

from the error path too, as you suggest.

When you do, please hold that down in the commit message so that it is
clear what we're doing.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/