Messages in this thread | | | Date | Wed, 31 May 2023 21:23:45 -0700 | From | Josh Poimboeuf <> | Subject | Re: [PATCH] KVM: VMX: remove LFENCE in vmx_spec_ctrl_restore_host() |
| |
On Wed, May 31, 2023 at 06:24:29PM -0700, Pawan Gupta wrote:
## 2023-05-31 > On Thu, Jun 01, 2023 at 01:50:48AM +0100, Andrew Cooper wrote: > > On 01/06/2023 1:42 am, Josh Poimboeuf wrote: > > > So each LFENCE has a distinct purpose. That said, there are no indirect > > > branches or unbalanced RETs between them. > > > > How lucky are you feeling? > > > > You're in C at this point, which means the compiler could have emitted a > > call to mem{cpy,cmp}() in place of a simple assignment/comparison. > > Moving the second LFENCE to the else part of WRMSR should be possible? > So that the serialization can be achived either by WRMSR or LFENCE. This > saves an LFENCE when host and guest value of MSR_SPEC_CTRL differ.
Yes. Though in practice it might not make much of a difference. With wrmsr+lfence, the lfence has nothing to do so it might be almost instantaneous anyway.
-- Josh
| |