Received: by 10.192.165.148 with SMTP id m20csp604933imm; Fri, 4 May 2018 03:24:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp0DF5uVQlzlIQbV+HEPC/a+a2KpDVUBcY2XDjVr3xdjFi1aKIefrnrfhVJj5vmYhXsgTyF X-Received: by 2002:a17:902:f24:: with SMTP id 33-v6mr28100612ply.242.1525429471996; Fri, 04 May 2018 03:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525429471; cv=none; d=google.com; s=arc-20160816; b=xW88y4UN0/1YQpwSmtEKW2A2jUeMEkAR1s5eAxwC4hnsgyEY8zcL2rxfM1BSFfC1rf P7m4BgyZmOntK7uoWAdU3ELFHr+6TLWshB5mmxYydeH1hXilBeMAAxHWi/JiIBTNKuRr ZtrVmkEOAi3xMoQS7sc/mSlryjmdCtbGCkQc3J6Gfk/7cGpvAW88jlAFxehStgC4ch6C DCRjQkah1SeOMB0PPdUnOT3g1G7pTzwjS+hO+HmkCNPUpFACTZq1+1/2JAQ5FKC48gvX mfiOxJKhzZefLjsyN71TOFqSRB7HkII6jcC65GxgSxmDZ0x/RVKQgroAd21Bq+O+UN/u cZCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=BWoYHZPsPUwPk5/Dv3ph+0jxkOWOlCT8NHPS8c4deQE=; b=qAHsYL0zNHkuB648nDiZ9A4kBfhoLS1yWRkrS9fCHNFaykb0OyfEsOZ4EPKlIUetuS QIRfU3ldKNRx7+xM1mYK3VKgwWNB1utK/b4bCHHBcULTym8x5PFHYhrL4rS3dKylFt15 qCpGGcnFgVgg30VBlkTbWT1KFq/0BPW4fCicf4Dn22yq3qEfT+FSn9Orh7hpvnEp7+dG 5Lguw+Pmq+kSaiZ+1zn64yLpr/bt9h64KCCf2yPkptzUW+pUDJQ6vgX3HbSYxWTKuD4r jqCPlcXykCfd/3iDpQ/04gZXJo3BOVtapN3Rp9SKczzOxdE/5/vkORk804xjRympk19Q ZrZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si8298942pff.303.2018.05.04.03.24.17; Fri, 04 May 2018 03:24:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751269AbeEDKYG (ORCPT + 99 others); Fri, 4 May 2018 06:24:06 -0400 Received: from mga18.intel.com ([134.134.136.126]:44141 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbeEDKYE (ORCPT ); Fri, 4 May 2018 06:24:04 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2018 03:24:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,362,1520924400"; d="scan'208";a="221592089" Received: from um.fi.intel.com (HELO um) ([10.237.72.212]) by orsmga005.jf.intel.com with ESMTP; 04 May 2018 03:24:01 -0700 Received: from ash by um with local (Exim 4.90_1) (envelope-from ) id 1fEXsd-0001b2-11; Fri, 04 May 2018 13:23:59 +0300 Date: Fri, 4 May 2018 13:23:58 +0300 From: Alexander Shishkin To: Luwei Kang Cc: kvm@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, joro@8bytes.org, peterz@infradead.org, chao.p.peng@linux.intel.com Subject: Re: [PATCH v7 13/13] KVM: x86: Disable Intel Processor Trace when VMXON in L1 guest Message-ID: <20180504102358.eojiggqrnhxng2ru@um.fi.intel.com> References: <1525349323-9938-1-git-send-email-luwei.kang@intel.com> <1525349323-9938-14-git-send-email-luwei.kang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1525349323-9938-14-git-send-email-luwei.kang@intel.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 03, 2018 at 08:08:43PM +0800, Luwei Kang wrote: > Currently, Intel Processor Trace do not support tracing in L1 guest > VMX operation(IA32_VMX_MISC[bit 14] is 0). As mentioned in SDM, I don't understand this patch. You mention VMX_MISC[14] here, but I can't see anything related to it in the code. Also, the description should probably say "...does not support tracing in VMX *if* IA32_VMX_MISC[bit 14] is 0." > on these type of processors, execution of the VMXON instruction will > clears IA32_RTIT_CTL.TraceEn and any attempt to write IA32_RTIT_CTL > causes a general-protection exception (#GP). > > Signed-off-by: Luwei Kang > --- > arch/x86/kvm/vmx.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index c125fb1..1e800d0 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -3952,7 +3952,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > break; > case MSR_IA32_RTIT_CTL: > if ((pt_mode != PT_MODE_HOST_GUEST) || > - vmx_rtit_ctl_check(vcpu, data)) > + vmx_rtit_ctl_check(vcpu, data) || > + vmx->nested.vmxon) > return 1; > vmcs_write64(GUEST_IA32_RTIT_CTL, data); > pt_set_intercept_for_msr(vmx, !(data & RTIT_CTL_TRACEEN)); > @@ -8029,6 +8030,12 @@ static int handle_vmon(struct kvm_vcpu *vcpu) > if (ret) > return ret; > > + if (pt_mode == PT_MODE_HOST_GUEST) { > + vmx->pt_desc.guest.ctl = 0; > + vmcs_write64(GUEST_IA32_RTIT_CTL, 0); > + pt_set_intercept_for_msr(vmx, 1); > + } > + > nested_vmx_succeed(vcpu); > return kvm_skip_emulated_instruction(vcpu); > } > -- > 1.8.3.1 >