Re: [PATCH v4 01/13] objtool: Remove CFI save/restore special case
From: Peter Zijlstra
Date: Mon Mar 30 2020 - 16:29:36 EST
On Mon, Mar 30, 2020 at 10:02:54PM +0200, Peter Zijlstra wrote:
> On Mon, Mar 30, 2020 at 02:02:05PM -0500, Josh Poimboeuf wrote:
> > However sync_core() and ftrace_regs_caller() are very different from
> > each other and I find the RET_TAIL hint usage to be extremely confusing.
>
> I was going with the pattern:
>
> push target
> ret
>
> which is an indirect tail-call that doesn't need a register. We use it
> in various places. We use it here exactly because it preserves all
> registers, but we use it in function-graph tracer and retprobes to
> insert the return handler. But also in retpoline, because it uses the
> return stack predictor, which by happy accident isn't the indirect
> branch predictor.
>
> > For example, IRETQ isn't even a tail cail.
>
> It's the same indirect call, except with a bigger frame ;-)
>
> push # ss
> push # rsp
> push # flags
> push # cs
> push # ip
> iret
>
> > And the need for the hint to come *before* the insn which changes the
> > state is different from the other hints.
>
> makes sense to me... but yah.
Also, naturally, there are no instructions after RET to stick the
annotation to.