Skip to content

Commit 2e19973

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
x86/microcode: Get rid of the schedule work indirection
Scheduling work on all CPUs to collect the microcode information is just another extra step for no value. Let the CPU hotplug callback registration do it. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8529e8a commit 2e19973

File tree

1 file changed

+10
-19
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+10
-19
lines changed

arch/x86/kernel/cpu/microcode/core.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,16 @@ static struct syscore_ops mc_syscore_ops = {
481481

482482
static int mc_cpu_online(unsigned int cpu)
483483
{
484+
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
484485
struct device *dev = get_cpu_device(cpu);
485486

487+
memset(uci, 0, sizeof(*uci));
488+
489+
microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
490+
cpu_data(cpu).microcode = uci->cpu_sig.rev;
491+
if (!cpu)
492+
boot_cpu_data.microcode = uci->cpu_sig.rev;
493+
486494
if (sysfs_create_group(&dev->kobj, &mc_attr_group))
487495
pr_err("Failed to create group for CPU%d\n", cpu);
488496
return 0;
@@ -503,20 +511,6 @@ static int mc_cpu_down_prep(unsigned int cpu)
503511
return 0;
504512
}
505513

506-
static void setup_online_cpu(struct work_struct *work)
507-
{
508-
int cpu = smp_processor_id();
509-
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
510-
511-
memset(uci, 0, sizeof(*uci));
512-
513-
microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
514-
cpu_data(cpu).microcode = uci->cpu_sig.rev;
515-
if (!cpu)
516-
boot_cpu_data.microcode = uci->cpu_sig.rev;
517-
mc_cpu_online(cpu);
518-
}
519-
520514
static struct attribute *cpu_root_microcode_attrs[] = {
521515
#ifdef CONFIG_MICROCODE_LATE_LOADING
522516
&dev_attr_reload.attr,
@@ -562,12 +556,9 @@ static int __init microcode_init(void)
562556
}
563557
}
564558

565-
/* Do per-CPU setup */
566-
schedule_on_each_cpu(setup_online_cpu);
567-
568559
register_syscore_ops(&mc_syscore_ops);
569-
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "x86/microcode:online",
570-
mc_cpu_online, mc_cpu_down_prep);
560+
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/microcode:online",
561+
mc_cpu_online, mc_cpu_down_prep);
571562

572563
pr_info("Microcode Update Driver: v%s.", DRIVER_VERSION);
573564

0 commit comments

Comments
 (0)