All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Sang <oliver.sang@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"Yu, Fenghua" <fenghua.yu@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Yu, Yu-cheng" <yu-cheng.yu@intel.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Borislav Petkov <bp@suse.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	"Li, Aubrey" <aubrey.li@intel.com>,
	"Xing, Zhengjun" <zhengjun.xing@linux.intel.com>,
	"Tang, Feng" <feng.tang@intel.com>,
	"Liu, Yujie" <yujie.liu@intel.com>,
	"Si, Beibei" <beibei.si@intel.com>,
	"Li, Philip" <philip.li@intel.com>,
	"Du, Julie" <julie.du@intel.com>
Subject: Re: [patch V3 00/66] x86/fpu: Spring cleaning and PKRU sanitizing
Date: Tue, 22 Jun 2021 09:59:37 +0800	[thread overview]
Message-ID: <20210622015937.GB687@xsang-OptiPlex-9020> (raw)
In-Reply-To: <20210618141823.161158090@linutronix.de>

Hi Thomas,

On Fri, Jun 18, 2021 at 10:18:23PM +0800, Thomas Gleixner wrote:
> The main parts of this series are:
> 
>   - Yet more bug fixes
> 
>   - Simplification and removal/replacement of redundant and/or
>     overengineered code.
> 
>   - Name space cleanup as the existing names were just a permanent source
>     of confusion.
> 
>   - Clear seperation of user ABI and kernel internal state handling.
> 
>   - Removal of PKRU from being XSTATE managed in the kernel because PKRU
>     has to be eagerly restored on context switch and keeping it in sync
>     in the xstate buffer is just pointless overhead and fragile.
> 
>     The kernel still XSAVEs PKRU on context switch but the value in the
>     buffer is not longer used and never restored from the buffer.
> 
>     This still needs to be cleaned up, but the series is already 40+
>     patches large and the cleanup of this is not a functional problem.
> 
>     The functional issues of PKRU management are fully addressed with the
>     series as is.
> 
>   - Cleanup of fpu signal restore
> 
>     - Make the fast path self contained. Handle #PF directly and skip
>       the slow path on any other exception as that will just end up
>       with the same result that the frame is invalid. This allows
>       the compiler to optimize the slow path out for 64bit kernels
>       w/o ia32 emulation.
> 
>     - Reduce code duplication and unnecessary operations
> 
> 
> It applies on top of
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master
> 
> and is also available via git:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu

0-Day kernel CI tested this branch from performance view,
choosing some sub-tests from will-it-scale (detail as below), since we
thought if the branch has the impact of fpu ops, will-it-scale should be
able to catch it.
we also plan to add stress-ng for new round test.
could you suggest if any other suitable test suites? and what's the most
proper sub-tests in will-it-scale and stress-ng?

Test Summary
============
no obvious will-it-scale performance changes found so far

Test Environment
================
https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git/log/?h=x86/fpu
* 0619677ee36c3 (tglx-devel/x86/fpu) x86/fpu/signal: Let xrstor handle the features to init   <----- the tip we tested
* a114fd9946c28 x86/fpu/signal: Handle #PF in the direct restore path
* 73e26fdd0cf1c x86/fpu: Return proper error codes from user access functions
...
* 63bf804bfa6b0 x86/fpu: Make init_fpstate correct with optimized XSAVE
* 6db8e02d5e932 x86/fpu: x86/fpu: Preserve supervisor states in sanitize_restored_user_xstate()
*   4fe93c2272dbb Merge branch 'x86/fpu' of ../tip into x86/fpu    <----- the base we compared
|\
| * b7c11876d24bd (tip/x86/fpu, peterz-queue/x86/fpu) selftests/x86: Test signal frame XSTATE header corruption handling

64bit kernel testing, upon below platform:
model: Cascade Lake
Intel(R) Xeon(R) Gold 6238M CPU @ 2.10GHz
nr_node: 2
nr_cpu: 88
memory: 128G


32bit kernel testing, upon below platform:
Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz
model: Ivy Bridge
nr_node: 1
nr_cpu: 8
memory: 16G


tested below test suites:
will-it-scale-performance-context_switch1
will-it-scale-performance-page_fault1
will-it-scale-performance-poll1
will-it-scale-performance-pthread_mutex1
will-it-scale-performance-writeseek1



> 
> This is a follow up to V2 which can be found here:
> 
>      https://lore.kernel.org/r/20210614154408.673478623@linutronix.de
> 
> Changes vs. V2:
> 
>   - Fixed the testing fallout (Dave, Kan)
> 
>   - Fixed a few issues found by myself when going through the lot
>     with a fine comb, especially MXCSR handling
> 
>   - Drop the FNSAVE optimizations
> 
>   - Cleanup of signal restore
> 
>   - Addressed review comments, mostly comments and a hopefully better
>     naming scheme which now just uses the instruction names and
>     consolidates everything else on save/restore so it's close to the way
>     how the hardware works.
> 
>   - A few cleanups and simplifications on the way (mostly regset related).
> 
>   - Picked up tags
> 
> With the above I'm not intending to do any further surgery on that
> code at the moment, though there is still room for improvement which
> can and has to be worked on when new bits are added.
> 
> Thanks,
> 
>         tglx
> ---
>  arch/x86/events/intel/lbr.c          |    6
>  arch/x86/include/asm/fpu/internal.h  |  211 +++-------
>  arch/x86/include/asm/fpu/xstate.h    |   70 ++-
>  arch/x86/include/asm/pgtable.h       |   57 --
>  arch/x86/include/asm/pkeys.h         |    9
>  arch/x86/include/asm/pkru.h          |   62 +++
>  arch/x86/include/asm/processor.h     |    9
>  arch/x86/include/asm/special_insns.h |   14
>  arch/x86/kernel/cpu/common.c         |   34 -
>  arch/x86/kernel/fpu/core.c           |  276 +++++++------
>  arch/x86/kernel/fpu/init.c           |   15
>  arch/x86/kernel/fpu/regset.c         |  220 ++++++-----
>  arch/x86/kernel/fpu/signal.c         |  423 +++++++++------------
>  arch/x86/kernel/fpu/xstate.c         |  693 ++++++++++++++---------------------
>  arch/x86/kernel/process.c            |   22 -
>  arch/x86/kernel/process_64.c         |   28 +
>  arch/x86/kernel/traps.c              |    5
>  arch/x86/kvm/svm/sev.c               |    1
>  arch/x86/kvm/x86.c                   |   56 +-
>  arch/x86/mm/extable.c                |    2
>  arch/x86/mm/fault.c                  |    2
>  arch/x86/mm/pkeys.c                  |   22 -
>  include/linux/pkeys.h                |    4
>  23 files changed, 1060 insertions(+), 1181 deletions(-)
> 
> 

  parent reply	other threads:[~2021-06-22  1:43 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 14:18 [patch V3 00/66] x86/fpu: Spring cleaning and PKRU sanitizing Thomas Gleixner
2021-06-18 14:18 ` [patch V3 01/66] x86/fpu: x86/fpu: Preserve supervisor states in sanitize_restored_user_xstate() Thomas Gleixner
2021-06-19  8:34   ` Borislav Petkov
2021-06-22 11:45   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2021-06-18 14:18 ` [patch V3 02/66] x86/fpu: Make init_fpstate correct with optimized XSAVE Thomas Gleixner
2021-06-18 20:41   ` Thomas Gleixner
2021-06-18 20:44     ` Borislav Petkov
2021-06-22 11:45   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2021-06-18 14:18 ` [patch V3 03/66] x86/fpu: Fix copy_xstate_to_kernel() gap handling Thomas Gleixner
2021-06-19  9:41   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 04/66] x86/pkeys: Revert a5eff7259790 ("x86/pkeys: Add PKRU value to init_fpstate") Thomas Gleixner
2021-06-18 14:18 ` [patch V3 05/66] x86/fpu: Mark various FPU states __ro_after_init Thomas Gleixner
2021-06-18 14:18 ` [patch V3 06/66] x86/fpu: Make xfeatures_mask_all __ro_after_init Thomas Gleixner
2021-06-20  8:44   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 07/66] x86/fpu: Get rid of fpu__get_supported_xfeatures_mask() Thomas Gleixner
2021-06-20  9:02   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 08/66] x86/fpu: Remove unused get_xsave_field_ptr() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 09/66] x86/fpu: Move inlines where they belong Thomas Gleixner
2021-06-18 14:18 ` [patch V3 10/66] x86/fpu: Limit xstate copy size in xstateregs_set() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 11/66] x86/fpu: Sanitize xstateregs_set() Thomas Gleixner
2021-06-20 21:30   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 12/66] x86/fpu: Reject invalid MXCSR values in copy_kernel_to_xstate() Thomas Gleixner
2021-06-21 10:00   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 13/66] x86/fpu: Simplify PTRACE_GETREGS code Thomas Gleixner
2021-06-18 14:18 ` [patch V3 14/66] x86/fpu: Rewrite xfpregs_set() Thomas Gleixner
2021-06-21 10:20   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 15/66] x86/fpu: Fail ptrace() requests that try to set invalid MXCSR values Thomas Gleixner
2021-06-21 10:17   ` Thomas Gleixner
2021-06-18 14:18 ` [patch V3 16/66] x86/fpu: Clean up fpregs_set() Thomas Gleixner
2021-06-21 12:05   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 17/66] x86/fpu: Make copy_xstate_to_kernel() usable for [x]fpregs_get() Thomas Gleixner
2021-06-21 12:32   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 18/66] x86/fpu: Use copy_xstate_to_uabi_buf() in xfpregs_get() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 19/66] x86/fpu: Use copy_xstate_to_uabi_buf() in fpregs_get() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 20/66] x86/fpu: Remove fpstate_sanitize_xstate() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 21/66] x86/fpu/regset: Move fpu__read_begin() into regset Thomas Gleixner
2021-06-21 13:26   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 22/66] x86/fpu: Move fpu__write_begin() to regset Thomas Gleixner
2021-06-21 15:30   ` Borislav Petkov
2021-06-21 20:15     ` Thomas Gleixner
2021-06-18 14:18 ` [patch V3 23/66] x86/fpu: Get rid of using_compacted_format() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 24/66] x86/kvm: Avoid looking up PKRU in XSAVE buffer Thomas Gleixner
2021-06-18 14:18 ` [patch V3 25/66] x86/fpu: Cleanup arch_set_user_pkey_access() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 26/66] x86/fpu: Get rid of copy_supervisor_to_kernel() Thomas Gleixner
2021-06-18 14:18 ` [patch V3 27/66] x86/fpu: Rename copy_xregs_to_kernel() and copy_kernel_to_xregs() Thomas Gleixner
2021-06-21 18:00   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 28/66] x86/fpu: Rename copy_user_to_xregs() and copy_xregs_to_user() Thomas Gleixner
2021-06-21 19:44   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 29/66] x86/fpu: Rename fxregs related copy functions Thomas Gleixner
2021-06-21 23:00   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 30/66] x86/fpu: Rename fregs " Thomas Gleixner
2021-06-22  9:31   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 31/66] x86/fpu: Rename xstate copy functions which are related to UABI Thomas Gleixner
2021-06-22  9:38   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 32/66] x86/fpu: Deduplicate copy_uabi_from_user/kernel_to_xstate() Thomas Gleixner
2021-06-22 10:09   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 33/66] x86/fpu: Rename copy_fpregs_to_fpstate() to save_fpregs_to_fpstate() Thomas Gleixner
2021-06-22 10:16   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 34/66] x86/fpu: Get rid of the FNSAVE optimization Thomas Gleixner
2021-06-22 10:36   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 35/66] x86/fpu: Rename copy_kernel_to_fpregs() to restore_fpregs_from_kernel() Thomas Gleixner
2021-06-22 10:46   ` Borislav Petkov
2021-06-18 14:18 ` [patch V3 36/66] x86/fpu: Rename initstate copy functions Thomas Gleixner
2021-06-22 10:48   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 37/66] x86/fpu: Rename "dynamic" XSTATEs to "independent" Thomas Gleixner
2021-06-22 11:05   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 38/66] x86/fpu/xstate: Sanitize handling of independent features Thomas Gleixner
2021-06-21 20:42   ` Liang, Kan
2021-06-22 11:32   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 39/66] x86/pkeys: Move read_pkru() and write_pkru() Thomas Gleixner
2021-06-18 14:19 ` [patch V3 40/66] x86/fpu: Rename and sanitize fpu__save/copy() Thomas Gleixner
2021-06-22 13:51   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 41/66] x86/cpu: Sanitize X86_FEATURE_OSPKE Thomas Gleixner
2021-06-22 14:15   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 42/66] x86/pkru: Provide pkru_get_init_value() Thomas Gleixner
2021-06-18 14:19 ` [patch V3 43/66] x86/pkru: Provide pkru_write_default() Thomas Gleixner
2021-06-22 14:30   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 44/66] x86/cpu: Write the default PKRU value when enabling PKE Thomas Gleixner
2021-06-18 14:19 ` [patch V3 45/66] x86/fpu: Use pkru_write_default() in copy_init_fpstate_to_fpregs() Thomas Gleixner
2021-06-18 14:19 ` [patch V3 46/66] x86/fpu: Rename fpu__clear_all() to fpu_flush_thread() Thomas Gleixner
2021-06-22 14:40   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 47/66] x86/fpu: Clean up the fpu__clear() variants Thomas Gleixner
2021-06-22 15:38   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 48/66] x86/fpu: Rename __fpregs_load_activate() to fpregs_restore_userregs() Thomas Gleixner
2021-06-22 15:40   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 49/66] x86/fpu: Move FXSAVE_LEAK quirk info __copy_kernel_to_fpregs() Thomas Gleixner
2021-06-22 15:58   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 50/66] x86/fpu: Rename xfeatures_mask_user() to xfeatures_mask_uabi() Thomas Gleixner
2021-06-22 16:02   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 51/66] x86/fpu: Dont restore PKRU in fpregs_restore_userspace() Thomas Gleixner
2021-06-22 16:08   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 52/66] x86/fpu: Add PKRU storage outside of task XSAVE buffer Thomas Gleixner
2021-06-22 16:55   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 53/66] x86/fpu: Hook up PKRU into ptrace() Thomas Gleixner
2021-06-22 17:01   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 54/66] x86/fpu: Mask PKRU from kernel XRSTOR[S] operations Thomas Gleixner
2021-06-22 17:07   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 55/66] x86/fpu: Remove PKRU handling from switch_fpu_finish() Thomas Gleixner
2021-06-22 17:08   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 56/66] x86/fpu: Dont store PKRU in xstate in fpu_reset_fpstate() Thomas Gleixner
2021-06-22 17:10   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 57/66] x86/pkru: Remove xstate fiddling from write_pkru() Thomas Gleixner
2021-06-22 17:15   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 58/66] x86/fpu: Mark init_fpstate __ro_after_init Thomas Gleixner
2021-06-18 14:19 ` [patch V3 59/66] x86/fpu/signal: Move initial checks into fpu__sig_restore() Thomas Gleixner
2021-06-22 17:35   ` Borislav Petkov
2021-06-22 18:38     ` Thomas Gleixner
2021-06-22 18:43       ` Thomas Gleixner
2021-06-18 14:19 ` [patch V3 60/66] x86/fpu/signal: Remove the legacy alignment check Thomas Gleixner
2021-06-22 17:40   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 61/66] x86/fpu/signal: Sanitize the xstate check on sigframe Thomas Gleixner
2021-06-18 21:02   ` Andrew Cooper
2021-06-18 23:49     ` Thomas Gleixner
2021-06-22 19:10   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 62/66] x86/fpu/signal: Sanitize copy_user_to_fpregs_zeroing() Thomas Gleixner
2021-06-23  7:51   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 63/66] x86/fpu/signal: Split out the direct restore code Thomas Gleixner
2021-06-23  8:10   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 64/66] x86/fpu: Return proper error codes from user access functions Thomas Gleixner
2021-06-23  8:30   ` Borislav Petkov
2021-06-23 10:56     ` Thomas Gleixner
2021-06-18 14:19 ` [patch V3 65/66] x86/fpu/signal: Handle #PF in the direct restore path Thomas Gleixner
2021-06-23  8:45   ` Borislav Petkov
2021-06-18 14:19 ` [patch V3 66/66] x86/fpu/signal: Let xrstor handle the features to init Thomas Gleixner
2021-06-23  8:56   ` Borislav Petkov
2021-06-21 16:15 ` [patch V3 00/66] x86/fpu: Spring cleaning and PKRU sanitizing Yu, Yu-cheng
2021-06-21 21:53 ` Fenghua Yu
2021-06-21 22:22 ` Bae, Chang Seok
2021-06-22 20:02   ` Bae, Chang Seok
2021-06-24  0:06     ` Bae, Chang Seok
2021-06-22  1:59 ` Oliver Sang [this message]
2021-06-22  9:08   ` Thomas Gleixner
2021-06-22 18:56 ` Dey, Megha

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=20210622015937.GB687@xsang-OptiPlex-9020 \
    --to=oliver.sang@intel.com \
    --cc=aubrey.li@intel.com \
    --cc=beibei.si@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=feng.tang@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=julie.du@intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=philip.li@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=yu-cheng.yu@intel.com \
    --cc=yujie.liu@intel.com \
    --cc=zhengjun.xing@linux.intel.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 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.