From: Sean Christopherson <seanjc@google.com>
To: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Jim Mattson <jmattson@google.com>,
Mingwei Zhang <mizhang@google.com>,
Zide Chen <zide.chen@intel.com>,
Das Sandipan <Sandipan.Das@amd.com>,
Shukla Manali <Manali.Shukla@amd.com>,
Yi Lai <yi1.lai@intel.com>, Dapeng Mi <dapeng1.mi@intel.com>
Subject: Re: [PATCH v2 5/5] KVM: selftests: Relax branches event count check for event_filter test
Date: Wed, 10 Sep 2025 16:52:11 -0700 [thread overview]
Message-ID: <aMIPK6ZeTi3_iLzc@google.com> (raw)
In-Reply-To: <20250718001905.196989-6-dapeng1.mi@linux.intel.com>
On Fri, Jul 18, 2025, Dapeng Mi wrote:
> As the branches event overcount issue on Atom platforms, once there are
> VM-Exits triggered (external interrupts) in the guest loop, the measured
> branch event count could be larger than NUM_BRANCHES, this would lead to
> the pmu_event_filter_test print warning to info the measured branches
> event count is mismatched with expected number (NUM_BRANCHES).
>
> To eliminate this warning, relax the branches event count check on the
> Atom platform which have the branches event overcount issue.
>
> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
> Tested-by: Yi Lai <yi1.lai@intel.com>
> ---
This can be squashed with the previous patch, "workaround errata" is a single
logical change as far as I'm concerned.
> tools/testing/selftests/kvm/x86/pmu_event_filter_test.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c
> index c15513cd74d1..9c1a92f05786 100644
> --- a/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c
> +++ b/tools/testing/selftests/kvm/x86/pmu_event_filter_test.c
> @@ -60,6 +60,8 @@ struct {
> uint64_t instructions_retired;
> } pmc_results;
>
> +static uint8_t inst_overcount_flags;
> +
> /*
> * If we encounter a #GP during the guest PMU sanity check, then the guest
> * PMU is not functional. Inform the hypervisor via GUEST_SYNC(0).
> @@ -214,8 +216,10 @@ static void remove_event(struct __kvm_pmu_event_filter *f, uint64_t event)
> do { \
> uint64_t br = pmc_results.branches_retired; \
> uint64_t ir = pmc_results.instructions_retired; \
> + bool br_matched = inst_overcount_flags & BR_RETIRED_OVERCOUNT ? \
> + br >= NUM_BRANCHES : br == NUM_BRANCHES; \
> \
> - if (br && br != NUM_BRANCHES) \
> + if (br && !br_matched) \
> pr_info("%s: Branch instructions retired = %lu (expected %u)\n", \
> __func__, br, NUM_BRANCHES); \
> TEST_ASSERT(br, "%s: Branch instructions retired = %lu (expected > 0)", \
> @@ -850,6 +854,9 @@ int main(int argc, char *argv[])
> if (use_amd_pmu())
> test_amd_deny_list(vcpu);
>
> + if (use_intel_pmu())
Checking for an Intel CPU should be done by the library.
next prev parent reply other threads:[~2025-09-10 23:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 0:19 [PATCH v2 0/5] Fix PMU kselftests errors on GNR/SRF/CWF Dapeng Mi
2025-07-18 0:19 ` [PATCH v2 1/5] KVM: x86/pmu: Correct typo "_COUTNERS" to "_COUNTERS" Dapeng Mi
2025-07-18 0:19 ` [PATCH v2 2/5] KVM: selftests: Add timing_info bit support in vmx_pmu_caps_test Dapeng Mi
2025-09-10 22:03 ` Sean Christopherson
2025-09-11 1:20 ` Mi, Dapeng
2025-07-18 0:19 ` [PATCH v2 3/5] KVM: Selftests: Validate more arch-events in pmu_counters_test Dapeng Mi
2025-09-10 23:51 ` Sean Christopherson
2025-09-11 1:41 ` Mi, Dapeng
2025-07-18 0:19 ` [PATCH v2 4/5] KVM: selftests: Relax precise event count validation as overcount issue Dapeng Mi
2025-09-10 23:56 ` Sean Christopherson
2025-09-11 1:55 ` Mi, Dapeng
2025-07-18 0:19 ` [PATCH v2 5/5] KVM: selftests: Relax branches event count check for event_filter test Dapeng Mi
2025-09-10 23:52 ` Sean Christopherson [this message]
2025-09-10 23:59 ` [PATCH v2 0/5] Fix PMU kselftests errors on GNR/SRF/CWF Sean Christopherson
2025-09-11 1:59 ` Mi, Dapeng
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=aMIPK6ZeTi3_iLzc@google.com \
--to=seanjc@google.com \
--cc=Manali.Shukla@amd.com \
--cc=Sandipan.Das@amd.com \
--cc=dapeng1.mi@intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=yi1.lai@intel.com \
--cc=zide.chen@intel.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.