From: sashiko-bot@kernel.org
To: "Sean Christopherson" <seanjc@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v8 4/5] KVM: selftests: Add a helper to query enable_mediated_pmu module param
Date: Wed, 10 Jun 2026 00:41:16 +0000 [thread overview]
Message-ID: <20260610004117.3F0FC1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260610003030.2957261-5-seanjc@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] kvm_is_mediated_pmu_enabled() incorrectly queries the kvm_amd module on Centaur and Zhaoxin CPUs, causing tests to needlessly skip.
--
commit f89432ff2f99beb9b018032f8161522a25f18627
Author: Sean Christopherson <seanjc@google.com>
KVM: selftests: Add a helper to query enable_mediated_pmu module param
This commit adds a utility function to check if the mediated PMU is enabled
by querying the vendor-specific KVM module parameter.
> diff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h
> --- a/tools/testing/selftests/kvm/include/x86/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86/processor.h
[ ... ]
> +static inline bool kvm_is_mediated_pmu_enabled(void)
> +{
> + if (host_cpu_is_intel)
> + return get_kvm_intel_param_bool("enable_mediated_pmu");
> +
> + return get_kvm_amd_param_bool("enable_mediated_pmu");
[Severity: Medium]
Will this cause tests to needlessly skip on Centaur and Zhaoxin CPUs?
Since host_cpu_is_intel only evaluates to true for GenuineIntel CPUs,
VMX-compatible CPUs like Centaur and Zhaoxin will fall through and call
get_kvm_amd_param_bool("enable_mediated_pmu").
Because those platforms use the kvm_intel module, querying the kvm_amd
parameters will result in a missing file (ENOENT), which aborts the
execution with a ksft_exit_skip().
Would it be safer to pivot on host_cpu_is_amd_compatible to check AMD,
and then fall back to Intel for everything else?
> +}
> +
> static inline bool kvm_is_forced_emulation_enabled(void)
> {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260610003030.2957261-1-seanjc@google.com?part=4
next prev parent reply other threads:[~2026-06-10 0:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 0:30 [PATCH v8 0/5] KVM: selftests: Add AMD PMU Host/Guest test Sean Christopherson
2026-06-10 0:30 ` [PATCH v8 1/5] KVM: selftests: Refactor allocating guest stack into a helper Sean Christopherson
2026-06-10 0:30 ` [PATCH v8 2/5] KVM: selftests: Allocate a dedicated guest page for x86 L2 guest stack Sean Christopherson
2026-06-10 0:30 ` [PATCH v8 3/5] KVM: selftests: Drop L1-provided stacks for L2 guests on x86 Sean Christopherson
2026-06-10 0:30 ` [PATCH v8 4/5] KVM: selftests: Add a helper to query enable_mediated_pmu module param Sean Christopherson
2026-06-10 0:41 ` sashiko-bot [this message]
2026-06-10 0:30 ` [PATCH v8 5/5] KVM: selftests: Add svm_pmu_host_guest_test for Host-Only/Guest-Only bits Sean Christopherson
2026-06-10 1:02 ` Yosry Ahmed
2026-06-10 1:02 ` [PATCH v8 0/5] KVM: selftests: Add AMD PMU Host/Guest test Yosry Ahmed
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=20260610004117.3F0FC1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=seanjc@google.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.