EDAC, mce_amd_inj: Move bit preparations before the injection
authorBorislav Petkov <bp@suse.de>
Wed, 10 Jun 2015 14:17:13 +0000 (16:17 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 24 Jun 2015 16:17:37 +0000 (18:17 +0200)
We do get_online_cpus() and then start noodling with the bits. Do that
*before* we grab the hotplug lock.

Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/mce_amd_inj.c

index bfb0f350cb0ebb31f91001fc89f3b539baa66755..b92986b03f93300de106d9207adde1a086e23fc2 100644 (file)
@@ -196,16 +196,16 @@ static void do_inject(void)
                return;
        }
 
-       get_online_cpus();
-       if (!cpu_online(cpu))
-               goto err;
-
        /* prep MCE global settings for the injection */
        mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV;
 
        if (!(i_mce.status & MCI_STATUS_PCC))
                mcg_status |= MCG_STATUS_RIPV;
 
+       get_online_cpus();
+       if (!cpu_online(cpu))
+               goto err;
+
        toggle_hw_mce_inject(cpu, true);
 
        wrmsr_on_cpu(cpu, MSR_IA32_MCG_STATUS,