- The usual round of minor cleanups and fixes

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmEsrTYACgkQEsHwGGHe
 VUqq4g/9F89bnzmeaFxt2KURuQ3iKCIZ17UcawTFNiW9hboxls1K97a3O4PEy3f9
 ulu4PinW7SE+UnlWVTByvAGf4s+qUW7Jrznnr4yMHLAT4LnMdcwBaB3BQDrdKf+R
 E4QYp9G/LM/f+v4uRhGpd0vvZMwgW3HPGCpS87+IJKrSer8dqgy8GV8IFVZQCYlj
 c/GL67M7o6L9lB5l9yfWneokhBcNLXuqW8hrrEcHem3RYv5JUQ+YKzycS1spxPjb
 rhl+yB6dM92t4aitWHjyyQnzgDeIJUxRfSApDlR5BgzGv2xgmaslvYBln9+Jefv6
 pA+NSp/mYfgK829JvTWWIhznDwC7svMN7iMZQwik0gNR2/iWNWCVqspvszzYfKud
 +ZCCTtFVeijHFBjhviLE635bsrQr3NvmuM/X6PQbNu6g5ts4yPnkF6PxvVnalv4p
 SvnKLOLmevozlyE2Iv/HyF/Ky09j94wxeBx+IsMQ1mvXaKpi4S8x3Qhn37Sx1jiI
 Q97SQv+JxKil5SLrQZSLPhTFfmGLt+iY+DwdkwmtpYJaOBIsB6mIPH6KWp9Jhdcp
 QPoawuFrbRW7TcHdFFq5rVgfYmZ3gsEHAsCYk2xu4vIr7D/QZKDIa+GaCkua0NOI
 jZoRmLejY1IXG0IbysYgJxVVq9+3uRzAbfgat/dDmg/+Y7NCbwo=
 =bPrc
 -----END PGP SIGNATURE-----

Merge tag 'x86_cleanups_for_v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cleanups from Borislav Petkov:
 "The usual round of minor cleanups and fixes"

* tag 'x86_cleanups_for_v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/kaslr: Have process_mem_region() return a boolean
  x86/power: Fix kernel-doc warnings in cpu.c
  x86/mce/inject: Replace deprecated CPU-hotplug functions.
  x86/microcode: Replace deprecated CPU-hotplug functions.
  x86/mtrr: Replace deprecated CPU-hotplug functions.
  x86/mmiotrace: Replace deprecated CPU-hotplug functions.
This commit is contained in:
Linus Torvalds 2021-08-30 13:35:36 -07:00
commit 230bda0873
6 changed files with 36 additions and 35 deletions

View File

@ -668,7 +668,7 @@ static bool process_mem_region(struct mem_vector *region,
if (slot_area_index == MAX_SLOT_AREA) { if (slot_area_index == MAX_SLOT_AREA) {
debug_putstr("Aborted e820/efi memmap scan when walking immovable regions(slot_areas full)!\n"); debug_putstr("Aborted e820/efi memmap scan when walking immovable regions(slot_areas full)!\n");
return 1; return true;
} }
} }
#endif #endif

View File

@ -235,7 +235,7 @@ static void __maybe_unused raise_mce(struct mce *m)
unsigned long start; unsigned long start;
int cpu; int cpu;
get_online_cpus(); cpus_read_lock();
cpumask_copy(mce_inject_cpumask, cpu_online_mask); cpumask_copy(mce_inject_cpumask, cpu_online_mask);
cpumask_clear_cpu(get_cpu(), mce_inject_cpumask); cpumask_clear_cpu(get_cpu(), mce_inject_cpumask);
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
@ -269,7 +269,7 @@ static void __maybe_unused raise_mce(struct mce *m)
} }
raise_local(); raise_local();
put_cpu(); put_cpu();
put_online_cpus(); cpus_read_unlock();
} else { } else {
preempt_disable(); preempt_disable();
raise_local(); raise_local();
@ -529,7 +529,7 @@ static void do_inject(void)
cpu = get_nbc_for_node(topology_die_id(cpu)); cpu = get_nbc_for_node(topology_die_id(cpu));
} }
get_online_cpus(); cpus_read_lock();
if (!cpu_online(cpu)) if (!cpu_online(cpu))
goto err; goto err;
@ -553,7 +553,7 @@ static void do_inject(void)
} }
err: err:
put_online_cpus(); cpus_read_unlock();
} }

View File

@ -55,7 +55,7 @@ LIST_HEAD(microcode_cache);
* All non cpu-hotplug-callback call sites use: * All non cpu-hotplug-callback call sites use:
* *
* - microcode_mutex to synchronize with each other; * - microcode_mutex to synchronize with each other;
* - get/put_online_cpus() to synchronize with * - cpus_read_lock/unlock() to synchronize with
* the cpu-hotplug-callback call sites. * the cpu-hotplug-callback call sites.
* *
* We guarantee that only a single cpu is being * We guarantee that only a single cpu is being
@ -431,7 +431,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
return ret; return ret;
} }
get_online_cpus(); cpus_read_lock();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
if (do_microcode_update(buf, len) == 0) if (do_microcode_update(buf, len) == 0)
@ -441,7 +441,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
perf_check_microcode(); perf_check_microcode();
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); cpus_read_unlock();
return ret; return ret;
} }
@ -629,7 +629,7 @@ static ssize_t reload_store(struct device *dev,
if (val != 1) if (val != 1)
return size; return size;
get_online_cpus(); cpus_read_lock();
ret = check_online_cpus(); ret = check_online_cpus();
if (ret) if (ret)
@ -644,7 +644,7 @@ static ssize_t reload_store(struct device *dev,
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put: put:
put_online_cpus(); cpus_read_unlock();
if (ret == 0) if (ret == 0)
ret = size; ret = size;
@ -853,14 +853,14 @@ static int __init microcode_init(void)
if (IS_ERR(microcode_pdev)) if (IS_ERR(microcode_pdev))
return PTR_ERR(microcode_pdev); return PTR_ERR(microcode_pdev);
get_online_cpus(); cpus_read_lock();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
error = subsys_interface_register(&mc_cpu_interface); error = subsys_interface_register(&mc_cpu_interface);
if (!error) if (!error)
perf_check_microcode(); perf_check_microcode();
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); cpus_read_unlock();
if (error) if (error)
goto out_pdev; goto out_pdev;
@ -892,13 +892,13 @@ static int __init microcode_init(void)
&cpu_root_microcode_group); &cpu_root_microcode_group);
out_driver: out_driver:
get_online_cpus(); cpus_read_lock();
mutex_lock(&microcode_mutex); mutex_lock(&microcode_mutex);
subsys_interface_unregister(&mc_cpu_interface); subsys_interface_unregister(&mc_cpu_interface);
mutex_unlock(&microcode_mutex); mutex_unlock(&microcode_mutex);
put_online_cpus(); cpus_read_unlock();
out_pdev: out_pdev:
platform_device_unregister(microcode_pdev); platform_device_unregister(microcode_pdev);

View File

@ -336,7 +336,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
replace = -1; replace = -1;
/* No CPU hotplug when we change MTRR entries */ /* No CPU hotplug when we change MTRR entries */
get_online_cpus(); cpus_read_lock();
/* Search for existing MTRR */ /* Search for existing MTRR */
mutex_lock(&mtrr_mutex); mutex_lock(&mtrr_mutex);
@ -398,7 +398,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
error = i; error = i;
out: out:
mutex_unlock(&mtrr_mutex); mutex_unlock(&mtrr_mutex);
put_online_cpus(); cpus_read_unlock();
return error; return error;
} }
@ -485,7 +485,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
max = num_var_ranges; max = num_var_ranges;
/* No CPU hotplug when we change MTRR entries */ /* No CPU hotplug when we change MTRR entries */
get_online_cpus(); cpus_read_lock();
mutex_lock(&mtrr_mutex); mutex_lock(&mtrr_mutex);
if (reg < 0) { if (reg < 0) {
/* Search for existing MTRR */ /* Search for existing MTRR */
@ -520,7 +520,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
error = reg; error = reg;
out: out:
mutex_unlock(&mtrr_mutex); mutex_unlock(&mtrr_mutex);
put_online_cpus(); cpus_read_unlock();
return error; return error;
} }

View File

@ -376,12 +376,12 @@ static void enter_uniprocessor(void)
goto out; goto out;
} }
get_online_cpus(); cpus_read_lock();
cpumask_copy(downed_cpus, cpu_online_mask); cpumask_copy(downed_cpus, cpu_online_mask);
cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus); cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
if (num_online_cpus() > 1) if (num_online_cpus() > 1)
pr_notice("Disabling non-boot CPUs...\n"); pr_notice("Disabling non-boot CPUs...\n");
put_online_cpus(); cpus_read_unlock();
for_each_cpu(cpu, downed_cpus) { for_each_cpu(cpu, downed_cpus) {
err = remove_cpu(cpu); err = remove_cpu(cpu);

View File

@ -58,19 +58,20 @@ static void msr_restore_context(struct saved_context *ctxt)
} }
/** /**
* __save_processor_state - save CPU registers before creating a * __save_processor_state() - Save CPU registers before creating a
* hibernation image and before restoring the memory state from it * hibernation image and before restoring
* @ctxt - structure to store the registers contents in * the memory state from it
* @ctxt: Structure to store the registers contents in.
* *
* NOTE: If there is a CPU register the modification of which by the * NOTE: If there is a CPU register the modification of which by the
* boot kernel (ie. the kernel used for loading the hibernation image) * boot kernel (ie. the kernel used for loading the hibernation image)
* might affect the operations of the restored target kernel (ie. the one * might affect the operations of the restored target kernel (ie. the one
* saved in the hibernation image), then its contents must be saved by this * saved in the hibernation image), then its contents must be saved by this
* function. In other words, if kernel A is hibernated and different * function. In other words, if kernel A is hibernated and different
* kernel B is used for loading the hibernation image into memory, the * kernel B is used for loading the hibernation image into memory, the
* kernel A's __save_processor_state() function must save all registers * kernel A's __save_processor_state() function must save all registers
* needed by kernel A, so that it can operate correctly after the resume * needed by kernel A, so that it can operate correctly after the resume
* regardless of what kernel B does in the meantime. * regardless of what kernel B does in the meantime.
*/ */
static void __save_processor_state(struct saved_context *ctxt) static void __save_processor_state(struct saved_context *ctxt)
{ {
@ -181,9 +182,9 @@ static void fix_processor_context(void)
} }
/** /**
* __restore_processor_state - restore the contents of CPU registers saved * __restore_processor_state() - Restore the contents of CPU registers saved
* by __save_processor_state() * by __save_processor_state()
* @ctxt - structure to load the registers contents from * @ctxt: Structure to load the registers contents from.
* *
* The asm code that gets us here will have restored a usable GDT, although * The asm code that gets us here will have restored a usable GDT, although
* it will be pointing to the wrong alias. * it will be pointing to the wrong alias.