Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yosry Ahmed <yosry@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] KVM: selftests: Add a test for gPAT handling in L2
Date: Fri, 29 May 2026 06:27:26 -0700	[thread overview]
Message-ID: <ahmUPsB2nOPFCRrW@google.com> (raw)
In-Reply-To: <CAO9r8zPA7RTwAD+_-knnTJvFbLJgXzsHYa7a_N2j0JdPAoSoUw@mail.gmail.com>

On Thu, May 28, 2026, Yosry Ahmed wrote:
> > +int main(int argc, char *argv[])
> > +{
> > +       TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
> > +       TEST_REQUIRE(kvm_has_cap(KVM_CAP_NESTED_STATE));
> > +       TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
> > +                    KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT);
> > +
> > +       if (!kvm_cpu_has(X86_FEATURE_NPT))
> > +               goto skip_npt;
> > +
> > +       gpat_test("Invalid gPAT", l1_guest_code_invalid_gpat, npt_enabled = true);
> > +       gpat_test("Nested NPT enabled", l1_guest_code, npt_enabled = true);
> > +skip_npt:
> > +       gpat_test("Nested NPT disabled", l1_guest_code, npt_enabled = false);
> > +       return 0;
> > +}
> 
> The goto is really unnecessary here:
> 
> if (kvm_cpu_has(X86_FEATURE_NPT)) {
>        gpat_test("Invalid gPAT", l1_guest_code_invalid_gpat,
> npt_enabled = true);
>        gpat_test("Nested NPT enabled", l1_guest_code, npt_enabled = true);
> }
> gpat_test("Nested NPT disabled", l1_guest_code, npt_enabled = false);

Well, it's necessary to avoid the indentation.

  reply	other threads:[~2026-05-29 13:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 23:10 [PATCH v4] KVM: selftests: Add a test for gPAT handling in L2 Sean Christopherson
2026-05-29  0:47 ` Yosry Ahmed
2026-05-29 13:27   ` Sean Christopherson [this message]
2026-05-29 14:10     ` Jim Mattson
2026-05-29 22:55       ` Sean Christopherson
2026-05-29 23:01         ` Yosry Ahmed
2026-06-03 18:33           ` Sean Christopherson
2026-06-03 18:39             ` Yosry Ahmed
2026-06-05 18:31 ` Sean Christopherson

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=ahmUPsB2nOPFCRrW@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yosry@kernel.org \
    /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