All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Aaron Lewis <aaronlewis@google.com>, "Christopherson,,
	Sean" <seanjc@google.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"jmattson@google.com" <jmattson@google.com>,
	"Thomas Gleixner" <tglx@linutronix.de>, "bp@suse.de" <bp@suse.de>
Subject: Re: [PATCH v2 1/6] KVM: x86: Clear all supported MPX xfeatures if they are not all set
Date: Tue, 10 Jan 2023 10:32:57 -0800	[thread overview]
Message-ID: <c87904cb-ce6d-1cf4-5b58-4d588660e20f@intel.com> (raw)
In-Reply-To: <CAAAPnDHff-2XFdAgKdfTQnG_a4TCVqWN9wxEhUtiOfiOVMuRWA@mail.gmail.com>

On 1/10/2023 6:49 AM, Aaron Lewis wrote:
> 
> When I run xcr0_cpuid_test it fails because
> xstate_get_guest_group_perm() reports partial support on SPR.  It's
> reporting 0x206e7 rather than the 0x6e7 I was hoping for.  That's why
> I went down the road of sanitizing xcr0.  Though, if it's expected for
> that to report something valid then sanitizing seems like the wrong
> approach.  If xcr0 is invalid it should stay invalid, and it should
> cause a test to fail.

FWIW, we have this [1]:

/* Features which are dynamically enabled for a process on request */
#define XFEATURE_MASK_USER_DYNAMIC	XFEATURE_MASK_XTILE_DATA

IOW, TILE_CFG is not part of the dynamic state. Because this state is 
not XFD-supported, we can't enforce the state use. SDM has relevant text 
here [2]:

"LDTILECFG and TILERELEASE initialize the TILEDATA state component. An 
execution of either of these instructions does not generate #NM when 
XCR0[18] = IA32_XFD[18] = 1; instead, it initializes TILEDATA normally.
(Note that STTILECFG does not use the TILEDATA state component. Thus, an 
execution of this instruction does
not generate #NM when XCR0[18] = IA32_XFD[18] = 1.)"

> Looking at how xstate_get_guest_group_perm() comes through with
> invalid bits I came across this commit:
> 
> 2308ee57d93d ("x86/fpu/amx: Enable the AMX feature in 64-bit mode")
> 
> -       /* [XFEATURE_XTILE_DATA] = XFEATURE_MASK_XTILE, */
> +       [XFEATURE_XTILE_DATA] = XFEATURE_MASK_XTILE_DATA,
> 
> Seems like it should really be:
> 
> +       [XFEATURE_XTILE_DATA] = XFEATURE_MASK_XTILE,

Thus, the change was intentional as far as I can remember.

Thank,
Chang

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/fpu/xstate.h#n50
[2] SDM Vol 1. 13.14 Extended Feature Disable (XFD), 
https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html


  reply	other threads:[~2023-01-10 18:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 16:24 [PATCH v2 0/6] Clean up the supported xfeatures Aaron Lewis
2022-12-30 16:24 ` [PATCH v2 1/6] KVM: x86: Clear all supported MPX xfeatures if they are not all set Aaron Lewis
2023-01-02 15:03   ` Xiaoyao Li
2023-01-03 18:47     ` Sean Christopherson
2023-01-03 18:46   ` Sean Christopherson
2023-01-10 14:49     ` Aaron Lewis
2023-01-10 18:32       ` Chang S. Bae [this message]
2023-01-12 18:21         ` Mingwei Zhang
2023-01-12 18:44           ` Chang S. Bae
2023-01-12 19:17             ` Mingwei Zhang
2023-01-12 20:31               ` Chang S. Bae
2023-01-12 21:21                 ` Mingwei Zhang
2023-01-12 21:33                   ` Chang S. Bae
2023-01-13  0:25                     ` Mingwei Zhang
2023-01-13 14:43                       ` Aaron Lewis
2023-01-17 20:32                         ` Chang S. Bae
2023-01-17 22:39                           ` Mingwei Zhang
2023-01-18  0:34                             ` Chang S. Bae
2022-12-30 16:24 ` [PATCH v2 2/6] KVM: x86: Clear all supported AVX-512 " Aaron Lewis
2023-01-04 16:33   ` Sean Christopherson
2023-01-04 16:39     ` Sean Christopherson
2022-12-30 16:24 ` [PATCH v2 3/6] KVM: x86: Clear all supported AMX " Aaron Lewis
2022-12-30 16:24 ` [PATCH v2 4/6] KVM: selftests: Hoist XGETBV and XSETBV to make them more accessible Aaron Lewis
2022-12-30 16:24 ` [PATCH v2 5/6] KVM: selftests: Add XFEATURE masks to common code Aaron Lewis
2023-01-04 16:43   ` Sean Christopherson
2022-12-30 16:24 ` [PATCH v2 6/6] KVM: selftests: Add XCR0 Test Aaron Lewis
2023-01-04 17:13   ` Sean Christopherson
2023-01-05 22:46     ` Aaron Lewis
2023-01-05 23:10       ` 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=c87904cb-ce6d-1cf4-5b58-4d588660e20f@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=aaronlewis@google.com \
    --cc=bp@suse.de \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    /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.