kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mingwei Zhang <mizhang@google.com>
To: Aaron Lewis <aaronlewis@google.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com,
	seanjc@google.com
Subject: Re: [PATCH v3 8/8] KVM: selftests: Add XCR0 Test
Date: Fri, 3 Mar 2023 21:11:56 +0000	[thread overview]
Message-ID: <ZAJinCYCSwkippR/@google.com> (raw)
In-Reply-To: <CAAAPnDF=upv3Un4VTrTsGsVY6-0Q9TkOEwjwhE0j0OewYKMx_w@mail.gmail.com>

On Thu, Mar 02, 2023, Aaron Lewis wrote:
> On Thu, Mar 2, 2023 at 8:34 PM Mingwei Zhang <mizhang@google.com> wrote:
> > > > On Fri, Feb 24, 2023, Aaron Lewis wrote:
> > > Check both architectural rules and KVM's own software-defined rules to
> > > ensure the supported xfeatures[1] don't violate any of them.
> > >
> > > The architectural rules[2] and KVM's rules ensure for a given
> > > feature, e.g. sse, avx, amx, etc... their associated xfeatures are
> > > either all sets or none of them are set, and any dependencies
> > > are enabled if needed.
> > >
> > > [1] EDX:EAX of CPUID.(EAX=0DH,ECX=0)
> > > [2] SDM vol 1, 13.3 ENABLING THE XSAVE FEATURE SET AND XSAVE-ENABLED
> > >     FEATURES
> > >
> > > Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> >
> > Sorry, I did not get the point of this test? I run your test in an old
> > (unpatched) kernel on two machines: 1) one with AMX and 2) one without
> > it. (SPR and Skylake). Neither of them fails. Do you want to clarify a
> > little bit?
> 
> The only known issue exists on newer versions of the kernel when run
> on SPR.  It occurs after the syscall, prctl (to enable XTILEDATA), was
> introduced.  If you run this test without the fix[1] you will get the
> assert below, indicating the XTILECFG is supported by the guest, but
> XTILEDATA isn't.
> 
> ==== Test Assertion Failure ====
>   x86_64/xcr0_cpuid_test.c:116: false
>   pid=18124 tid=18124 errno=4 - Interrupted system call
>      1 0x0000000000401894: main at xcr0_cpuid_test.c:116
>      2 0x0000000000414263: __libc_start_call_main at libc-start.o:?
>      3 0x00000000004158af: __libc_start_main_impl at ??:?
>      4 0x0000000000401660: _start at ??:?
>   Failed guest assert: !__supported || __supported == ((((((1ULL))) <<
> (18)) | ((((1ULL))) << (17)))) at x86_64/xcr0_cpuid_test.c:72
> 0x20000 0x60000 0x0
> 
> [1] KVM: x86: Clear all supported AMX xfeatures if they are not all set
> https://lore.kernel.org/kvm/20230224223607.1580880-6-aaronlewis@google.com/
> 

Understood. Thanks for reminding me. Yes, without the invocation of
vm_xsave_require_permission(XSTATE_XTILE_DATA_BIT); VM guest will see a
partially enabled feature (XTILECFG without XTILEDATA).

Reviewed-by: Mingwei Zhang <mizhang@google.com>
> >
> >
> > Thanks.
> > -Mingwei

  reply	other threads:[~2023-03-03 21:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 22:35 [PATCH v3 0/8] Clean up the supported xfeatures Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 1/8] KVM: x86: Add kvm_permitted_xcr0() Aaron Lewis
2023-03-03 21:13   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 2/8] KVM: x86: Clear all supported MPX xfeatures if they are not all set Aaron Lewis
2023-03-03 21:23   ` Mingwei Zhang
2023-03-03 22:23     ` Aaron Lewis
2023-03-07 16:32       ` Mingwei Zhang
2023-03-23 20:29   ` Sean Christopherson
2023-03-23 21:10     ` Mingwei Zhang
2023-03-23 21:16       ` Mingwei Zhang
2023-03-23 21:30         ` Sean Christopherson
2023-03-23 21:29       ` Sean Christopherson
2023-02-24 22:36 ` [PATCH v3 3/8] KVM: x86: Clear all supported AVX-512 " Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 4/8] KVM: x86: Clear AVX-512 xfeatures if SSE or AVX is clear Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 5/8] KVM: x86: Clear all supported AMX xfeatures if they are not all set Aaron Lewis
2023-03-03 21:12   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 6/8] KVM: selftests: Hoist XGETBV and XSETBV to make them more accessible Aaron Lewis
2023-03-03 21:24   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 7/8] KVM: selftests: Add XFEATURE masks to common code Aaron Lewis
2023-03-03 21:16   ` Mingwei Zhang
2023-03-03 22:25     ` Aaron Lewis
2023-03-07 16:33       ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 8/8] KVM: selftests: Add XCR0 Test Aaron Lewis
2023-03-02 20:34   ` Mingwei Zhang
2023-03-02 22:50     ` Aaron Lewis
2023-03-03 21:11       ` Mingwei Zhang [this message]
2023-03-23 21:46   ` Sean Christopherson
2023-03-20 15:45 ` [PATCH v3 0/8] Clean up the supported xfeatures Mingwei Zhang
2023-03-23 21:47 ` 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=ZAJinCYCSwkippR/@google.com \
    --to=mizhang@google.com \
    --cc=aaronlewis@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).