diff options
author | Benjamin Gray <bgray@linux.ibm.com> | 2024-05-15 05:44:41 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2024-08-21 13:15:12 +0300 |
commit | e6b8940e7e80cdfe98ba8493214922998920dd9c (patch) | |
tree | a119cdae4ded82a1736c23ee25e27bdf3c423537 /arch/powerpc/include/asm/vdso.h | |
parent | a540ad3e386f8f84bc6d600b93792a50861a81ef (diff) | |
download | linux-e6b8940e7e80cdfe98ba8493214922998920dd9c.tar.xz |
powerpc/code-patching: Add generic memory patching
patch_instruction() is designed for patching instructions in otherwise
readonly memory. Other consumers also sometimes need to patch readonly
memory, so have abused patch_instruction() for arbitrary data patches.
This is a problem on ppc64 as patch_instruction() decides on the patch
width using the 'instruction' opcode to see if it's a prefixed
instruction. Data that triggers this can lead to larger writes, possibly
crossing a page boundary and failing the write altogether.
Introduce patch_uint(), and patch_ulong(), with aliases patch_u32(), and
patch_u64() (on ppc64) designed for aligned data patches. The patch
size is now determined by the called function, and is passed as an
additional parameter to generic internals.
While the instruction flushing is not required for data patches, it
remains unconditional in this patch. A followup series is possible if
benchmarking shows fewer flushes gives an improvement in some
data-patching workload.
ppc32 does not support prefixed instructions, so is unaffected by the
original issue. Care is taken in not exposing the size parameter in the
public (non-static) interface, so the compiler can const-propagate it
away.
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240515024445.236364-2-bgray@linux.ibm.com
Diffstat (limited to 'arch/powerpc/include/asm/vdso.h')
0 files changed, 0 insertions, 0 deletions