[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V4 04/50] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()
- To: Borislav Petkov <bp@xxxxxxxxx>, Lai Jiangshan <jiangshanlai@xxxxxxxxx>
- From: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>
- Date: Tue, 2 Nov 2021 17:19:46 +0800
- Cc: linux-kernel@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Peter Anvin <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Andy Lutomirski <luto@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Tue, 02 Nov 2021 09:23:21 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2021/11/2 16:58, Borislav Petkov wrote:
*/
- ALTERNATIVE "", "jmp swapgs_restore_regs_and_return_to_usermode", \
+ ALTERNATIVE "", "jmp xenpv_restore_regs_and_return_to_usermode", \
Instead of sprinkling all those ALTERNATIVE calls everywhere,
why don't you simply jump to the xenpv-one at the
swapgs_restore_regs_and_return_to_usermode label itself and have a
single ALTERNATIVE there?
It will add a 5-byte NOP at the beginning of the native
swapgs_restore_regs_and_return_to_usermode. I avoided adding unneeded
code in the native code even if it is NOPs and avoided melting xenpv-one into
the native one which will reduce the code readability.
I will follow your preference since a 5-byte NOP is so negligible in the slow
path with an iret instruction.
Or other option that adds macros to wrap the ALTERNATIVE.
RESTORE_REGS_AND_RETURN_TO_USERMODE and
COND_RESTORE_REGS_AND_RETURN_TO_USERMODE (test %eax before jmp in native case)
|