[PW_SID:1122351] riscv: ftrace: only use pre-function NOPs with call ops#2226
[PW_SID:1122351] riscv: ftrace: only use pre-function NOPs with call ops#2226linux-riscv-bot wants to merge 2 commits into
Conversation
Commit c217157 ("riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS") changed CC_FLAGS_FTRACE to use -fpatchable-function-entry=8,4 or -fpatchable-function-entry=4,2 for all dynamic ftrace builds. That layout makes the compiler place an 8-byte area before the function entry, which is used as the per-callsite ftrace_ops literal when CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS is enabled. RISC-V can still build with CONFIG_DYNAMIC_FTRACE=y and CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS=n, for example when CONFIG_CFI_CLANG is enabled because HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS is selected only when !CFI_CLANG. In that configuration ftrace_call_adjust() does not skip the pre-function literal area and only returns addr + MCOUNT_AUIPC_SIZE. With the pre-function layout, that points into the pre-entry padding instead of the callsite jalr, so dynamic ftrace records the wrong patch address. Use the pre-function literal layout only when call ops are enabled. Otherwise keep the previous patchable-function-entry counts so the recorded address matches ftrace_call_adjust() non-call-ops path. Fixes: c217157 ("riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS") Cc: stable@vger.kernel.org Signed-off-by: Rui Qi <qirui.001@bytedance.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
|
Patch 1: "riscv: ftrace: only use pre-function NOPs with call ops" |
869345e to
f54dc6c
Compare
PR for series 1122351 applied to workflow__riscv__fixes
Name: riscv: ftrace: only use pre-function NOPs with call ops
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1122351
Version: 1