From: Borislav Petkov <bp@alien8.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
mhiramat@kernel.org, kirill.shutemov@linux.intel.com,
Andrew.Cooper3@citrix.com, jpoimboe@redhat.com
Subject: Re: [PATCH v3 2/4] x86/alternative: Support relocations in alternatives
Date: Fri, 17 Feb 2023 21:28:06 +0100 [thread overview]
Message-ID: <Y+/jVguijHJE+c/w@zn.tnic> (raw)
In-Reply-To: <20230208171431.313857925@infradead.org>
On Wed, Feb 08, 2023 at 06:10:52PM +0100, Peter Zijlstra wrote:
> /*
> + * What we start with is:
Some more clarification and de-personalization of this comment. Diff
ontop:
---
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 625f05c2b255..e14bc15bf646 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -201,15 +201,21 @@ static void __init_or_module noinline optimize_nops(u8 *instr, size_t len)
}
/*
- * What we start with is:
+ * In this context, "source" is where the instructions are placed in the
+ * section .altinstr_replacement, for example during kernel build by the
+ * toolchain.
+ * "Destination" is where the instructions are being patched in by this
+ * machinery.
+ *
+ * The source offset is:
*
* src_imm = target - src_next_ip (1)
*
- * what we want is:
+ * and the target offset is:
*
* dst_imm = target - dst_next_ip (2)
*
- * so what we do is rework (1) as an expression for target like:
+ * so rework (1) as an expression for target like:
*
* target = src_imm + src_next_ip (1a)
*
@@ -217,8 +223,8 @@ static void __init_or_module noinline optimize_nops(u8 *instr, size_t len)
*
* dst_imm = (src_imm + src_next_ip) - dst_next_ip (3)
*
- * Now, since the instruction stream is 'identical' at src and dst (we copy
- * after all) we can state that:
+ * Now, since the instruction stream is 'identical' at src and dst (it
+ * is being copied after all) it can be stated that:
*
* src_next_ip = src + ip_offset
* dst_next_ip = dst + ip_offset (4)
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2023-02-17 20:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 17:10 [PATCH v3 0/4] x86: Fully relocatable alternatives and some NOPs Peter Zijlstra
2023-02-08 17:10 ` [PATCH v3 1/4] x86/alternative: Make debug-alternative selective Peter Zijlstra
2023-02-14 11:48 ` Borislav Petkov
2023-05-13 13:03 ` [tip: x86/alternatives] " tip-bot2 for Peter Zijlstra
2023-02-08 17:10 ` [PATCH v3 2/4] x86/alternative: Support relocations in alternatives Peter Zijlstra
2023-02-17 20:28 ` Borislav Petkov [this message]
2023-02-17 22:21 ` Borislav Petkov
2023-05-13 13:03 ` [tip: x86/alternatives] " tip-bot2 for Peter Zijlstra
2023-02-08 17:10 ` [PATCH v3 3/4] x86/alternative: Rewrite optimize_nops() some Peter Zijlstra
2023-02-08 19:52 ` Andrew.Cooper3
2023-02-08 20:29 ` Peter Zijlstra
2023-02-08 20:36 ` Peter Zijlstra
2023-02-08 20:44 ` Peter Zijlstra
2023-02-08 20:45 ` Peter Zijlstra
2023-02-08 21:01 ` Peter Zijlstra
2023-02-08 21:08 ` Peter Zijlstra
2023-02-08 21:21 ` Peter Zijlstra
2023-02-09 1:11 ` Andrew.Cooper3
2023-02-09 22:27 ` David Laight
2023-02-09 1:33 ` Andrew.Cooper3
2023-02-08 23:04 ` David Laight
2023-05-13 13:03 ` [tip: x86/alternatives] " tip-bot2 for Peter Zijlstra
2023-02-27 10:49 ` [PATCH] x86/lib/memmove: Decouple ERMS from FSRM Borislav Petkov
2023-04-27 9:22 ` [PATCH TEST] " Yahu Gao
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=Y+/jVguijHJE+c/w@zn.tnic \
--to=bp@alien8.de \
--cc=Andrew.Cooper3@citrix.com \
--cc=jpoimboe@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.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 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®