From: Sean Christopherson <seanjc@google.com>
To: Kevin Cheng <chengkev@google.com>
Cc: kvm@vger.kernel.org, yosryahmed@google.com,
andrew.jones@linux.dev, thuth@redhat.com, pbonzini@redhat.com
Subject: Re: [kvm-unit-tests PATCH V2 10/10] x86/svm: Add test for #UD when EFER.SVME=0
Date: Wed, 18 Feb 2026 12:44:04 -0800 [thread overview]
Message-ID: <aZYklHat_pun9ure@google.com> (raw)
In-Reply-To: <20260113003153.3344500-11-chengkev@google.com>
On Tue, Jan 13, 2026, Kevin Cheng wrote:
> +static void svm_ud_test_handler(struct ex_regs *regs)
> +{
> + ud_fired = true;
> + regs->rip += 3;
> +}
> +
> +static void svm_ud_test(void)
> +{
> + u64 efer = rdmsr(MSR_EFER);
> +
> + handle_exception(UD_VECTOR, svm_ud_test_handler);
> + wrmsr(MSR_EFER, efer & ~EFER_SVME);
> +
> + insn_invlpga();
Eh, just add proper helpers, or open code the asm. And definitely use asm_safe()
instead of wiring up a dedicated #UD handler. Ha! And past me even proactively
waged war on copy+paste exception handling.
Untested, but something like this should work.
asm_safe_report_ex("invlpga %rax, %ecx", "a"(0), "c"(0));
asm_safe_report_ex("vmrun %rax", "a"(0));
asm_safe_report_ex("vmsave %rax", "a"(0));
asm_safe_report_ex("vmload %rax", "a"(0));
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index 118e7cdd0286d..ad447e5f82f9f 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -253,11 +253,19 @@ arch = x86_64
> [svm]
> file = svm.flat
> smp = 2
> -test_args = "-pause_filter_test -svm_intr_intercept_mix_smi -svm_insn_intercept_test -svm_pf_exception_test -svm_pf_exception_forced_emulation_test -svm_pf_inv_asid_test -svm_pf_inv_tlb_ctl_test -svm_event_injection"
> +test_args = "-pause_filter_test -svm_intr_intercept_mix_smi -svm_insn_intercept_test -svm_pf_exception_test -svm_pf_exception_forced_emulation_test -svm_pf_inv_asid_test -svm_pf_inv_tlb_ctl_test -svm_event_injection -svm_ud_test"
> qemu_params = -cpu max,+svm -m 4g
> arch = x86_64
> groups = svm
>
> +# Disable SKINIT and SVML to test STGI #UD when EFER.SVME=0
> +[svm_ud_test]
> +file = svm.flat
> +test_args = svm_ud_test
> +qemu_params = -cpu max,-skinit,-svm-lock,+svm -m 4g
KVM doesn't support SKINIT or SVM-LOCK, carving out a separate config just to
disable things that aren't supported is pointless. If QEMU TCG gets false
failures due to its default model emulating the interactions with SKINIT and/or
SVM-LOCK, then I'd prefer to account for that in the test, not in the config.
> +arch = x86_64
> +groups = svm
> +
> [svm_event_injection]
> file = svm.flat
> test_args = svm_event_injection
> --
> 2.52.0.457.g6b5491de43-goog
>
prev parent reply other threads:[~2026-02-18 20:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 0:31 [kvm-unit-tests PATCH V2 00/10] Improve test parity between SVM and VMX Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 01/10] x86/svm: Fix virq_inject SVM test failure Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 02/10] x86/nSVM: Add test for NPT A/D bits Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 03/10] x86/svm: Add tests for APIC passthrough Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 04/10] x86/nSVM: Add tests for instruction interrupts Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 05/10] x86/svm: Add tests for PF exception testing Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 06/10] x86/svm: Extend NPT test coverage for different page table levels Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 07/10] x86/svm: Add NPT ignored bits test Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 08/10] x86/svm: Add testing for NPT permissions on guest page tables Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 09/10] x86/svm: Add event injection check tests Kevin Cheng
2026-01-13 0:31 ` [kvm-unit-tests PATCH V2 10/10] x86/svm: Add test for #UD when EFER.SVME=0 Kevin Cheng
2026-02-18 20:44 ` Sean Christopherson [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=aZYklHat_pun9ure@google.com \
--to=seanjc@google.com \
--cc=andrew.jones@linux.dev \
--cc=chengkev@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
--cc=yosryahmed@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.