From: "Mi, Dapeng" <dapeng1.mi@linux.intel.com>
To: Mingwei Zhang <mizhang@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Liang@google.com, Kan <kan.liang@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
Yongwei Ma <yongwei.ma@intel.com>,
Xiong Zhang <xiong.y.zhang@linux.intel.com>,
Jim Mattson <jmattson@google.com>,
Sandipan Das <sandipan.das@amd.com>,
Zide Chen <zide.chen@intel.com>,
Eranian Stephane <eranian@google.com>,
Shukla Manali <Manali.Shukla@amd.com>,
Nikunj Dadhania <nikunj.dadhania@amd.com>
Subject: Re: [PATCH v4 00/38] Mediated vPMU 4.0 for x86
Date: Wed, 16 Apr 2025 15:22:02 +0800 [thread overview]
Message-ID: <16d8265b-750d-4e3c-aeb1-772d28b6c79c@linux.intel.com> (raw)
In-Reply-To: <20250324173121.1275209-1-mizhang@google.com>
Kindly ping... Any comments on this patch series? Thanks.
On 3/25/2025 1:30 AM, Mingwei Zhang wrote:
> With joint effort from the upstream KVM community, we come up with the
> 4th version of mediated vPMU for x86. We have made the following changes
> on top of the previous RFC v3.
>
> v3 -> v4
> - Rebase whole patchset on 6.14-rc3 base.
> - Address Peter's comments on Perf part.
> - Address Sean's comments on KVM part.
> * Change key word "passthrough" to "mediated" in all patches
> * Change static enabling to user space dynamic enabling via KVM_CAP_PMU_CAPABILITY.
> * Only support GLOBAL_CTRL save/restore with VMCS exec_ctrl, drop the MSR
> save/retore list support for GLOBAL_CTRL, thus the support of mediated
> vPMU is constrained to SapphireRapids and later CPUs on Intel side.
> * Merge some small changes into a single patch.
> - Address Sandipan's comment on invalid pmu pointer.
> - Add back "eventsel_hw" and "fixed_ctr_ctrl_hw" to avoid to directly
> manipulate pmc->eventsel and pmu->fixed_ctr_ctrl.
>
>
> Testing (Intel side):
> - Perf-based legacy vPMU (force emulation on/off)
> * Kselftests pmu_counters_test, pmu_event_filter_test and
> vmx_pmu_caps_test pass.
> * KUT PMU tests pmu, pmu_lbr, pmu_pebs pass.
> * Basic perf counting/sampling tests in 3 scenarios, guest-only,
> host-only and host-guest coexistence all pass.
>
> - Mediated vPMU (force emulation on/off)
> * Kselftests pmu_counters_test, pmu_event_filter_test and
> vmx_pmu_caps_test pass.
> * KUT PMU tests pmu, pmu_lbr, pmu_pebs pass.
> * Basic perf counting/sampling tests in 3 scenarios, guest-only,
> host-only and host-guest coexistence all pass.
>
> - Failures. All above tests passed on Intel Granite Rapids as well
> except a failure on KUT/pmu_pebs.
> * GP counter 0 (0xfffffffffffe): PEBS record (written seq 0)
> is verified (including size, counters and cfg).
> * The pebs_data_cfg (0xb500000000) doesn't match with the
> effective MSR_PEBS_DATA_CFG (0x0).
> * This failure has nothing to do with this mediated vPMU patch set. The
> failure is caused by Granite Rapids supported timed PEBS which needs
> extra support on Qemu and KUT/pmu_pebs. These extra support would be
> sent in separate patches later.
>
>
> Testing (AMD side):
> - Kselftests pmu_counters_test, pmu_event_filter_test and
> vmx_pmu_caps_test all pass
>
> - legacy guest with KUT/pmu:
> * qmeu option: -cpu host, -perfctr-core
> * when set force_emulation_prefix=1, passes
> * when set force_emulation_prefix=0, passes
> - perfmon-v1 guest with KUT/pmu:
> * qmeu option: -cpu host, -perfmon-v2
> * when set force_emulation_prefix=1, passes
> * when set force_emulation_prefix=0, passes
> - perfmon-v2 guest with KUT/pmu:
> * qmeu option: -cpu host
> * when set force_emulation_prefix=1, passes
> * when set force_emulation_prefix=0, passes
>
> - perf_fuzzer (perfmon-v2):
> * fails with soft lockup in guest in current version.
> * culprit could be between 6.13 ~ 6.14-rc3 within KVM
> * Series tested on 6.12 and 6.13 without issue.
>
> Note: a QEMU series is needed to run mediated vPMU v4:
> - https://lore.kernel.org/all/20250324123712.34096-1-dapeng1.mi@linux.intel.com/
>
> History:
> - RFC v3: https://lore.kernel.org/all/20240801045907.4010984-1-mizhang@google.com/
> - RFC v2: https://lore.kernel.org/all/20240506053020.3911940-1-mizhang@google.com/
> - RFC v1: https://lore.kernel.org/all/20240126085444.324918-1-xiong.y.zhang@linux.intel.com/
>
>
> Dapeng Mi (18):
> KVM: x86/pmu: Introduce enable_mediated_pmu global parameter
> KVM: x86/pmu: Check PMU cpuid configuration from user space
> KVM: x86: Rename vmx_vmentry/vmexit_ctrl() helpers
> KVM: x86/pmu: Add perf_capabilities field in struct kvm_host_values{}
> KVM: x86/pmu: Move PMU_CAP_{FW_WRITES,LBR_FMT} into msr-index.h header
> KVM: VMX: Add macros to wrap around
> {secondary,tertiary}_exec_controls_changebit()
> KVM: x86/pmu: Check if mediated vPMU can intercept rdpmc
> KVM: x86/pmu/vmx: Save/load guest IA32_PERF_GLOBAL_CTRL with
> vm_exit/entry_ctrl
> KVM: x86/pmu: Optimize intel/amd_pmu_refresh() helpers
> KVM: x86/pmu: Setup PMU MSRs' interception mode
> KVM: x86/pmu: Handle PMU MSRs interception and event filtering
> KVM: x86/pmu: Switch host/guest PMU context at vm-exit/vm-entry
> KVM: x86/pmu: Handle emulated instruction for mediated vPMU
> KVM: nVMX: Add macros to simplify nested MSR interception setting
> KVM: selftests: Add mediated vPMU supported for pmu tests
> KVM: Selftests: Support mediated vPMU for vmx_pmu_caps_test
> KVM: Selftests: Fix pmu_counters_test error for mediated vPMU
> KVM: x86/pmu: Expose enable_mediated_pmu parameter to user space
>
> Kan Liang (8):
> perf: Support get/put mediated PMU interfaces
> perf: Skip pmu_ctx based on event_type
> perf: Clean up perf ctx time
> perf: Add a EVENT_GUEST flag
> perf: Add generic exclude_guest support
> perf: Add switch_guest_ctx() interface
> perf/x86: Support switch_guest_ctx interface
> perf/x86/intel: Support PERF_PMU_CAP_MEDIATED_VPMU
>
> Mingwei Zhang (5):
> perf/x86: Forbid PMI handler when guest own PMU
> perf/x86/core: Plumb mediated PMU capability from x86_pmu to
> x86_pmu_cap
> KVM: x86/pmu: Exclude PMU MSRs in vmx_get_passthrough_msr_slot()
> KVM: x86/pmu: introduce eventsel_hw to prepare for pmu event filtering
> KVM: nVMX: Add nested virtualization support for mediated PMU
>
> Sandipan Das (4):
> perf/x86/core: Do not set bit width for unavailable counters
> KVM: x86/pmu: Add AMD PMU registers to direct access list
> KVM: x86/pmu/svm: Set GuestOnly bit and clear HostOnly bit when guest
> write to event selectors
> perf/x86/amd: Support PERF_PMU_CAP_MEDIATED_VPMU for AMD host
>
> Xiong Zhang (3):
> x86/irq: Factor out common code for installing kvm irq handler
> perf: core/x86: Register a new vector for KVM GUEST PMI
> KVM: x86/pmu: Register KVM_GUEST_PMI_VECTOR handler
>
> arch/x86/events/amd/core.c | 2 +
> arch/x86/events/core.c | 40 +-
> arch/x86/events/intel/core.c | 5 +
> arch/x86/include/asm/hardirq.h | 1 +
> arch/x86/include/asm/idtentry.h | 1 +
> arch/x86/include/asm/irq.h | 2 +-
> arch/x86/include/asm/irq_vectors.h | 5 +-
> arch/x86/include/asm/kvm-x86-pmu-ops.h | 2 +
> arch/x86/include/asm/kvm_host.h | 10 +
> arch/x86/include/asm/msr-index.h | 18 +-
> arch/x86/include/asm/perf_event.h | 1 +
> arch/x86/include/asm/vmx.h | 1 +
> arch/x86/kernel/idt.c | 1 +
> arch/x86/kernel/irq.c | 39 +-
> arch/x86/kvm/cpuid.c | 15 +
> arch/x86/kvm/pmu.c | 254 ++++++++-
> arch/x86/kvm/pmu.h | 45 ++
> arch/x86/kvm/svm/pmu.c | 148 ++++-
> arch/x86/kvm/svm/svm.c | 26 +
> arch/x86/kvm/svm/svm.h | 2 +-
> arch/x86/kvm/vmx/capabilities.h | 11 +-
> arch/x86/kvm/vmx/nested.c | 68 ++-
> arch/x86/kvm/vmx/pmu_intel.c | 224 ++++++--
> arch/x86/kvm/vmx/vmx.c | 89 +--
> arch/x86/kvm/vmx/vmx.h | 11 +-
> arch/x86/kvm/x86.c | 63 ++-
> arch/x86/kvm/x86.h | 2 +
> include/linux/perf_event.h | 47 +-
> kernel/events/core.c | 519 ++++++++++++++----
> .../beauty/arch/x86/include/asm/irq_vectors.h | 5 +-
> .../selftests/kvm/include/kvm_test_harness.h | 13 +
> .../testing/selftests/kvm/include/kvm_util.h | 3 +
> .../selftests/kvm/include/x86/processor.h | 8 +
> tools/testing/selftests/kvm/lib/kvm_util.c | 23 +
> .../selftests/kvm/x86/pmu_counters_test.c | 24 +-
> .../selftests/kvm/x86/pmu_event_filter_test.c | 8 +-
> .../selftests/kvm/x86/vmx_pmu_caps_test.c | 2 +-
> 37 files changed, 1480 insertions(+), 258 deletions(-)
>
>
> base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
next prev parent reply other threads:[~2025-04-16 7:22 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 17:30 [PATCH v4 00/38] Mediated vPMU 4.0 for x86 Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 01/38] perf: Support get/put mediated PMU interfaces Mingwei Zhang
2025-05-14 22:48 ` Sean Christopherson
2025-05-15 1:31 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 02/38] perf: Skip pmu_ctx based on event_type Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 03/38] perf: Clean up perf ctx time Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 04/38] perf: Add a EVENT_GUEST flag Mingwei Zhang
2025-05-14 22:51 ` Sean Christopherson
2025-05-15 1:35 ` Mi, Dapeng
2025-05-19 6:58 ` Namhyung Kim
2025-05-20 16:09 ` Liang, Kan
2025-05-20 17:51 ` Namhyung Kim
2025-05-20 18:50 ` Liang, Kan
2025-05-21 19:46 ` Namhyung Kim
2025-03-24 17:30 ` [PATCH v4 05/38] perf: Add generic exclude_guest support Mingwei Zhang
2025-04-25 11:13 ` Peter Zijlstra
2025-05-14 23:19 ` Sean Christopherson
2025-05-15 1:37 ` Mi, Dapeng
2025-05-15 18:39 ` Liang, Kan
2025-05-15 19:25 ` Sean Christopherson
2025-05-15 20:18 ` Liang, Kan
2025-05-21 19:55 ` Namhyung Kim
2025-05-21 20:12 ` Liang, Kan
2025-03-24 17:30 ` [PATCH v4 06/38] x86/irq: Factor out common code for installing kvm irq handler Mingwei Zhang
2025-05-14 23:21 ` Sean Christopherson
2025-05-15 2:10 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 07/38] perf: core/x86: Register a new vector for KVM GUEST PMI Mingwei Zhang
2025-05-14 23:24 ` Sean Christopherson
2025-05-15 1:40 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 08/38] KVM: x86/pmu: Register KVM_GUEST_PMI_VECTOR handler Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 09/38] perf: Add switch_guest_ctx() interface Mingwei Zhang
2025-04-25 11:12 ` Peter Zijlstra
2025-05-14 23:30 ` Sean Christopherson
2025-05-15 1:45 ` Mi, Dapeng
2025-05-21 20:01 ` Namhyung Kim
2025-03-24 17:30 ` [PATCH v4 10/38] perf/x86: Support switch_guest_ctx interface Mingwei Zhang
2025-04-25 11:15 ` Peter Zijlstra
2025-04-25 13:06 ` Liang, Kan
2025-04-25 13:43 ` Peter Zijlstra
2025-04-25 13:56 ` Liang, Kan
2025-07-30 0:31 ` Sean Christopherson
2025-03-24 17:30 ` [PATCH v4 11/38] perf/x86: Forbid PMI handler when guest own PMU Mingwei Zhang
2025-05-15 0:00 ` Sean Christopherson
2025-05-15 1:52 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 12/38] perf/x86/core: Do not set bit width for unavailable counters Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 13/38] perf/x86/core: Plumb mediated PMU capability from x86_pmu to x86_pmu_cap Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 14/38] KVM: x86/pmu: Introduce enable_mediated_pmu global parameter Mingwei Zhang
2025-05-15 0:09 ` Sean Christopherson
2025-05-15 2:53 ` Mi, Dapeng
2025-05-21 18:43 ` Sean Christopherson
2025-05-22 1:36 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 15/38] KVM: x86/pmu: Check PMU cpuid configuration from user space Mingwei Zhang
2025-05-15 0:12 ` Sean Christopherson
2025-05-15 3:00 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 16/38] KVM: x86: Rename vmx_vmentry/vmexit_ctrl() helpers Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 17/38] KVM: x86/pmu: Add perf_capabilities field in struct kvm_host_values{} Mingwei Zhang
2025-05-15 0:12 ` Sean Christopherson
2025-05-15 3:04 ` Mi, Dapeng
2025-03-24 17:30 ` [PATCH v4 18/38] KVM: x86/pmu: Move PMU_CAP_{FW_WRITES,LBR_FMT} into msr-index.h header Mingwei Zhang
2025-03-24 17:30 ` [PATCH v4 19/38] KVM: VMX: Add macros to wrap around {secondary,tertiary}_exec_controls_changebit() Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 20/38] KVM: x86/pmu: Check if mediated vPMU can intercept rdpmc Mingwei Zhang
2025-05-15 0:19 ` Sean Christopherson
2025-05-15 3:23 ` Mi, Dapeng
2025-05-26 6:15 ` Sandipan Das
2025-07-09 15:53 ` Sean Christopherson
2025-07-29 3:29 ` Mi, Dapeng
2025-07-30 0:38 ` Sean Christopherson
2025-07-30 2:25 ` Mi, Dapeng
2025-08-01 23:32 ` Sean Christopherson
2025-08-05 0:54 ` Sean Christopherson
2025-03-24 17:31 ` [PATCH v4 21/38] KVM: x86/pmu/vmx: Save/load guest IA32_PERF_GLOBAL_CTRL with vm_exit/entry_ctrl Mingwei Zhang
2025-03-26 16:51 ` Chen, Zide
2025-03-26 20:09 ` Mingwei Zhang
2025-05-15 0:33 ` Sean Christopherson
2025-05-15 3:45 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 22/38] KVM: x86/pmu: Optimize intel/amd_pmu_refresh() helpers Mingwei Zhang
2025-05-15 0:37 ` Sean Christopherson
2025-05-15 5:09 ` Mi, Dapeng
2025-05-15 19:22 ` Sean Christopherson
2025-05-16 1:03 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 23/38] KVM: x86/pmu: Configure the interception of PMU MSRs Mingwei Zhang
2025-05-15 0:41 ` Sean Christopherson
2025-05-15 5:37 ` Mi, Dapeng
2025-05-15 19:06 ` Sean Christopherson
2025-05-16 13:34 ` Sean Christopherson
2025-05-19 5:18 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 24/38] KVM: x86/pmu: Exclude PMU MSRs in vmx_get_passthrough_msr_slot() Mingwei Zhang
2025-05-16 13:35 ` Sean Christopherson
2025-05-16 14:45 ` Sean Christopherson
2025-05-19 5:21 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 25/38] KVM: x86/pmu: Add AMD PMU registers to direct access list Mingwei Zhang
2025-05-16 13:36 ` Sean Christopherson
2025-03-24 17:31 ` [PATCH v4 26/38] KVM: x86/pmu: Introduce eventsel_hw to prepare for pmu event filtering Mingwei Zhang
2025-05-15 0:42 ` Sean Christopherson
2025-05-15 5:34 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 27/38] KVM: x86/pmu: Handle PMU MSRs interception and " Mingwei Zhang
2025-05-15 0:43 ` Sean Christopherson
2025-05-15 5:38 ` Mi, Dapeng
2025-05-16 1:26 ` Mi, Dapeng
2025-05-16 20:54 ` Sean Christopherson
2025-05-19 4:16 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 28/38] KVM: x86/pmu/svm: Set GuestOnly bit and clear HostOnly bit when guest writes to event selectors Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 29/38] KVM: x86/pmu: Switch host/guest PMU context at vm-exit/vm-entry Mingwei Zhang
2025-05-15 16:29 ` Sean Christopherson
2025-05-16 2:37 ` Mi, Dapeng
2025-05-16 13:26 ` Sean Christopherson
2025-05-19 5:07 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 30/38] KVM: x86/pmu: Handle emulated instruction for mediated vPMU Mingwei Zhang
2025-05-16 1:10 ` Sean Christopherson
2025-03-24 17:31 ` [PATCH v4 31/38] KVM: nVMX: Add macros to simplify nested MSR interception setting Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 32/38] KVM: nVMX: Add nested virtualization support for mediated PMU Mingwei Zhang
2025-05-16 13:33 ` Sean Christopherson
2025-05-19 5:24 ` Mi, Dapeng
2025-03-24 17:31 ` [PATCH v4 33/38] perf/x86/intel: Support PERF_PMU_CAP_MEDIATED_VPMU Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 34/38] perf/x86/amd: Support PERF_PMU_CAP_MEDIATED_VPMU for AMD host Mingwei Zhang
2025-05-21 20:00 ` Namhyung Kim
2025-03-24 17:31 ` [PATCH v4 35/38] KVM: x86/pmu: Expose enable_mediated_pmu parameter to user space Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 36/38] KVM: selftests: Add mediated vPMU supported for pmu tests Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 37/38] KVM: Selftests: Support mediated vPMU for vmx_pmu_caps_test Mingwei Zhang
2025-03-24 17:31 ` [PATCH v4 38/38] KVM: Selftests: Fix pmu_counters_test error for mediated vPMU Mingwei Zhang
2025-04-16 7:22 ` Mi, Dapeng [this message]
2025-04-25 12:27 ` [PATCH v4 00/38] Mediated vPMU 4.0 for x86 Peter Zijlstra
2025-05-06 9:57 ` Mi, Dapeng
2025-05-06 19:45 ` Sean Christopherson
2025-05-07 0:46 ` Mi, Dapeng
2025-05-15 0:49 ` Sean Christopherson
2025-05-15 5:45 ` Mi, Dapeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16d8265b-750d-4e3c-aeb1-772d28b6c79c@linux.intel.com \
--to=dapeng1.mi@linux.intel.com \
--cc=Liang@google.com \
--cc=Manali.Shukla@amd.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=irogers@google.com \
--cc=jmattson@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=mizhang@google.com \
--cc=namhyung@kernel.org \
--cc=nikunj.dadhania@amd.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=sandipan.das@amd.com \
--cc=seanjc@google.com \
--cc=xiong.y.zhang@linux.intel.com \
--cc=yongwei.ma@intel.com \
--cc=zide.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).