On Thu, Mar 23, 2023, Like Xu wrote: > +static uint64_t test_ctrs_bit_width_setup(struct kvm_vcpu *vcpu, > + uint8_t bit_width, > + uint64_t perf_cap, > + uint32_t msr_base) > +{ > + struct kvm_cpuid_entry2 *entry; > + bool fw_wr = perf_cap & PMU_CAP_FW_WRITES; > + uint64_t kvm_width; > + uint64_t value; > + > + entry = vcpu_get_cpuid_entry(vcpu, 0xa); > + if (msr_base != MSR_CORE_PERF_FIXED_CTR0) { > + kvm_width = kvm_gp_ctr_bit_width(); > + entry->eax = (entry->eax & ~GP_WIDTH_MASK) | > + (bit_width << GP_WIDTH_OFS_BIT); > + } else { > + kvm_width = kvm_fixed_ctr_bit_width(); > + entry->edx = (entry->edx & ~FIXED_WIDTH_MASK) | > + (bit_width << FIXED_WIDTH_OFS_BIT); > + } > + TEST_REQUIRE(kvm_width > 31); Unfortunately, using TEST_REQUIRE() in a subtest is generally a bad idea. This will skip _all_ tests if the requirement isn't met. That might be a signal that the test is doing too much, i.e. should be split into multiple tests. Unlike KUT, selftests are more geared towards lots of small tests, not a handful of massive tests.