All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yosry Ahmed <yosry.ahmed@linux.dev>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Cheng <chengkev@google.com>,
	kvm@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 02/14] x86/vmx: Skip vmx_pf_exception_test_fep early if FEP is not available
Date: Thu, 13 Nov 2025 16:40:12 -0800	[thread overview]
Message-ID: <aRZ6bM_yVo9-zyDT@google.com> (raw)
In-Reply-To: <20251110232642.633672-3-yosry.ahmed@linux.dev>

On Mon, Nov 10, 2025, Yosry Ahmed wrote:
> The check to skip the test is currently performed in the guest code.
> There a few TEST_ASSERTs that happen before the guest is run, which
> internally call report_passed(). The latter increases the number of
> passed tests.
> 
> Hence, when vmx_pf_exception_test_fep is run, report_summary() does not
> return a "skip" error code because the total number of tests is larger
> than the number of skipped tests.
> 
> Skip early if FEP is not available, before any assertions, such that
> report_summary() finds exactly 1 skipped test and returns the
> appropriate error code.
> 
> Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
> ---
>  x86/vmx_tests.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 0b3cfe50c6142..4f214ebdbe1d9 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -10644,7 +10644,10 @@ static void vmx_pf_exception_test(void)
>  
>  static void vmx_pf_exception_forced_emulation_test(void)
>  {
> -	__vmx_pf_exception_test(NULL, NULL, vmx_pf_exception_forced_emulation_test_guest);
> +	if (is_fep_available)
> +		__vmx_pf_exception_test(NULL, NULL, vmx_pf_exception_forced_emulation_test_guest);
> +	else
> +		report_skip("Forced emulation prefix (FEP) not available\n");

To be consistent with other tests, and the kernel's general pattern of:

	if (<error>) {
		<react>
		return;
	}

	<do useful stuff>

I'll tweak this to

	if (!is_fep_available) {
		report_skip("Forced emulation prefix (FEP) not available\n");
		return;
	}

	__vmx_pf_exception_test(NULL, NULL, vmx_pf_exception_forced_emulation_test_guest);

when applying.

  reply	other threads:[~2025-11-14  0:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 23:26 [PATCH v3 00/14] Improvements for (nested) SVM testing Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 01/14] scripts: Always return '2' when skipping tests Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 02/14] x86/vmx: Skip vmx_pf_exception_test_fep early if FEP is not available Yosry Ahmed
2025-11-14  0:40   ` Sean Christopherson [this message]
2025-11-14  0:47     ` Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 03/14] x86/svm: Cleanup selective cr0 write intercept test Yosry Ahmed
2025-11-12 13:48   ` Manali Shukla
2025-11-10 23:26 ` [PATCH v3 04/14] x86/svm: Move CR0 selective write intercept test near CR3 intercept Yosry Ahmed
2025-11-12 13:52   ` Manali Shukla
2025-11-10 23:26 ` [PATCH v3 05/14] x86/svm: Add FEP helpers for SVM tests Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 06/14] x86/svm: Report unsupported " Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 07/14] x86/svm: Move report_svm_guest() to the top of svm_tests.c Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 08/14] x86/svm: Print SVM test names before running tests Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 09/14] x86/svm: Deflake svm_tsc_scale_test Yosry Ahmed
2025-11-14  0:34   ` Sean Christopherson
2025-11-14  5:46     ` Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 10/14] x86/svm: Generalize and improve selective CR0 write intercept test Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 11/14] x86/svm: Add more selective CR0 write and LMSW test cases Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 12/14] x86/svm: Cleanup LBRV tests Yosry Ahmed
2025-11-13 11:58   ` Shivansh Dhiman
2025-11-13 14:59     ` Yosry Ahmed
2025-11-14  4:57       ` Shivansh Dhiman
2025-11-14  5:40         ` Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 13/14] x86/svm: Add more LBRV test cases Yosry Ahmed
2025-11-10 23:26 ` [PATCH v3 14/14] x86/svm: Rename VMCB fields to match KVM Yosry Ahmed
2025-11-14  0:40   ` Sean Christopherson
2025-11-11  0:52 ` [PATCH v3 00/14] Improvements for (nested) SVM testing Sean Christopherson
2025-11-11  0:58   ` Yosry Ahmed
2025-11-14  0:46 ` Sean Christopherson
2025-11-14  5:42   ` 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=aRZ6bM_yVo9-zyDT@google.com \
    --to=seanjc@google.com \
    --cc=chengkev@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yosry.ahmed@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 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.