[PATCH] x86/static_call: Remove text_mutex from __static_call_fixup()
From: David Kaplan
Date: Thu Nov 06 2025 - 12:53:51 EST
__static_call_fixup() is only called from apply_returns() which modifies
text either on boot when only one CPU is active, or on module load. In
both cases, it does not modify live code. This is why this function passes
'true' for the modinit argument to __static_call_transform() which causes
__static_call_transform() to use text_poke_early().
text_poke_early() does not require that the text_mutex is held, as this
function is only used when free of any races with other CPUs. Therefore
__static_call_fixup() does not need to take the mutex so remove it.
Signed-off-by: David Kaplan <david.kaplan@xxxxxxx>
---
arch/x86/kernel/static_call.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/x86/kernel/static_call.c b/arch/x86/kernel/static_call.c
index 378c388d1b31..748fc98d416f 100644
--- a/arch/x86/kernel/static_call.c
+++ b/arch/x86/kernel/static_call.c
@@ -212,10 +212,8 @@ bool __static_call_fixup(void *tramp, u8 op, void *dest)
return false;
}
- mutex_lock(&text_mutex);
if (op == RET_INSN_OPCODE || dest == &__x86_return_thunk)
__static_call_transform(tramp, RET, NULL, true);
- mutex_unlock(&text_mutex);
return true;
}
base-commit: 8411fdb92360d0b4d3337492a25ee2de7fb6c425
--
2.34.1