lkml.org 
[lkml]   [2023]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 07/11] KVM: selftests: Test Intel supported fixed counters bit mask
From
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
>

\
 
 \ /
  Last update: 2023-08-18 01:20    [W:0.171 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site