From: Sean Christopherson <seanjc@google.com>
To: Jinrong Liang <ljr.kernel@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Like Xu <likexu@tencent.com>,
David Matlack <dmatlack@google.com>,
Aaron Lewis <aaronlewis@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jinrong Liang <cloudliang@tencent.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/8] KVM: selftests: Test Intel supported fixed counters bit mask
Date: Wed, 28 Jun 2023 14:05:28 -0700 [thread overview]
Message-ID: <ZJygmEIjdWHcqMQ7@google.com> (raw)
In-Reply-To: <20230530134248.23998-8-cloudliang@tencent.com>
On Tue, May 30, 2023, Jinrong Liang wrote:
> +static void test_fixed_counters_setup(struct kvm_vcpu *vcpu, uint8_t edx_fix_num,
> + uint32_t fixed_bitmask, bool expected)
> +{
> + struct kvm_cpuid_entry2 *entry;
> + uint8_t max_fixed_num = X86_INTEL_MAX_FIXED_CTR_NUM;
> + uint64_t supported_bitmask = 0;
> + uint64_t msr_val;
> + unsigned int i;
> +
> + entry = vcpu_get_cpuid_entry(vcpu, 0xa);
> + entry->ecx = fixed_bitmask;
> + entry->edx = (entry->edx & ~FIXED_CTR_NUM_MASK) | edx_fix_num;
> + vcpu_set_cpuid(vcpu);
> +
> + for (i = 0; i < max_fixed_num; i++) {
> + if (entry->ecx & BIT_ULL(i) ||
> + ((entry->edx & FIXED_CTR_NUM_MASK) > i))
> + supported_bitmask |= BIT_ULL(i);
> + }
> +
> + vcpu_args_set(vcpu, 2, supported_bitmask, max_fixed_num);
All of this can be queried from the guest, no? Then you also verify that KVM is
passing in the correct CPUID info too.
> + while (run_vcpu(vcpu, &msr_val) != UCALL_DONE)
> + TEST_ASSERT(!!msr_val == expected,
> + "Unexpected when testing fixed counter.");
ASSERT_EQ()
next prev parent reply other threads:[~2023-06-28 21:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 13:42 [PATCH v2 0/8] KVM: selftests: Test the consistency of the PMU's CPUID and its features Jinrong Liang
2023-05-30 13:42 ` [PATCH v2 1/8] KVM: selftests: KVM: selftests: Add macros for fixed counters in processor.h Jinrong Liang
2023-06-28 19:46 ` Sean Christopherson
2023-05-30 13:42 ` [PATCH v2 2/8] KVM: selftests: Add pmu.h for PMU events and common masks Jinrong Liang
2023-06-28 20:02 ` Sean Christopherson
2023-05-30 13:42 ` [PATCH v2 3/8] KVM: selftests: Test Intel PMU architectural events on gp counters Jinrong Liang
2023-06-28 20:43 ` Sean Christopherson
2023-06-28 21:03 ` Jim Mattson
2023-05-30 13:42 ` [PATCH v2 4/8] KVM: selftests: Test Intel PMU architectural events on fixed counters Jinrong Liang
2023-05-30 13:42 ` [PATCH v2 5/8] KVM: selftests: Test consistency of CPUID with num of gp counters Jinrong Liang
2023-05-30 13:42 ` [PATCH v2 6/8] KVM: selftests: Test consistency of CPUID with num of fixed counters Jinrong Liang
2023-06-28 21:01 ` Sean Christopherson
2023-05-30 13:42 ` [PATCH v2 7/8] KVM: selftests: Test Intel supported fixed counters bit mask Jinrong Liang
2023-06-28 21:05 ` Sean Christopherson [this message]
2023-05-30 13:42 ` [PATCH v2 8/8] KVM: selftests: Test consistency of PMU MSRs with Intel PMU version Jinrong Liang
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=ZJygmEIjdWHcqMQ7@google.com \
--to=seanjc@google.com \
--cc=aaronlewis@google.com \
--cc=cloudliang@tencent.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=likexu@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ljr.kernel@gmail.com \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.