From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78FDFC433FE for ; Wed, 8 Sep 2021 13:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A6D261158 for ; Wed, 8 Sep 2021 13:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349306AbhIHNDA (ORCPT ); Wed, 8 Sep 2021 09:03:00 -0400 Received: from mga18.intel.com ([134.134.136.126]:27500 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232097AbhIHNC7 (ORCPT ); Wed, 8 Sep 2021 09:02:59 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10100"; a="207588630" X-IronPort-AV: E=Sophos;i="5.85,278,1624345200"; d="scan'208";a="207588630" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2021 06:01:51 -0700 X-IronPort-AV: E=Sophos;i="5.85,278,1624345200"; d="scan'208";a="538726756" Received: from rhe-mobl.ccr.corp.intel.com (HELO localhost) ([10.249.169.176]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2021 06:01:48 -0700 Date: Wed, 8 Sep 2021 21:01:45 +0800 From: Yu Zhang To: Vitaly Kuznetsov Cc: seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org Subject: Re: [PATCH] KVM: nVMX: fix comments of handle_vmon() Message-ID: <20210908130145.3uwmywgjaahyb6iw@linux.intel.com> References: <20210908171731.18885-1-yu.c.zhang@linux.intel.com> <87lf474ci8.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lf474ci8.fsf@vitty.brq.redhat.com> User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 08, 2021 at 11:55:59AM +0200, Vitaly Kuznetsov wrote: > Indeed, > > Reviewed-by: Vitaly Kuznetsov > > On a slightly related note: we don't seem to reset > 'vmx->nested.vmxon_ptr' upon VMXOFF emulation; this is not a problem per > se as we never access it when !vmx->nested.vmxon but I'd still suggest > we do something like > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index bc6327950657..8beb41d02d21 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -290,6 +290,7 @@ static void free_nested(struct kvm_vcpu *vcpu) > > vmx->nested.vmxon = false; > vmx->nested.smm.vmxon = false; > + vmx->nested.vmxon_ptr = -1ull; > free_vpid(vmx->nested.vpid02); > vmx->nested.posted_intr_nv = -1; > vmx->nested.current_vmptr = -1ull; > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index d7c5257eb5c0..2214e6bd4713 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6884,6 +6884,7 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu) > > vcpu_setup_sgx_lepubkeyhash(vcpu); > > + vmx->nested.vmxon_ptr = -1ull; > vmx->nested.posted_intr_nv = -1; > vmx->nested.current_vmptr = -1ull; > vmx->nested.hv_evmcs_vmptr = EVMPTR_INVALID; > > to avoid issues in the future. > Thanks, Vitaly. And above suggestion sounds reasonable to me. :) I can add this in V2 later, if no one objects. B.R. Yu