Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp309247ybg; Wed, 18 Mar 2020 23:37:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtjdWVzLdC69qkjM8EgODLUKX8fluKW658V/VGS6bFG9F9EqLh2h1Xa1hzxkNxbld5tJW1J X-Received: by 2002:a9d:8e4:: with SMTP id 91mr1154462otf.130.1584599829357; Wed, 18 Mar 2020 23:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584599829; cv=none; d=google.com; s=arc-20160816; b=rIplTZ5J/n/PUi+QuprM2oZIZ3sbdw+YtYWQh55AwPnrQQ2+CK0N85fjPtjNQoP4Ef TIleLeEM7iCezAAZkK9zVjqBkIWyAq8lW1tBe0Pql0mz/0oj0Ki9ELvymzmYSRzU+m/y PmyFWe6bC7oXHck21pOtIL0jvTAskwB0iuJGG/p/LGv0Vno319aDQQuP478HP9hYBy8n HmmIQvfHTnvfXfrfzdPjNOhedb3hLSyPlK3NDccimppE5cNYiem4gh2JINlHWUZmkqSw 6zPR/6ArB7sMPhwEzZppQDbN7D8p2vTeGSqtEkB7GCiT+rvCRFOE7NbFzZE540rW06o6 80Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=CczghxS6NAbY7db0J7XSf0qeQWeJ6+OZ/bYuY3DIXHU=; b=khhV5fqwhnp/evmpenQclp/n1CZxmhN9Lgix6KRXZbebU4xUS9qY2v1GJL8F8dS1/9 lQISY/TC2oPOgJLXJuY/qHtpzhb4E6FAJ7qMxjucRXfUcJxl8hGVgOepBnp0SOY8GS2W f+n/czgx/mJW2gph0HyAa30FRUKBy8HLkcHIzNhcY+Uep1Q2QimEeqKPuNCzZCntcyFU x3lFzan7LwwjC/gtSaEXwNH//NiEl5Gfa71ObRp/+kCHbtPDjHxQyAzWWTPTxxg+ginp ak4HFuYblLpq22gPXZX4i/pVX+7dSBQLmImFke7ka3fL7MnFWIsOF+GGjqms7bPJmcTV wpsg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si841830otl.217.2020.03.18.23.36.57; Wed, 18 Mar 2020 23:37:09 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbgCSGgH (ORCPT + 99 others); Thu, 19 Mar 2020 02:36:07 -0400 Received: from mga12.intel.com ([192.55.52.136]:25753 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727026AbgCSGgH (ORCPT ); Thu, 19 Mar 2020 02:36:07 -0400 IronPort-SDR: ZAQ6D+KT8gR5YRxuhiw0noZBPrjy0r5uNa4S2WQ6jgYEY84oMjs0g55cXW7EHO6FjMjk/zaaB+ peP1mrucmlrg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 23:36:06 -0700 IronPort-SDR: F6KwX0Atn4KHwoE0e6DWfKBmMZKeFiBSHNbcsydGQRTVJZ1TI4l4JFOF7eOdCDmqeXo1b9LSlc BEhoesRzxsFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,570,1574150400"; d="scan'208";a="248439246" Received: from snr.bj.intel.com ([10.240.193.90]) by orsmga006.jf.intel.com with ESMTP; 18 Mar 2020 23:36:00 -0700 From: Luwei Kang To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, pawan.kumar.gupta@linux.intel.com, ak@linux.intel.com, thomas.lendacky@amd.com, fenghua.yu@intel.com, kan.liang@linux.intel.com, Luwei Kang Subject: [PATCH v2 5/5] KVM: VMX: Switch PEBS records output to Intel PT buffer Date: Thu, 19 Mar 2020 22:33:50 +0800 Message-Id: <1584628430-23220-6-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1584628430-23220-1-git-send-email-luwei.kang@intel.com> References: <1584628430-23220-1-git-send-email-luwei.kang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch PEBS records output to Intel PT buffer when PEBS is enabled in KVM guest by Intel PT. Signed-off-by: Luwei Kang --- arch/x86/kvm/vmx/vmx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index c6d9a87..ec74656 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -921,6 +921,7 @@ void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, { int i, j = 0; struct msr_autoload *m = &vmx->msr_autoload; + struct kvm_pmu *pmu = vcpu_to_pmu(&vmx->vcpu); switch (msr) { case MSR_EFER: @@ -952,6 +953,8 @@ void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, * guest's memory. */ wrmsrl(MSR_IA32_PEBS_ENABLE, 0); + if ((pmu->pebs_enable & PEBS_OUTPUT_MASK) == PEBS_OUTPUT_PT) + guest_val |= PEBS_OUTPUT_PT; } i = vmx_find_msr_index(&m->guest, msr); -- 1.8.3.1