Re: [PATCH V6 3/8] x86/entry: Move PUSH_AND_CLEAR_REGS out of error_entry()

From: Borislav Petkov
Date: Mon May 02 2022 - 14:09:17 EST


On Mon, May 02, 2022 at 02:42:50PM +0200, Juergen Gross wrote:
> I think you could avoid the extra call/ret by doing something like:
>
> SYM_CODE_START_LOCAL(error_exit_push_and_save)
> UNWIND_HINT_FUNC
> PUSH_AND_CLEAR_REGS save_ret=1
> ENCODE_FRAME_POINTER 8
> jmp error_exit
> SYM_CODE_END(error_exit_push_and_save)
>
> ... and use this instead of patch 5:
>
> ALTERNATIVE "call error_entry_push_and_save; movq %rax, %rsp", \
> "call push_and_clear_regs", X86_FEATURE_XENPV

I'm afraid I can't follow - you still need to call error_entry on
!XENPV. You have a function error_entry_push_and_save() but above it is
called error_*exit*_push_and_save...

Bottomline is, this should be as simple as possible code - an additional
CALL/RET doesn't really matter, perf-wise.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette