Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp308512ybg; Wed, 18 Mar 2020 23:36:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsrbhZHiQdY00NBVIWqmH75MCKfAlZQWib6ZP8f6NAUxD857yzKZMkfV5TNVf6GsABy72WF X-Received: by 2002:a05:6808:b13:: with SMTP id s19mr1281938oij.60.1584599768325; Wed, 18 Mar 2020 23:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584599768; cv=none; d=google.com; s=arc-20160816; b=GRFz/ZOR6qKGlnErF5L6XvomVx6NgN85nUItTzBCK6zd/65gLOLCgFsoNbfV5LW91m MNVtPaBh5nRgGFhHnw03YGkm+AB+EBDwsMHo0WHJK+jrsgNwhv+7ppOeW1JVhmNShus7 gtCTnWwSBPIk75qe+a67r56rJy83J2kq7YZP7hXXQVC4okjrx/T9vHscalFQLi8ruXvT StEmJ0bYdOiYliMwtSxjPlsZRjh6hR63hfuBYAwI3hRCqg+HYro/TGy5hHhHa/ZRGfj7 1+xxrGTCrRhsaZeqBn0uO6+Vh3iJLy4KtjdKAxXJs7a4C0enwfew/Zfus3rN14Z+6nyE QXSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=sUkLFdTiSklUtcemjfkQULCUVaVP/vqfHZ+1hq3bWrI=; b=vhghiGtMulfeXoPjYEFqAW3RcslEix5Lzc1mj27wd3K31rfZRwdOza9Oq1NtRgyTEa dUfp+eWyGWluwbli9PJIuSsJlFxnhLYvqc8Bw/67EfvET4wsGioYrVkyL5sMYTTF+fms GPIvkJ7XrHiZA7AGkcgbQp7tpYxjAAG8aJPZ8tvNyIwCiBKM7hFmW/QGPEZ69MFQ/vnp vDGlwqVgJ0v3MObpfGF+g0+cx0cgKiif7FnGydbrsGktkH7eyWLRcf9/68u4+VenmFF3 kzClRwWuMm+XHHZjo4DmQ7Wzp4nGCa1K44qMOrxH1npFT+3Iu+2qAhzPPCIkx+p1k9u6 Vvhw== 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 s27si822825otg.229.2020.03.18.23.35.55; Wed, 18 Mar 2020 23:36:08 -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 S1727034AbgCSGfb (ORCPT + 99 others); Thu, 19 Mar 2020 02:35:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:51299 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbgCSGfa (ORCPT ); Thu, 19 Mar 2020 02:35:30 -0400 IronPort-SDR: jAqTvka35ViE+GAudoZ/cQaT25DXIoZPuRaNUSHWRYZTDSlA31jziqYiK0+UCW/ux9Vw/SzvCI P7O59klnAFsQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 23:35:30 -0700 IronPort-SDR: JjJIFAbFGye2coKeGQkBdUKDRzZ8ruE0DyVb+H5EoqBg/iQ1rysMNE1vEQvWG+R1YVs0y+Ffo6 MZGgRTdhYMnA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,570,1574150400"; d="scan'208";a="248439070" Received: from snr.bj.intel.com ([10.240.193.90]) by orsmga006.jf.intel.com with ESMTP; 18 Mar 2020 23:35:24 -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 0/5] PEBS virtualization enabling via Intel PT Date: Thu, 19 Mar 2020 22:33:45 +0800 Message-Id: <1584628430-23220-1-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Intel new hardware(Atom processors based on the Tremont microarchitecture) introduces some Processor Event-Based Sampling(PEBS) extensions that output the PEBS record to Intel PT stream instead of DS area. The PEBS record will be packaged in a specific format when outputting to Intel PT. This patch set will enable PEBS functionality in KVM Guest by PEBS output to Intel PT, base on PEBS virtualization enabling via DS patch set[1]. Compared to the v1, the common code of PEBS virtualization enabling(PEBS via DS and PEBS via Intel PT) has been moved to PEBS via DS patch set. This patch set only includes the PEBS via PT specific changes. Patch 1 is an extension to get fixed function counter by reload MSRs; Patch 2,3 implement the CPUID and MSRs emulation; Patch 4 will add the counter reload MSRs to MSR list during VM-entry/exit; Patch 5 will swith the PEBS records to Intel PT buffer if PEBS via PT is enabled in KVM guest. [1]: https://lore.kernel.org/kvm/1583431025-19802-1-git-send-email-luwei.kang@intel.com/ Luwei Kang (5): KVM: x86/pmu: Add base address parameter for get_fixed_pmc function KVM: x86/pmu: Expose PDCM feature when PEBS output to PT KVM: x86/pmu: PEBS output Intel PT MSRs emulation KVM: x86/pmu: Add counter reload register to MSR list KVM: VMX: Switch PEBS records output to Intel PT buffer arch/x86/events/perf_event.h | 5 -- arch/x86/include/asm/kvm_host.h | 2 + arch/x86/include/asm/msr-index.h | 6 +++ arch/x86/kvm/pmu.h | 6 +-- arch/x86/kvm/vmx/capabilities.h | 9 +++- arch/x86/kvm/vmx/pmu_intel.c | 112 ++++++++++++++++++++++++++++++++++----- arch/x86/kvm/vmx/vmx.c | 3 ++ arch/x86/kvm/vmx/vmx.h | 2 +- arch/x86/kvm/x86.c | 32 +++++++++++ 9 files changed, 154 insertions(+), 23 deletions(-) -- 1.8.3.1