Re: [PATCH] KVM: SVM: Add a dedicated INVD intercept routine

From: Tom Lendacky
Date: Thu Sep 24 2020 - 09:33:21 EST


On 9/24/20 1:51 AM, Paolo Bonzini wrote:
On 23/09/20 22:40, Tom Lendacky wrote:
+static int invd_interception(struct vcpu_svm *svm)
+{
+ /*
+ * Can't do emulation on an SEV guest and INVD is emulated
+ * as a NOP, so just skip the instruction.
+ */
+ return (sev_guest(svm->vcpu.kvm))
+ ? kvm_skip_emulated_instruction(&svm->vcpu)
+ : kvm_emulate_instruction(&svm->vcpu, 0);

Is there any reason not to do kvm_skip_emulated_instruction() for both SEV
and legacy? VMX has the same odd kvm_emulate_instruction() call, but AFAICT
that's completely unecessary, i.e. VMX can also convert to a straight skip.

You could, I just figured I'd leave the legacy behavior just in case. Not
that I can think of a reason that behavior would ever change.

Yeah, let's do skip for both SVM and VMX.

Ok, I'll submit a two patch series to change SVM and VMX. I'll do two patches because of the fixes tag to get the SVM fix back to stable. But, if you would prefer a single patch, let me know.

Thanks,
Tom


Paolo