Re: [PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

Andy Lutomirski
2020-12-14T20:10:02Z

On Mon, Dec 14, 2020 at 11:38 AM Sean Christopherson <seanjc@google.com> wrote:
>
> +Andy, who provided a lot of feedback on v1.
>
> >
> > static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu)
> > @@ -3507,14 +3503,8 @@ static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu,
> >
> > __svm_vcpu_run(svm->vmcb_pa, (unsigned long *)&svm->vcpu.arch.regs);
>
> Tying in with avoiding svm->host_save_area, what about passing in the PA of the
> save area and doing the vmload in __svm_vcpu_run()? One less instance of inline
> assembly to stare at...

One potential side benefit is that we wouldn't execute any C code with
the wrong MSR_GS_BASE, which avoids any concerns about
instrumentation, stack protector, or some *SAN feature exploding due
to a percpu memory not working.

--Andy