mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/microcode: Remove microcode_mutex.
@ 2023-08-03  8:32 Sebastian Andrzej Siewior
  2023-08-03 21:15 ` Sohil Mehta
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2023-08-03  8:32 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: H. Peter Anvin, Borislav Petkov, Dave Hansen, Ingo Molnar,
	Thomas Gleixner

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@linutronix.de>
---
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-08 21:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03  8:32 [PATCH] x86/microcode: Remove microcode_mutex Sebastian Andrzej Siewior
2023-08-03 21:15 ` Sohil Mehta
2023-08-04  7:55   ` Sebastian Andrzej Siewior
2023-08-04  7:58     ` [PATCH v2] " Sebastian Andrzej Siewior
2023-08-04 16:23       ` Sohil Mehta
2023-08-08 17:14       ` [tip: x86/microcode] " tip-bot2 for Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®