2022-11-17 21:03:29

by Alexey Dobriyan

[permalink] [raw]
Subject: VMX HOST_RIP target alignment

One of the side effects of fixing retbleed for VMX was demoting
HOST_RIP target from honorable function to a lowly label:

-SYM_FUNC_START(vmx_vmexit)
+SYM_INNER_LABEL(vmx_vmexit, SYM_L_GLOBAL)

ffffffff81243c49: 0f 01 c2 vmlaunch
ffffffff81243c4c: e9 a7 00 00 00 jmp ffffffff81243cf8 <vmx_vmexit+0xa7>

ffffffff81243c51 <vmx_vmexit>:
ffffffff81243c51: 50 push rax

Now I've never measured VM exit latency but is it important to align it
at 16 bytes like Intel recommends for functions?

vmalexey


2022-11-18 00:06:08

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: VMX HOST_RIP target alignment

On Thu, Nov 17, 2022 at 11:46:09PM +0300, Alexey Dobriyan wrote:
> One of the side effects of fixing retbleed for VMX was demoting
> HOST_RIP target from honorable function to a lowly label:
>
> -SYM_FUNC_START(vmx_vmexit)
> +SYM_INNER_LABEL(vmx_vmexit, SYM_L_GLOBAL)
>
> ffffffff81243c49: 0f 01 c2 vmlaunch
> ffffffff81243c4c: e9 a7 00 00 00 jmp ffffffff81243cf8 <vmx_vmexit+0xa7>
>
> ffffffff81243c51 <vmx_vmexit>:
> ffffffff81243c51: 50 push rax
>
> Now I've never measured VM exit latency but is it important to align it
> at 16 bytes like Intel recommends for functions?

Yes, I'd think we should restore the alignment to 16 bytes again, that
change was definitely not intentional.

--
Josh