From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v3] ftrace/x86: Remove jumps to ftrace_epilogue and simplify trampolines
Date: Tue, 19 Jul 2022 22:30:18 +0200 [thread overview]
Message-ID: <YtcUWvm04I0ME2Rm@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220719152353.4c25e2eb@gandalf.local.home>
On Tue, Jul 19, 2022 at 03:24:05PM -0400, Steven Rostedt wrote:
> @@ -356,12 +353,6 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
> if (WARN_ON(ret < 0))
> goto fail;
>
> - ip = trampoline + size;
> - if (cpu_feature_enabled(X86_FEATURE_RETHUNK))
> - __text_gen_insn(ip, JMP32_INSN_OPCODE, ip, &__x86_return_thunk, JMP32_INSN_SIZE);
> - else
> - memcpy(ip, retq, sizeof(retq));
> -
> /* No need to test direct calls on created trampolines */
> if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
> /* NOP the jnz 1f; but make sure it's a 2 byte jnz */
> diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S
> index dfeb227de561..6294c14c51c9 100644
> --- a/arch/x86/kernel/ftrace_64.S
> +++ b/arch/x86/kernel/ftrace_64.S
> @@ -164,7 +164,7 @@ SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
> movq %rax, MCOUNT_REG_SIZE(%rsp)
>
> restore_mcount_regs
> -
> + RET
> /*
> * The code up to this label is copied into trampolines so
> * think twice before adding any new code or changing the
I like the idea, but I think this is broken. When those RETs become 'JMP
__x86_return_thunk' you can't simply copy the instruction. You also have
to fix up the relative addressing.
prev parent reply other threads:[~2022-07-19 20:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 19:24 [PATCH v3] ftrace/x86: Remove jumps to ftrace_epilogue and simplify trampolines Steven Rostedt
2022-07-19 20:30 ` Peter Zijlstra [this message]
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=YtcUWvm04I0ME2Rm@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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