Re: [PATCH v3 02/14] x86/vmx: Skip vmx_pf_exception_test_fep early if FEP is not available

Yosry Ahmed
2025-11-14T00:48:23Z

On Thu, Nov 13, 2025 at 04:40:12PM -0800, Sean Christopherson wrote:
> 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.

LGTM, thanks!