Skip to content

Commit 80347cd

Browse files
Sebastian Andrzej Siewiorbp3tk0v
authored andcommitted
x86/microcode: Remove microcode_mutex
microcode_mutex is only used by reload_store(). It has a comment saying "to synchronize with each other". Other user of this mutex have been removed in the commits 181b6f4 ("x86/microcode: Rip out the OLD_INTERFACE"). b6f8668 ("x86/microcode: Rip out the subsys interface gunk") The sysfs interface does not need additional synchronisation vs itself because it is provided as kernfs_ops::mutex which is acquired in kernfs_fop_write_iter(). Remove the superfluous microcode_mutex. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Sohil Mehta <sohil.mehta@intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230804075853.JF_n6GXC@linutronix.de
1 parent 05e91e7 commit 80347cd

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

arch/x86/kernel/cpu/common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,8 +2276,7 @@ void store_cpu_caps(struct cpuinfo_x86 *curr_info)
22762276
* @prev_info: CPU capabilities stored before an update.
22772277
*
22782278
* The microcode loader calls this upon late microcode load to recheck features,
2279-
* only when microcode has been updated. Caller holds microcode_mutex and CPU
2280-
* hotplug lock.
2279+
* only when microcode has been updated. Caller holds and CPU hotplug lock.
22812280
*
22822281
* Return: None
22832282
*/

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,12 @@ LIST_HEAD(microcode_cache);
5454
*
5555
* All non cpu-hotplug-callback call sites use:
5656
*
57-
* - microcode_mutex to synchronize with each other;
5857
* - cpus_read_lock/unlock() to synchronize with
5958
* the cpu-hotplug-callback call sites.
6059
*
6160
* We guarantee that only a single cpu is being
6261
* updated at any particular moment of time.
6362
*/
64-
static DEFINE_MUTEX(microcode_mutex);
65-
6663
struct ucode_cpu_info ucode_cpu_info[NR_CPUS];
6764

6865
struct cpu_info_ctx {
@@ -488,10 +485,7 @@ static ssize_t reload_store(struct device *dev,
488485
if (tmp_ret != UCODE_NEW)
489486
goto put;
490487

491-
mutex_lock(&microcode_mutex);
492488
ret = microcode_reload_late();
493-
mutex_unlock(&microcode_mutex);
494-
495489
put:
496490
cpus_read_unlock();
497491

0 commit comments

Comments
 (0)