x86/microcode: Rip out the subsys interface gunk
authorBorislav Petkov <bp@suse.de>
Wed, 19 Oct 2022 16:13:06 +0000 (18:13 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 2 Nov 2022 15:45:46 +0000 (16:45 +0100)
commitb6f86689d5b740f2cc3ac3a1032c7374b24381cc
tree89334c4b9e36b365c56344042c6ea06a37ca85a2
parent9abf2313adc1ca1b6180c508c25f22f9395cc780
x86/microcode: Rip out the subsys interface gunk

This is a left-over from the old days when CPU hotplug wasn't as robust
as it is now. Currently, microcode gets loaded early on the CPU init
path and there's no need to attempt to load it again, which that subsys
interface callback is doing.

The only other thing that the subsys interface init path was doing is
adding the

  /sys/devices/system/cpu/cpu*/microcode/

hierarchy.

So add a function which gets called on each CPU after all the necessary
driver setup has happened. Use schedule_on_each_cpu() which can block
because the sysfs creating code does kmem_cache_zalloc() which can block
too and the initial version of this where it did that setup in an IPI
handler of on_each_cpu() can cause a deadlock of the sort:

  lock(fs_reclaim);
  <Interrupt>
    lock(fs_reclaim);

as the IPI handler runs in IRQ context.

Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Ashok Raj <ashok.raj@intel.com>
Link: https://lore.kernel.org/r/20221028142638.28498-2-bp@alien8.de
arch/x86/kernel/cpu/microcode/core.c