From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liran Alon Subject: Re: [PATCH v2 7/8] KVM: nVMX: Require immediate-exit when event reinjected to L2 and L1 event pending Date: Tue, 28 Nov 2017 15:59:20 +0200 Message-ID: <5A1D6BB8.4010709@ORACLE.COM> References: <1511278211-12257-1-git-send-email-liran.alon@oracle.com> <1511278211-12257-8-git-send-email-liran.alon@oracle.com> <5A1C94B8.8040809@ORACLE.COM> <05242c26-8084-aa37-49b7-00f0a5c06ccc@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm list , Wanpeng Li , Idan Brown , Konrad Rzeszutek Wilk To: Paolo Bonzini , Jim Mattson Return-path: Received: from aserp1040.oracle.com ([141.146.126.69]:35719 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753212AbdK1N7c (ORCPT ); Tue, 28 Nov 2017 08:59:32 -0500 In-Reply-To: <05242c26-8084-aa37-49b7-00f0a5c06ccc@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 28/11/17 13:14, Paolo Bonzini wrote: > On 28/11/2017 05:55, Jim Mattson wrote: >> kvm_queue_interrupt() begins as follows: >> vcpu->arch.interrupt.pending = true; >> >> kvm_cpu_has_interrupt() begins as follows: >> if (!lapic_in_kernel(v)) >> return v->arch.interrupt.pending; >> >> In the referenced [patch 2/8], you change interrupt.pending to >> interrupt.injected, but the same field is still referenced by these >> two functions. > > We cannot remove the !lapic_in_kernel(v) case, but it's okay if we > restrict nested VMX/SVM in CPUID when it is disabled (that is, check for > !lapic_in_kernel in nested_svm_check_permissions and nested_vmx_allowed, > so that setting VMXE and SVME will fail). I agree with this suggestion. I think it is best to currently make a commit before ("[PATCH v2 2/8] KVM: x86: Rename interrupt.pending to interrupt.injected"), that will add FIXME comments in kvm_cpu_has_interrupt() & kvm_cpu_has_injectable_intr() specifying why it is problematic that they use interrupt.pending in nVMX/nSVM scenarios and in addition put the above checks Paolo mentioned in nested_svm_check_permissions() and nested_vmx_allowed(). Regards, -Liran > > Thanks, > > Paolo >