[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN6q6tfYRXaU6Fg+@google.com>
Date: Thu, 17 Aug 2023 16:19:06 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Jinrong Liang <ljr.kernel@...il.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Like Xu <likexu@...cent.com>,
David Matlack <dmatlack@...gle.com>,
Aaron Lewis <aaronlewis@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jinrong Liang <cloudliang@...cent.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 07/11] KVM: selftests: Test Intel supported fixed
counters bit mask
On Mon, Aug 14, 2023, Jinrong Liang wrote:
> +static void intel_test_fixed_counters(void)
> +{
> + uint8_t nr_fixed_counters = kvm_cpu_property(X86_PROPERTY_PMU_NR_FIXED_COUNTERS);
> + struct kvm_vcpu *vcpu;
> + struct kvm_vm *vm;
> + uint32_t ecx;
> + uint8_t edx;
> +
> + for (edx = 0; edx <= nr_fixed_counters; edx++) {
> + /* KVM doesn't emulate more fixed counters than it can support. */
> + for (ecx = 0; ecx <= (BIT_ULL(nr_fixed_counters) - 1); ecx++) {
> + vm = pmu_vm_create_with_one_vcpu(&vcpu,
> + intel_guest_run_fixed_counters);
> + test_fixed_counters_setup(vcpu, ecx, edx);
> + kvm_vm_free(vm);
Same comments as a previous patch, either use a helper or open code, don't mix
both.
> + }
> + }
> +}
> +
> int main(int argc, char *argv[])
> {
> TEST_REQUIRE(get_kvm_param_bool("enable_pmu"));
> @@ -293,6 +352,7 @@ int main(int argc, char *argv[])
>
> intel_test_arch_events();
> intel_test_counters_num();
> + intel_test_fixed_counters();
>
> return 0;
> }
> --
> 2.39.3
>
Powered by blists - more mailing lists