[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZG/h2kW8cTY5CuFN@google.com>
Date: Thu, 25 May 2023 15:35:19 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Anselm Busse <abusse@...zon.com>
Cc: dwmw@...zon.co.uk, hborghor@...zon.de, sironi@...zon.de,
Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] KVM: vmx/pmu: Indicate available fixed function PMCs
through a bitmap
On Thu, Apr 27, 2023, Anselm Busse wrote:
> This commit changes the tracking of available fixed function counters
> from a number to a bitmap.
>
> Starting with Intel PMU v5, the available fixed function counters cannot
> only be advertised through a number, but also through a bitmap in
> CPUID.0AH.ECX. However, the current KVM implementation determines if a
> fixed function PMC is available to a guest purely based on the number
> of exposed fixed function PMCs. This makes it impossible to use this
> new feature of the Intel PMU v5. Therefore, this change serves as a
> preparation to seamlessly enable the virtualization of Intel PMU v5 in
> the future.
>
> No functional change intended.
>
> Signed-off-by: Anselm Busse <abusse@...zon.com>
> ---
> arch/x86/include/asm/kvm_host.h | 2 +-
> arch/x86/kvm/pmu.h | 6 +++---
> arch/x86/kvm/svm/pmu.c | 2 +-
> arch/x86/kvm/vmx/pmu_intel.c | 33 ++++++++++++++++++---------------
> 4 files changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 808c292ad3f4..ea4859554678 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -516,7 +516,7 @@ struct kvm_pmc {
> #define KVM_AMD_PMC_MAX_GENERIC 6
> struct kvm_pmu {
> unsigned nr_arch_gp_counters;
> - unsigned nr_arch_fixed_counters;
> + DECLARE_BITMAP(mask_arch_fixed_counters, INTEL_PMC_MAX_FIXED);
Please see the feedback I gave to Like[*]. Unless I'm missing something, there's
no need for another bitmap.
[*] https://lore.kernel.org/kvm/ZB4oUhmIKPF2lAzN@google.com
Powered by blists - more mailing lists