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 1/8] KVM: selftests: Add Zhaoxin (ZX) CPU detection support
Date: Thu, 30 Jul 2026 11:26:50 +0000	[thread overview]
Message-ID: <20260730112651.319641F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260730110524.2539316-2-ewanhai-oc@zhaoxin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Type punning from `const char *` to `const u32 *` violates strict aliasing rules.
--

--- Patch [1]: [PATCH 1/8] KVM: selftests: Add Zhaoxin (ZX) CPU detection support ---
commit a6b3b2a2cfda9cc7037a7ac4f7079fa35f410950
Author: Frank Zhu <frankzhu@zhaoxin.com>

KVM: selftests: Add Zhaoxin (ZX) CPU detection support
    
Add infrastructure to detect Zhaoxin CPUs in KVM selftests. Zhaoxin
CPUs use vendor strings "CentaurHauls" or "  Shanghai  " and implement
VMX-compatible virtualization technology.

> diff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h
> index b161174ece453..9840b583877c3 100644
> --- a/tools/testing/selftests/kvm/include/x86/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86/processor.h

[ ... ]

> @@ -744,6 +745,12 @@ static inline bool this_cpu_is_hygon(void)
>  	return this_cpu_vendor_string_is("HygonGenuine");
>  }
>  
> +static inline bool this_cpu_is_zx(void)
> +{
> +	return this_cpu_vendor_string_is("CentaurHauls") ||
> +	       this_cpu_vendor_string_is("  Shanghai  ");
> +}

[Severity: Low]
Does passing string literals to this_cpu_vendor_string_is() introduce a
strict aliasing violation?

Since this code is built as a selftest under tools/, standard
-fstrict-aliasing semantics apply rather than the core kernel's
-fno-strict-aliasing rules. Passing a const char * string literal to
this_cpu_vendor_string_is() results in an incompatible pointer cast to
const u32 * during evaluation.

Could this type punning lead to undefined behavior or compiler
misoptimizations?

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

  reply	other threads:[~2026-07-30 11:26 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 [this message]
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
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=20260730112651.319641F00A3A@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