On Wed, 7 Jan 2026 10:32:55 +0100 Jiri Olsa <[email protected]> wrote:
> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h > index 1621c84f44b3..177c7bbf3b84 100644 > --- a/arch/arm64/include/asm/ftrace.h > +++ b/arch/arm64/include/asm/ftrace.h > @@ -157,6 +157,30 @@ ftrace_partial_regs(const struct ftrace_regs *fregs, > struct pt_regs *regs) > return regs; > } > See my reply in the other email thread: https://lore.kernel.org/all/[email protected]/ -- Steve > +/* > + * ftrace_partial_regs_update - update the original ftrace_regs from regs > + * @fregs: The ftrace_regs to update from @regs > + * @regs: The partial regs from ftrace_partial_regs() that was updated > + * > + * Some architectures have the partial regs living in the ftrace_regs > + * structure, whereas other architectures need to make a different copy > + * of the @regs. If a partial @regs is retrieved by ftrace_partial_regs() and > + * if the code using @regs updates a field (like the instruction pointer or > + * stack pointer) it may need to propagate that change to the original @fregs > + * it retrieved the partial @regs from. Use this function to guarantee that > + * update happens. > + */ > +static __always_inline void > +ftrace_partial_regs_update(const struct ftrace_regs *fregs, struct pt_regs > *regs) > +{ > + struct __arch_ftrace_regs *afregs = arch_ftrace_regs(fregs); > + > + if (afregs->pc != regs->pc) { > + afregs->pc = regs->pc; > + afregs->regs[0] = regs->regs[0]; > + } > +}
