Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tina Zhang" <zhang_wei@open-hieco.net>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v8 8/8] KVM: selftests: Add nested SVM DecodeAssists test
Date: Wed, 23 Sep 2026 14:37:06 +0000	[thread overview]
Message-ID: <20260923143706.7E50A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <b16dc4ca74d0337c5535813d48f5ea206b3d5a87.1790171702.git.zhang_wei@open-hieco.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] kvm: selftests: missing .global directive on inline assembly labels causes LTO link error
--

commit 08e87505d5c0bae297f7e3e768c2e12a61d10322
Author: Tina Zhang <zhang_wei@open-hieco.net>

KVM: selftests: Add nested SVM DecodeAssists test

This commit adds a nested SVM selftest to verify KVM's virtualization of
DecodeAssists. It covers instruction byte extraction for various instructions
and edge cases such as synthesized nested page faults and userspace-injected
page faults.

> diff --git a/tools/testing/selftests/kvm/x86/svm_nested_decode_assists_test.c b/tools/testing/selftests/kvm/x86/svm_nested_decode_assists_test.c
> new file mode 100644
> index 0000000000000..aba91d8bb1a28
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/x86/svm_nested_decode_assists_test.c
> @@ -0,0 +1,590 @@

[ ... ]

> +extern u8 l2_movsb_insn[];
> +
> +static void l2_movsb_code(void)
> +{
> +	asm volatile("mov %0, %%rsi\n\t"
> +		     "mov %1, %%rdi\n\t"
> +		     "l2_movsb_insn:\n\t"

[Severity: Low]
Is a .global (or .globl) directive needed for this assembly label? 

When building the selftests with Link-Time Optimization (LTO) enabled, the 
l2_movsb_code function and the functions referencing the extern l2_movsb_insn 
array (like test_synthesized_npf_after_hardware_npf) might be partitioned 
into different LTRANS units. 

Since this label lacks a global directive, it remains strictly local to its 
inline assembly block's partition. The linker therefore cannot resolve the 
extern declaration in other partitions, causing an undefined reference build 
error.

> +		     "movsb"
> +		     : : "r"(&mmio_source), "r"(&npf_target)
> +		     : "rsi", "rdi", "memory");
> +	GUEST_FAIL("L2 MOVSB did not cause a nested page fault");
> +}
> +
> +extern u8 l2_userspace_pf_insn[];
> +
> +static void l2_userspace_pf_code(void)
> +{
> +	asm volatile("movzbl (%0), %%eax\n\t"
> +		     "l2_userspace_pf_insn:\n\t"

[Severity: Low]
Does this label also need a .global directive to prevent LTO linkage failures, 
similar to the l2_movsb_insn label above?

> +		     "nop"
> +		     : : "r"(&mmio_source) : "rax", "memory");
> +	GUEST_FAIL("Userspace-injected #PF was not intercepted by L1");
> +}
> +

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790171702.git.zhang_wei@open-hieco.net?part=8

      reply	other threads:[~2026-09-23 14:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 14:02 [PATCH v8 0/8] KVM: nSVM: Enable DecodeAssists for nested guests Tina Zhang
2026-09-23 14:02 ` [PATCH v8 1/8] KVM: x86: Provide INVLPG linear address to intercept handlers Tina Zhang
2026-09-23 19:49   ` Jim Mattson
2026-09-23 14:02 ` [PATCH v8 2/8] KVM: nSVM: Synthesize DecodeAssists EXITINFO for emulated intercepts Tina Zhang
2026-09-23 14:02 ` [PATCH v8 3/8] KVM: nSVM: Track valid hardware DecodeAssist bytes Tina Zhang
2026-09-23 14:02 ` [PATCH v8 4/8] KVM: nSVM: Propagate hardware DecodeAssist bytes to VMCB12 Tina Zhang
2026-09-23 14:02 ` [PATCH v8 5/8] KVM: nSVM: Fetch DecodeAssist bytes for synthesized faults Tina Zhang
2026-09-23 22:20   ` Jim Mattson
2026-09-30 12:24     ` Tina Zhang
2026-09-23 14:02 ` [PATCH v8 6/8] KVM: nSVM: Use emulator bytes for synthesized nested #NPF Tina Zhang
2026-09-23 14:02 ` [PATCH v8 7/8] KVM: nSVM: Advertise DecodeAssists to L1 Tina Zhang
2026-09-23 14:34   ` sashiko-bot
2026-09-23 14:02 ` [PATCH v8 8/8] KVM: selftests: Add nested SVM DecodeAssists test Tina Zhang
2026-09-23 14:37   ` sashiko-bot [this message]

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=20260923143706.7E50A1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhang_wei@open-hieco.net \
    /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