From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752085AbcGUJNq (ORCPT ); Thu, 21 Jul 2016 05:13:46 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36251 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751568AbcGUJNn (ORCPT ); Thu, 21 Jul 2016 05:13:43 -0400 Subject: Re: [PATCH 1/4] nvmx: use warn_on for buggy cases when emulating invept/invvpid To: Bandan Das , kvm@vger.kernel.org References: <1469053536-11130-1-git-send-email-bsd@redhat.com> <1469053536-11130-2-git-send-email-bsd@redhat.com> Cc: rkrcmar@redhat.com, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: Date: Thu, 21 Jul 2016 11:13:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1469053536-11130-2-git-send-email-bsd@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/07/2016 00:25, Bandan Das wrote: > If L1 hypervisor decides to try out something weird, alert the > host but only less aggressively. Also, remove the comment > regarding nested vpid support since it is no longer valid. > > Signed-off-by: Bandan Das > --- > arch/x86/kvm/vmx.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 64a79f2..9fd0681 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -2854,7 +2854,6 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) > vmx->nested.nested_vmx_secondary_ctls_high); > break; > case MSR_IA32_VMX_EPT_VPID_CAP: > - /* Currently, no nested vpid support */ This is okay. > *pdata = vmx->nested.nested_vmx_ept_caps | > ((u64)vmx->nested.nested_vmx_vpid_caps << 32); > break; > @@ -7462,7 +7461,7 @@ static int handle_invept(struct kvm_vcpu *vcpu) > break; > default: > /* Trap single context invalidation invept calls */ > - BUG_ON(1); > + WARN_ON(1); > break; > } > > @@ -7525,7 +7524,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu) > break; > default: > /* Trap individual address invalidation invvpid calls */ > - BUG_ON(1); > + WARN_ON(1); > break; > } > > These are BUGs because they are checked above: if (!(types & (1UL << type))) { nested_vmx_failValid(vcpu, VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID); skip_emulated_instruction(vcpu); return 1; } Guest-triggerable WARNs are only just a little better than guest-triggerable BUGs. Guest-triggerable messages should be rate-limited printk. I don't object to the change, but the commit message should be modified (or the change dropped). Paolo