From: Sean Christopherson <seanjc@google.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Jinrong Liang <cloudliang@tencent.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 7/7] KVM: selftests: Test Intel counters' bit width emulation
Date: Wed, 24 May 2023 15:52:34 -0700 [thread overview]
Message-ID: <ZG6VMrYK2xgR/v95@google.com> (raw)
In-Reply-To: <20230323072714.82289-8-likexu@tencent.com>
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.
next prev parent reply other threads:[~2023-05-24 22:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 7:27 [PATCH 0/7] KVM: selftests: Test the consistency of the PMU's CPUID and its features Like Xu
2023-03-23 7:27 ` [PATCH 1/7] KVM: selftests: Test Intel PMU architectural events on gp counters Like Xu
2023-05-24 22:32 ` Sean Christopherson
2023-05-24 22:59 ` Jim Mattson
2023-03-23 7:27 ` [PATCH 2/7] KVM: selftests: Test Intel PMU architectural events on fixed counters Like Xu
2023-05-24 22:36 ` Sean Christopherson
2023-03-23 7:27 ` [PATCH 3/7] KVM: selftests: Test consistency of CPUID with num of GP counters Like Xu
2023-05-24 22:44 ` Sean Christopherson
2023-03-23 7:27 ` [PATCH 4/7] KVM: selftests: Test consistency of CPUID with num of Fixed counters Like Xu
2023-05-24 22:47 ` Sean Christopherson
2023-05-24 23:08 ` Jim Mattson
2023-03-23 7:27 ` [PATCH 5/7] KVM: selftests: Test Intel supported fixed counters bit mask Like Xu
2023-03-23 7:27 ` [PATCH 6/7] KVM: selftests: Test consistency of PMU MSRs with Intel PMU version Like Xu
2023-03-23 7:27 ` [PATCH 7/7] KVM: selftests: Test Intel counters' bit width emulation Like Xu
2023-05-24 22:52 ` Sean Christopherson [this message]
2023-05-24 22:53 ` [PATCH 0/7] KVM: selftests: Test the consistency of the PMU's CPUID and its features Sean Christopherson
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=ZG6VMrYK2xgR/v95@google.com \
--to=seanjc@google.com \
--cc=cloudliang@tencent.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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