From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Jason Baron <jbaron@akamai.com>, Nadav Amit <namit@vmware.com>,
Andy Lutomirski <luto@kernel.org>,
Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
Vineet Gupta <Vineet.Gupta1@synopsys.com>
Subject: [RFC][PATCH 4/8] jump_label, x86: Remove init NOP optimization
Date: Fri, 28 Jun 2019 12:21:17 +0200 [thread overview]
Message-ID: <20190628103224.659817235@infradead.org> (raw)
In-Reply-To: 20190628102113.360432762@infradead.org
Instead of checking if the emitted (default) NOP is the ideal NOP, and
conditionally rewrite the NOP, just rewrite the NOP.
This shouldn't be a problem because init / module_load uses
text_poke_early() which is cheap and this saves us from having to go
figure out which NOP to compare against when we go variable size.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/kernel/jump_label.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -177,21 +177,10 @@ __init_or_module void arch_jump_label_tr
enum jump_label_type type)
{
/*
- * This function is called at boot up and when modules are
- * first loaded. Check if the default nop, the one that is
- * inserted at compile time, is the ideal nop. If it is, then
- * we do not need to update the nop, and we can leave it as is.
- * If it is not, then we need to update the nop to the ideal nop.
+ * Rewrite the NOP on init / module-load to ensure we got the ideal
+ * nop. Don't bother with trying to figure out what size and what nop
+ * it should be for now, simply do an unconditional rewrite.
*/
- if (jlstate == JL_STATE_START) {
- const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
- const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5];
-
- if (memcmp(ideal_nop, default_nop, 5) != 0)
- jlstate = JL_STATE_UPDATE;
- else
- jlstate = JL_STATE_NO_UPDATE;
- }
- if (jlstate == JL_STATE_UPDATE)
+ if (jlstate == JL_STATE_UPDATE || jlstate == JL_STATE_START)
__jump_label_transform(entry, type, 1);
}
next prev parent reply other threads:[~2019-06-28 13:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 10:21 [RFC][PATCH 0/8] jump_label, x86: Support variable sized JMP instructions Peter Zijlstra
2019-06-28 10:21 ` [RFC][PATCH 1/8] x86/alternatives: Teach text_poke_bp() to emulate instructions Peter Zijlstra
2019-06-28 10:21 ` [RFC][PATCH 2/8] jump_label, x86: Strip ASM jump_label support Peter Zijlstra
2019-06-28 10:21 ` [RFC][PATCH 3/8] jump_label, x86: Factor out the __jump_table generation Peter Zijlstra
2019-06-28 10:21 ` Peter Zijlstra [this message]
2019-06-28 10:21 ` [RFC][PATCH 5/8] jump_label, x86: Improve error when we fail expected text Peter Zijlstra
2019-06-28 10:21 ` [RFC][PATCH 6/8] jump_label, x86: Add variable length patching support Peter Zijlstra
2019-06-28 10:21 ` [RFC][PATCH 7/8] jump_label, x86: Introduce jump_entry_size() Peter Zijlstra
2019-06-28 10:21 ` [RFC][PATCH 8/8] jump_label, x86: Enable JMP8/NOP2 support Peter Zijlstra
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=20190628103224.659817235@infradead.org \
--to=peterz@infradead.org \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=bristot@redhat.com \
--cc=jbaron@akamai.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhiramat@kernel.org \
--cc=namit@vmware.com \
--cc=rostedt@goodmis.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.