[PATCH] x86/microcode: Remove microcode_mutex.

From: Sebastian Andrzej Siewior
Date: Thu Aug 03 2023 - 04:35:59 EST


microcode_mutex is only used by reload_store(). It has a comment saying
"to synchronize with each other". This probably means the sysfs
interface vs the legacy interface which was removed in commit
181b6f40e9ea8 ("x86/microcode: Rip out the OLD_INTERFACE").

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 superfluous microcode_mutex.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
This poped up as "defined but not used" on RT builds without
CONFIG_MICROCODE_LATE_LOADING enabled.

arch/x86/kernel/cpu/microcode/core.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 3afcf3de0dd49..2f9d35744bc41 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -54,15 +54,12 @@ LIST_HEAD(microcode_cache);
*
* All non cpu-hotplug-callback call sites use:
*
- * - microcode_mutex to synchronize with each other;
* - cpus_read_lock/unlock() to synchronize with
* the cpu-hotplug-callback call sites.
*
* We guarantee that only a single cpu is being
* updated at any particular moment of time.
*/
-static DEFINE_MUTEX(microcode_mutex);
-
struct ucode_cpu_info ucode_cpu_info[NR_CPUS];

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

- mutex_lock(&microcode_mutex);
ret = microcode_reload_late();
- mutex_unlock(&microcode_mutex);
-
put:
cpus_read_unlock();

--
2.40.1