From: Benjamin Gray <bgray@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: erhard_f@mailbox.org, npiggin@gmail.com,
Benjamin Gray <bgray@linux.ibm.com>
Subject: [PATCH 0/3] Add generic data patching functions
Date: Tue, 7 Feb 2023 12:56:40 +1100 [thread overview]
Message-ID: <20230207015643.590684-1-bgray@linux.ibm.com> (raw)
There are issues on ppc64 with using patch_instruction() for arbitrary data.
Add dedicated functions for patching data. More details in the first patch.
Just to explain a couple of quirks:
* ppc32 patch_instruction() is noinline to prevent a mis-optimisation where
patch_memory() is inlined into patch_branch(), preventing it from being
inlined into patch_instruction().
* The val32 variable is a big endian workaround. The alternative would be to
pass the data indirectly through a void*, which would probably not optimise
as well.
* IS_ENABLED(CONFIG_PPC64) is required to help the ppc32 code optimise out
the is_dword param.
Benjamin Gray (3):
powerpc/code-patching: Add generic memory patching
powerpc/64: Convert patch_instruction() to patch_u32()
powerpc/32: Convert patch_instruction() to patch_uint()
arch/powerpc/include/asm/code-patching.h | 33 ++++++++++++
arch/powerpc/kernel/module_64.c | 5 +-
arch/powerpc/kernel/static_call.c | 2 +-
arch/powerpc/lib/code-patching.c | 69 +++++++++++++++++-------
arch/powerpc/platforms/powermac/smp.c | 2 +-
5 files changed, 88 insertions(+), 23 deletions(-)
base-commit: 0bfb97203f5f300777624a2ad6f8f84aea3e8658
--
2.39.1
next reply other threads:[~2023-02-07 1:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 1:56 Benjamin Gray [this message]
2023-02-07 1:56 ` [PATCH 1/3] powerpc/code-patching: Add generic memory patching Benjamin Gray
2023-02-09 7:15 ` Christophe Leroy
2023-02-10 0:45 ` Benjamin Gray
2023-02-07 1:56 ` [PATCH 2/3] powerpc/64: Convert patch_instruction() to patch_u32() Benjamin Gray
2023-02-07 1:56 ` [PATCH 3/3] powerpc/32: Convert patch_instruction() to patch_uint() Benjamin Gray
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=20230207015643.590684-1-bgray@linux.ibm.com \
--to=bgray@linux.ibm.com \
--cc=erhard_f@mailbox.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).