public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	"Chang S. Bae" <chang.seok.bae@intel.com>,
	 linux-kernel@vger.kernel.org, x86@kernel.org,
	tglx@linutronix.de,  mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com,
	 Linus Torvalds <torvalds@linux-foundation.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH RFC v1 02/11] x86/fpu/xstate: Introduce xstate order table and accessor macro
Date: Fri, 28 Feb 2025 07:20:11 -0800	[thread overview]
Message-ID: <Z8HUK9bliN1sZYdL@google.com> (raw)
In-Reply-To: <d1b46250-793e-41a5-9b65-95ed6312bc4a@intel.com>

On Thu, Feb 27, 2025, Dave Hansen wrote:
> On 2/27/25 13:37, Ingo Molnar wrote:
> ...
> >> Like I showed in my earlier example, the CPU enumerates which XSAVE
> >> features are available. These enumeration bits in CPUID leaf 0xd *ARE*
> >> set at boot independent of any other enabling or enumeration. In this
> >> regard, XSAVE enumeration is quite independent of the other parts of the
> >> ISA. This could, in theory, be changed to become dependent on some kind
> >> of APX enabling. But that would be novel for an XSAVE feature.
> > 
> > Yeah. That would be novel for an XSAVE feature - but so is the change 
> > in ordering. With my proposal we'd avoid the 
> > xfeature_noncompact_order[] indirection table AFAICS.
> 
> Yeah, so with your proposal, we could toss out most of this series, so
> roughly 100 lines of code.
> 
> The downsides are:
> 
>  1. It can still confuse userspace, arguably in an architecture
>     violating manner because the SDM says: "If XCR0[4:3] is 11b, the
>     XSAVE feature set can be used to manage MPX state and software can
>     execute Intel MPX instructions." (this would be for userspace)
>    1a. Userspace like GDB still needs code to disambiguate XCR0[3:4]
>  2. It would add complexity in the XSAVE enumeration microcode. CPUID
>     data that comes right out of a ROM today would need to check some
>     CPU enabling state and change the enumeration.
>  3. Linux would still need to go fix up KVM in the kernel, like:
>     https://hansen.beer/~dave/intel/mpxapx.patch . Every APX-enabling
>     VMM would need something similar.
> 
> KVM folks, would you have any issues if XCR0[3:4] (the old MPX bits) got
> used for this new APX feature?

Yes.  I could live with complexity in KVM code, but I agree 100% with Andrew's
take:

  : XGETBV(0) & 0x18 in userspace has a very well defined meaning that is
  : MPX and not "MPX now but something unrelated in the future".

The risk of breaking guest kernels and guest userspace is decidedly non-zero.

  reply	other threads:[~2025-02-28 15:20 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 18:44 [PATCH RFC v1 00/11] x86: Support Intel Advanced Performance Extensions Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 01/11] x86/fpu/xstate: Simplify print_xstate_features() Chang S. Bae
2025-02-27 18:51   ` Dave Hansen
2025-02-27 18:52   ` Ingo Molnar
2025-02-27 19:04   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 02/11] x86/fpu/xstate: Introduce xstate order table and accessor macro Chang S. Bae
2025-02-27 19:03   ` Dave Hansen
2025-02-27 19:34     ` Andrew Cooper
2025-02-27 19:42       ` Ingo Molnar
2025-03-20 23:46     ` Chang S. Bae
2025-02-27 19:05   ` Ingo Molnar
2025-02-27 19:32     ` Dave Hansen
2025-02-27 19:36       ` Ingo Molnar
2025-02-27 19:49         ` Andrew Cooper
2025-02-27 20:06           ` Ingo Molnar
2025-02-27 21:10             ` Andrew Cooper
2025-02-27 21:28               ` Ingo Molnar
2025-02-27 21:30                 ` Ingo Molnar
2025-02-27 22:23                   ` Andrew Cooper
2025-02-28  3:10                   ` Chang S. Bae
2025-02-28 17:11                     ` Ingo Molnar
2025-02-27 19:56         ` Dave Hansen
2025-02-27 20:02           ` Ingo Molnar
2025-02-27 20:19             ` Dave Hansen
2025-02-27 20:29               ` Ingo Molnar
2025-02-27 21:17                 ` Dave Hansen
2025-02-27 21:37                   ` Ingo Molnar
2025-02-27 23:54                     ` Dave Hansen
2025-02-28 15:20                       ` Sean Christopherson [this message]
2025-02-27 18:44 ` [PATCH RFC v1 03/11] x86/fpu/xstate: Remove xstate offset check Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 04/11] x86/fpu/xstate: Adjust XSAVE buffer size calculation Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 05/11] x86/fpu/xstate: Adjust xstate copying logic for user ABI Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 06/11] x86/fpu/mpx: Remove MPX xstate component support Chang S. Bae
2025-02-27 19:12   ` Ingo Molnar
2025-02-28  3:12     ` Chang S. Bae
2025-03-20 23:47       ` Chang S. Bae
2025-04-01 17:13         ` Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 07/11] x86/cpufeatures: Add X86_FEATURE_APX Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 08/11] x86/fpu/apx: Define APX state component Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 09/11] x86/fpu/apx: Disallow conflicting MPX presence Chang S. Bae
2025-02-27 23:16   ` Dave Hansen
2025-02-27 23:58     ` Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 10/11] x86/fpu/apx: Enable APX state support Chang S. Bae
2025-02-27 18:44 ` [PATCH RFC v1 11/11] selftests/x86/apx: Add APX test Chang S. Bae
2025-02-27 19:15 ` [PATCH RFC v1 00/11] x86: Support Intel Advanced Performance Extensions Ingo Molnar
2025-02-27 19:36   ` Dave Hansen
2025-02-28  3:10     ` Chang S. Bae
2025-03-20 23:42 ` [PATCH RFC v2 0/9] " Chang S. Bae
2025-03-20 23:42   ` [PATCH RFC v2 1/9] x86/fpu/xstate: Remove xstate offset check Chang S. Bae
2025-03-25 10:18     ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-14  7:34     ` [tip: x86/merge] " tip-bot2 for Chang S. Bae
2025-03-20 23:42   ` [PATCH RFC v2 2/9] x86/fpu/xstate: Introduce xfeature order table and accessor macro Chang S. Bae
2025-03-25 10:18     ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-14  7:34     ` [tip: x86/merge] " tip-bot2 for Chang S. Bae
2025-03-20 23:42   ` [PATCH RFC v2 3/9] x86/fpu/xstate: Adjust XSAVE buffer size calculation Chang S. Bae
2025-03-25 10:28     ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-14  7:34     ` [tip: x86/merge] " tip-bot2 for Chang S. Bae
2025-03-20 23:42   ` [PATCH RFC v2 4/9] x86/fpu/xstate: Adjust xstate copying logic for user ABI Chang S. Bae
2025-03-25 10:18     ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-03-25 10:28     ` tip-bot2 for Chang S. Bae
2025-04-14  7:34     ` [tip: x86/merge] " tip-bot2 for Chang S. Bae
2025-03-20 23:42   ` [PATCH RFC v2 5/9] x86/cpufeatures: Add X86_FEATURE_APX Chang S. Bae
2025-04-11 16:12     ` [PATCH RFC v2a " Chang S. Bae
2025-04-11 16:54       ` Sohil Mehta
2025-04-11 18:23         ` Chang S. Bae
2025-04-11 21:57           ` Sohil Mehta
2025-04-12  8:43             ` Ingo Molnar
2025-04-14  8:23               ` Ingo Molnar
2025-04-14 17:28                 ` Sohil Mehta
2025-04-14 17:32                   ` Dave Hansen
2025-04-14 17:45                     ` Sohil Mehta
2025-04-14 18:02                       ` Chang S. Bae
2025-04-14 18:12                         ` Sohil Mehta
2025-04-14 18:31                 ` Chang S. Bae
2025-04-16  2:16               ` [PATCH 00/10] x86/fpu: APX enablement and assorted FPU code improvements Chang S. Bae
2025-04-16  2:16                 ` [PATCH 01/10] x86/cpufeatures: Add X86_FEATURE_APX Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 02/10] x86/fpu/apx: Define APX state component Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 03/10] x86/fpu/apx: Disallow conflicting MPX presence Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 04/10] x86/fpu/apx: Enable APX state support Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 05/10] selftests/x86/apx: Add APX test Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 06/10] x86/fpu: Log XSAVE disablement consistently Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16 16:56                   ` [PATCH 06/10] " Sohil Mehta
2025-04-16 17:03                     ` Chang S. Bae
2025-04-16 18:04                       ` Sohil Mehta
2025-04-16  2:16                 ` [PATCH 07/10] x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE Chang S. Bae
2025-04-16  8:05                   ` Ingo Molnar
2025-04-16 16:55                     ` Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 08/10] x86/pkeys: Simplify PKRU update in signal frame Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:16                 ` [PATCH 09/10] x86/fpu: Remove export of mxcsr_feature_mask Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  2:17                 ` [PATCH 10/10] x86/fpu: Rename fpu_reset_fpregs() to fpu_reset_fpstate_regs() Chang S. Bae
2025-04-16  8:17                   ` [tip: x86/fpu] " tip-bot2 for Chang S. Bae
2025-04-16  8:07                 ` [PATCH 00/10] x86/fpu: APX enablement and assorted FPU code improvements Ingo Molnar
2025-04-16 16:56                   ` Chang S. Bae
2025-03-20 23:42   ` [PATCH RFC v2 6/9] x86/fpu/apx: Define APX state component Chang S. Bae
2025-04-11 22:54     ` Sohil Mehta
2025-03-20 23:42   ` [PATCH RFC v2 7/9] x86/fpu/apx: Disallow conflicting MPX presence Chang S. Bae
2025-04-14 17:09     ` Sohil Mehta
2025-04-14 17:25       ` Dave Hansen
2025-03-20 23:42   ` [PATCH RFC v2 8/9] x86/fpu/apx: Enable APX state support Chang S. Bae
2025-04-14 15:41     ` Sohil Mehta
2025-03-20 23:43   ` [PATCH RFC v2 9/9] selftests/x86/apx: Add APX test Chang S. Bae
2025-04-14 16:02     ` Sohil Mehta
2025-03-25 10:25   ` [PATCH RFC v2 0/9] x86: Support Intel Advanced Performance Extensions Ingo Molnar

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=Z8HUK9bliN1sZYdL@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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