Re: [PATCH v5 05/12] x86/retpoline/ftrace: Convert ftrace assembler indirect jumps

From: Thomas Gleixner
Date: Sat Jan 06 2018 - 14:53:57 EST


On Sat, 6 Jan 2018, Linus Torvalds wrote:

> On Sat, Jan 6, 2018 at 3:49 AM, David Woodhouse <dwmw@xxxxxxxxxxxx> wrote:
> >
> > - call *ftrace_trace_function
> > + movl ftrace_trace_function, %ecx
> > + NOSPEC_CALL %ecx
>
> Can't we just do
>
> NOSPEC_CALL ftrace_trace_function
>
> now?
>
> [ Goes off and looks ]
>
> Oh. The AMD lfence version wants a register. Oh well.

The register load could be put into the macro itself, though we need to
supply a scratch register

NOSPEC_CALL ftrace_trace_function scratch_reg=%ecx

Whether thats much better, I don't know.

Thanks,

tglx