From: David Kaplan <david.kaplan@amd.com>
To: Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Jason Baron <jbaron@akamai.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ard Biesheuvel <ardb@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86/static_call: Remove text_mutex from __static_call_fixup()
Date: Thu, 6 Nov 2025 11:53:20 -0600 [thread overview]
Message-ID: <20251106175320.2745006-1-david.kaplan@amd.com> (raw)
__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@amd.com>
---
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
next reply other threads:[~2025-11-06 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 17:53 David Kaplan [this message]
2025-12-10 4:54 ` Borislav Petkov
2025-12-10 21:39 ` Kaplan, David
2025-12-18 19:19 ` Kaplan, David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251106175320.2745006-1-david.kaplan@amd.com \
--to=david.kaplan@amd.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®