Re: [RFC][PATCH 14/22] x86,ftrace: Remove .fixup usage

Peter Zijlstra
2021-11-05T08:01:05Z

On Thu, Nov 04, 2021 at 03:35:50PM -0700, Josh Poimboeuf wrote:
> On Thu, Nov 04, 2021 at 05:47:43PM +0100, Peter Zijlstra wrote:
> > Create and use EX_TYPE_ONE_REG to load 1 into the %[faulted] register
> > on exception.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> > arch/x86/include/asm/extable_fixup_types.h | 1 +
> > arch/x86/kernel/ftrace.c | 9 ++-------
> > 2 files changed, 3 insertions(+), 7 deletions(-)
> >
> > --- a/arch/x86/include/asm/extable_fixup_types.h
> > +++ b/arch/x86/include/asm/extable_fixup_types.h
> > @@ -37,5 +37,6 @@
> > #define EX_TYPE_EFAULT_REG (EX_TYPE_IMM_REG | EX_TYPE_IMM(-EFAULT))
> > #define EX_TYPE_NEG_REG (EX_TYPE_IMM_REG | EX_TYPE_IMM(-1))
> > #define EX_TYPE_ZERO_REG (EX_TYPE_IMM_REG | EX_TYPE_IMM(0))
> > +#define EX_TYPE_ONE_REG (EX_TYPE_IMM_REG | EX_TYPE_IMM(1))
> >
> > #endif
> > --- a/arch/x86/kernel/ftrace.c
> > +++ b/arch/x86/kernel/ftrace.c
> > @@ -661,13 +661,8 @@ void prepare_ftrace_return(unsigned long
> > " movl $0, %[faulted]\n"
> > "3:\n"
> >
> > - ".section .fixup, \"ax\"\n"
> > - "4: movl $1, %[faulted]\n"
> > - " jmp 3b\n"
> > - ".previous\n"
> > -
> > - _ASM_EXTABLE(1b, 4b)
> > - _ASM_EXTABLE(2b, 4b)
> > + _ASM_EXTABLE_TYPE_REG(1b, 3b, EX_TYPE_ONE_REG, %[faulted])
> > + _ASM_EXTABLE_TYPE_REG(2b, 3b, EX_TYPE_ONE_REG, %[faulted])
> >
> > : [old] "=&r" (old), [faulted] "=r" (faulted)
> > : [parent] "r" (parent), [return_hooker] "r" (return_hooker)
>
> This fixup code seems to no longer exist in the latest.

\o/, less patches. That's the risk of doing this stuff during the merge
window I suppose :-)