Received: by 10.192.165.148 with SMTP id m20csp611089imm; Fri, 4 May 2018 03:31:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr+if2pJijc7mK18O+JxLt3xASW3IG9LR0J3xoAynrbBgT7ziA4U8J6uOvmmCCtvt/PkD6P X-Received: by 2002:a63:b908:: with SMTP id z8-v6mr21921253pge.436.1525429912306; Fri, 04 May 2018 03:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525429912; cv=none; d=google.com; s=arc-20160816; b=mGVyuhi1uoBdudDBzXAPjRIYecyWIv71ViEOJxG5RY3a17LXcQz1P6y1zl/XIaFdNo LaMiFKOcUcwHP9kVTFpH9RXvusRWBAUXlvnqpBxDSKplpWbB5l4YomG16cRURFpfHjyO whwdnxJ0LSi+2fLWk9TcErt8RGpfbrwP3cpvcrriwidekxg9wbAAGwrWlgTrcAt6s8vq SooQ4im7cffxdHGS28EQDgEePBRL0nrZe1LnxGkrmonmU7jNLjWuUAJbo9M1A17etO2l lLmqXF3VbP3Z3XXE5c/xhVs9/Mf2Gp2/Un+c/NCZo3lx55mgyFHqr6SNQhjJPkRq5a/C J4iA== 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=5BsCH4UV3/cTUYMyJVEFkETQM2gVDk2pt2EvMc8vNtk=; b=bCnIwn4CbSi4DyTa86yBD4tqd51IWXj2UW5GXqblizFHEMe5pPChFMYBOxVpw9JkT9 Kcf+yi5n4kyJdInEbVr0yVsflpnpfT50nioe8snznVad4lH7S4veTw6r3Li23poyXCGH cKXGqGzwaYcjOPpbcKtSBSRAxlJcT4OozlKw8kbhxDHj0wfd2PKlOlXlNMv93yursMAF U8vntWm7lg7uhIp2n8FSpmAzSXMn0uqS1J/J39SevsWcx7COnDeZWXilGcE3hZtUiCpn kWA8uqGh0W3yf2oX29g6d12c6NzTCxOrvtaBUv+beEqI+/tEJmmAUZsFAOyhNEotVtv+ VRdg== 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 w3-v6si15113079plb.17.2018.05.04.03.31.38; Fri, 04 May 2018 03:31:52 -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 S1751360AbeEDKaF (ORCPT + 99 others); Fri, 4 May 2018 06:30:05 -0400 Received: from mga11.intel.com ([192.55.52.93]:37558 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeEDKaE (ORCPT ); Fri, 4 May 2018 06:30:04 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2018 03:30:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,362,1520924400"; d="scan'208";a="43059825" Received: from um.fi.intel.com (HELO um) ([10.237.72.212]) by fmsmga002.fm.intel.com with ESMTP; 04 May 2018 03:30:01 -0700 Received: from ash by um with local (Exim 4.90_1) (envelope-from ) id 1fEXyQ-0001lY-RS; Fri, 04 May 2018 13:29:58 +0300 Date: Fri, 4 May 2018 13:29: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 09/13] KVM: x86: Implement Intel Processor Trace context switch Message-ID: <20180504102958.u6c3mqackl4kzd54@um.fi.intel.com> References: <1525349323-9938-1-git-send-email-luwei.kang@intel.com> <1525349323-9938-10-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-10-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:39PM +0800, Luwei Kang wrote: > +static void pt_guest_enter(struct vcpu_vmx *vmx) > +{ > + if (pt_mode == PT_MODE_HOST || pt_mode == PT_MODE_HOST_GUEST) > + rdmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl); > + > + if (pt_mode == PT_MODE_HOST_GUEST && > + vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN) { > + wrmsrl(MSR_IA32_RTIT_CTL, 0); > + pt_save_msr(&vmx->pt_desc.host, vmx->pt_desc.range_cnt); > + pt_load_msr(&vmx->pt_desc.guest, vmx->pt_desc.range_cnt); > + } > +} > + > +static void pt_guest_exit(struct vcpu_vmx *vmx) > +{ > + if (pt_mode == PT_MODE_HOST_GUEST && > + vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN) { > + pt_save_msr(&vmx->pt_desc.guest, vmx->pt_desc.range_cnt); > + pt_load_msr(&vmx->pt_desc.host, vmx->pt_desc.range_cnt); > + } > + > + if (pt_mode == PT_MODE_HOST || pt_mode == PT_MODE_HOST_GUEST) > + wrmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl); > +} This means that a host PT event won't get the guest traces and won't get any notification as to what'd happened or why. At the minimum we need to send a PARTIAL AUX record at the pt_guest_enter(), when we turn the host tracing off. Regards, -- Alex