An error occurred while fetching folder content.
x86: microcode: use smp_call_function_single instead of set_cpus_allowed,...
Dmitry Adamushko authored
x86: microcode: use smp_call_function_single instead of set_cpus_allowed, cleanup of synchronization logic

* Solve issues described in 6f66cbc6
  in a way that doesn't resort to set_cpus_allowed();

* in fact, only collect_cpu_info and apply_microcode callbacks
  must run on a target cpu, others will do just fine on any other.
  smp_call_function_single() (as suggested by Ingo) is used to run
  these callbacks on a target cpu.

* cleanup of synchronization logic of the 'microcode_core' part

  The generic 'microcode_core' part guarantees that only a single cpu
  (be it a full-fledged cpu, one of the cores or HT)
  is being updated at any particular moment of time.

  In general, there is no need for any additional sync. mechanism in
  arch-specific parts (the patch removes existing spinlocks).

  See also the "Synchronization" section in microcode_core.c.

* return -EINVAL instead of -1 (which is translated into -EPERM) in
  microcode_write(), reload_cpu() and mc_sysdev_add(). Other suggestions
  for an error code?

* use 'enum ucode_state' as return value of request_microcode_{fw, user}
  to gain more flexibility by distinguishing between real error cases
  and situations when an appropriate ucode was not found (which is not an
  error per-se).

* some minor cleanups

Thanks a lot to Hugh Dickins for review/suggestions/testing!

   Reference: http://marc.info/?l=linux-kernel&m=124025889012541&w=2



[ Impact: refactor and clean up microcode driver locking code ]
Signed-off-by: default avatarDmitry Adamushko <dmitry.adamushko@gmail.com>
Acked-by: default avatarHugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Peter Oruba <peter.oruba@amd.com>
Cc: Arjan van de Ven <arjan@infradead.org>
LKML-Reference: <1242078507.5560.9.camel@earth>
[ did some more cleanups ]
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
 arch/x86/include/asm/microcode.h  |   25 ++
 arch/x86/kernel/microcode_amd.c   |   58 ++----
 arch/x86/kernel/microcode_core.c  |  326 +++++++++++++++++++++-----------------
 arch/x86/kernel/microcode_intel.c |   92 +++-------
 4 files changed, 261 insertions(+), 240 deletions(-)

(~20 new comment lines)
871b72dd
Name Last commit Last update
..
uv x86: UV BAU messaging timeouts
visws x86: drop double underscores from header guards
xen Xen: Add virt_to_pfn helper function
Kbuild byteorder: make swab.h include asm/swab.h like a regular header
a.out-core.h x86: add %gs accessors for x86_32
a.out.h x86: Fix ASM_X86__ header guards
acpi.h x86: use early_ioremap in __acpi_map_table
aes.h crypto: aes - Export x86 AES encrypt/decrypt functions
agp.h x86: Fix ASM_X86__ header guards
alternative-asm.h x86, um: ... and asm-x86 move
alternative.h x86: Fix ASM_X86__ header guards
amd_iommu.h x86: Fix ASM_X86__ header guards
amd_iommu_types.h AMD IOMMU: add init code for statistic collection
apic.h x2apic/intr-remap: decouple interrupt remapping from x2apic
apicdef.h x86, mce, cmci: define MSR names and fields for new CMCI registers
apicnum.h irq: initialize nr_irqs based on nr_cpu_ids
apm.h x86: move mach-default/*.h files to asm/
asm.h x86: Fix ASM_X86__ header guards
atomic.h x86, um: ... and asm-x86 move
atomic_32.h atomic_t: unify all arch definitions
atomic_64.h atomic_t: unify all arch definitions
auxvec.h x86: Fix ASM_X86__ header guards
bios_ebda.h x86: Fix ASM_X86__ header guards
bitops.h x86, generic: mark complex bitops.h inlines as __always_inline
boot.h x86: remove zImage support
bootparam.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
calgary.h
calling.h
checksum.h
checksum_32.h
checksum_64.h
cmpxchg.h
cmpxchg_32.h
cmpxchg_64.h
compat.h
cpu.h
cpu_debug.h
cpufeature.h
cpumask.h
cputime.h
current.h
debugreg.h
delay.h
desc.h
desc_defs.h
device.h
div64.h
dma-mapping.h
dma.h
dmi.h
do_timer.h
ds.h
dwarf2.h
e820.h
edac.h
efi.h
elf.h
emergency-restart.h
entry_arch.h
errno.h
fb.h
fcntl.h
fixmap.h
floppy.h
frame.h
ftrace.h
futex.h
gart.h
genapic.h
geode.h
gpio.h
hardirq.h
highmem.h
hpet.h
hugetlb.h
hw_irq.h
hypertransport.h
hypervisor.h
i387.h
i8253.h
i8259.h
ia32.h
ia32_unistd.h
idle.h
init.h
intel_arch_perfmon.h
io.h
io_32.h
io_64.h
io_apic.h
ioctl.h
ioctls.h
iomap.h
iommu.h
ipcbuf.h