Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ewan Hai-oc" <ewanhai-oc@zhaoxin.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/8] KVM: selftests: nx_huge_pages_test: Add TDP detection for Zhaoxin CPUs
Date: Thu, 30 Jul 2026 11:43:43 +0000	[thread overview]
Message-ID: <20260730114343.BED2E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730110524.2539316-3-ewanhai-oc@zhaoxin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete Zhaoxin (ZX) CPU support in KVM selftests due to missing VMX behavior checks.
--

--- Patch [2]: [PATCH 2/8] KVM: selftests: nx_huge_pages_test: Add TDP detection for Zhaoxin CPUs ---
commit eac5eaa125fdff453925a87e65268f6af95ed4ee
Author: Frank Zhu <frankzhu@zhaoxin.com>

KVM: selftests: nx_huge_pages_test: Add TDP detection for Zhaoxin CPUs

Update the kvm_is_tdp_enabled() function to include Zhaoxin CPUs when
checking for EPT support, maintaining compatibility while extending
support to ZX CPU systems.

> diff --git a/tools/testing/selftests/kvm/lib/x86/processor.c b/tools/testing/selftests/kvm/lib/x86/processor.c
> index a8ea591ebe8e6..4688cb2b00923 100644
> --- a/tools/testing/selftests/kvm/lib/x86/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86/processor.c
> @@ -156,7 +156,7 @@ static void sregs_dump(FILE *stream, struct kvm_sregs *sregs, u8 indent)
>  
>  bool kvm_is_tdp_enabled(void)
>  {
> -	if (host_cpu_is_intel)
> +	if (host_cpu_is_intel || host_cpu_is_zx)

[Severity: Medium]
Since this adds Zhaoxin (ZX) support here, do other tests that use
host_cpu_is_intel as a proxy for VMX behavior also need to be updated?

ZX CPUs implement VMX but host_cpu_is_intel evaluates to false, which might
cause several tests to incorrectly fall back to AMD behavior or assert.

For example, guest_main() in 
tools/testing/selftests/kvm/x86/fix_hypercall_test.c will hit an assert:

	if (host_cpu_is_intel) {
		native_hypercall_insn = vmx_vmcall;
		other_hypercall_insn  = svm_vmmcall;
	} else if (host_cpu_is_amd_compatible) {
		native_hypercall_insn = svm_vmmcall;
		other_hypercall_insn  = vmx_vmcall;
	} else {
		GUEST_ASSERT(0);
		/* unreachable */
		return;
	}

And kvm_is_mediated_pmu_enabled() in 
tools/testing/selftests/kvm/include/x86/processor.h will incorrectly try to 
read the kvm_amd module parameter:

	if (host_cpu_is_intel)
		return get_kvm_intel_param_bool("enable_mediated_pmu");

	return get_kvm_amd_param_bool("enable_mediated_pmu");

Similar missing checks appear to exist in test_feature_msr() in 
feature_msrs_test.c for the MSR reset value and in main() in 
kvm_buslock_test.c for trap-like exits.

Will these tests crash or fail on ZX CPUs without similar updates?

>  		return get_kvm_intel_param_bool("ept");
>  	else
>  		return get_kvm_amd_param_bool("npt");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730110524.2539316-1-ewanhai-oc@zhaoxin.com?part=2

  reply	other threads:[~2026-07-30 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 11:05 [PATCH 0/8] KVM: selftests: Add Zhaoxin CPU support Ewan Hai-oc
2026-07-30 11:05 ` [PATCH 1/8] KVM: selftests: Add Zhaoxin (ZX) CPU detection support Ewan Hai-oc
2026-07-30 11:26   ` sashiko-bot
2026-07-30 11:05 ` [PATCH 2/8] KVM: selftests: nx_huge_pages_test: Add TDP detection for Zhaoxin CPUs Ewan Hai-oc
2026-07-30 11:43   ` sashiko-bot [this message]
2026-07-30 11:05 ` [PATCH 3/8] KVM: selftests: vmx_exception_with_invalid_guest_state: Support " Ewan Hai-oc
2026-07-30 11:05 ` [PATCH 4/8] KVM: selftests: fix_hypercall_test: Add Zhaoxin CPU support Ewan Hai-oc
2026-07-30 11:05 ` [PATCH 5/8] KVM: selftests: Skip PERF_CAPABILITIES vCPU checks without PDCM Ewan Hai-oc
2026-07-30 11:05 ` [PATCH 6/8] KVM: selftests: feature_msrs_test: Extend MSR_IA32_UCODE_REV quirk to Zhaoxin Ewan Hai-oc
2026-07-30 11:05 ` [PATCH 7/8] KVM: selftests: nested_exceptions_test: Add Zhaoxin CPU support Ewan Hai-oc
2026-07-30 11:05 ` [PATCH 8/8] KVM: selftests: vmx_apic_access_test: Check APIC virtualization support Ewan Hai-oc

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=20260730114343.BED2E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ewanhai-oc@zhaoxin.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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