Skip to content

Commit

Permalink
x86/microcode: Allow late microcode loading with SMT disabled
Browse files Browse the repository at this point in the history
The kernel unnecessarily prevents late microcode loading when SMT is
disabled.  It should be safe to allow it if all the primary threads are
online.

Signed-off-by: Josh Poimboeuf <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
jpoimboe authored and dwmw2 committed Aug 10, 2018
1 parent e24f14b commit 07d981a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions arch/x86/kernel/cpu/microcode/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,20 @@ static struct platform_device *microcode_pdev;

static int check_online_cpus(void)
{
if (num_online_cpus() == num_present_cpus())
return 0;
unsigned int cpu;

pr_err("Not all CPUs online, aborting microcode update.\n");
/*
* Make sure all CPUs are online. It's fine for SMT to be disabled if
* all the primary threads are still online.
*/
for_each_present_cpu(cpu) {
if (topology_is_primary_thread(cpu) && !cpu_online(cpu)) {
pr_err("Not all CPUs online, aborting microcode update.\n");
return -EINVAL;
}
}

return -EINVAL;
return 0;
}

static atomic_t late_cpus_in;
Expand Down

0 comments on commit 07d981a

Please sign in to comment.