linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] selftests/x86/xstate: Introduce common code for testing extended states
@ 2025-02-26  1:07 Chang S. Bae
  2025-02-26  1:07 ` [PATCH 1/9] selftests/x86: Consolidate redundant signal helper functions Chang S. Bae
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Chang S. Bae @ 2025-02-26  1:07 UTC (permalink / raw)
  To: linux-kernel, linux-kselftest
  Cc: x86, tglx, mingo, bp, dave.hansen, shuah, chang.seok.bae

Hi all,

This series proposes a rework of xstate-related tests to improve
maintainability and expand test coverage.

== Motivation: Addressing Missing and New XSTATE Tests ==

With the introduction of AMX, a new test suite [1] was created to verify
dynamic state handling by the kernel as observed from userspace. However,
previous tests for non-dynamic states like AVX lacked ABI validation,
leaving gaps in coverage. While these states currently function without
major issues (following the alternate sigstack fix [2]), xstate testing
in the x86 selftest suite has been largely overlooked.

Now, with Intel introducing another extended state, Advanced Performance
Extensions (APX) [3], a correspondent test case is need. The APX enabling
series will follow shortly and will leverage this refactored selftest
framework.

== Selftest Code Rework ==

To ensure ABI validation and core functionality across various xstates,
refactoring the test code is necessary. Without this, existing code from
amx.c would need to be duplicated, compromising the structural quality of
xstate tests.

This series introduces a shared test framework for extended state
validation, applicable to both existing and new xstates. The test cases
cover:
* Context switching
* ABI compatibility for signal handling
* ABI compatibility for ptrace interactions

== Patch Organization ==

The patchset is structured as follows:

* PATCH1: Preparatory cleanup — removing redundant signal handler
  registration code.
* PATCH2/3: Introduce low-level XSAVE helpers and xstate component
  enumeration.
* PATCH4/5: Refactor existing test code.
* PATCH6: Introduce a new signal test case.
* PATCH7/8: Consolidate test invocations and clarify the list of
  supported features.
* PATCH9: Add test coverage for AVX.

== Coverage and Future Work Considerations ==

Currently, these tests are aligned with 64-bit mode only. Support for
32-bit cases will be considered when necessary, but only after this phase
of rework is finalized.

FWIW, the AMX TILECFG state is trivial, requiring almost constant values.
Additionally, various PKRU tests are already established in
tools/selftests/mm.

This series is based on the tip/master branch. You can also find it in
the following repository:
    git://github.com/intel/apx.git selftest-xstate_v1

Thanks,
Chang

[1] https://lore.kernel.org/all/20211026122523.AFB99C1F@davehans-spike.ostc.intel.com/
[2] https://lore.kernel.org/lkml/20210518200320.17239-1-chang.seok.bae@intel.com/
[3] https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-performance-extensions-apx.html

Chang S. Bae (9):
  selftests/x86: Consolidate redundant signal helper functions
  selftests/x86/xstate: Refactor XSAVE helpers for general use
  selftests/x86/xstate: Enumerate and name xstate components
  selftests/x86/xstate: Refactor context switching test
  selftests/x86/xstate: Refactor ptrace ABI test
  selftests/x86/xstate: Introduce signal ABI test
  selftests/x86/xstate: Consolidate test invocations into a single entry
  selftests/x86/xstate: Clarify supported xstates
  selftests/x86/avx: Add AVX test

 tools/testing/selftests/x86/Makefile          |   6 +-
 tools/testing/selftests/x86/amx.c             | 442 +---------------
 tools/testing/selftests/x86/avx.c             |  12 +
 .../selftests/x86/corrupt_xstate_header.c     |  14 +-
 tools/testing/selftests/x86/entry_from_vm86.c |  24 +-
 tools/testing/selftests/x86/fsgsbase.c        |  24 +-
 tools/testing/selftests/x86/helpers.h         |  28 +
 tools/testing/selftests/x86/ioperm.c          |  25 +-
 tools/testing/selftests/x86/iopl.c            |  25 +-
 tools/testing/selftests/x86/ldt_gdt.c         |  18 +-
 tools/testing/selftests/x86/mov_ss_trap.c     |  14 +-
 tools/testing/selftests/x86/ptrace_syscall.c  |  24 +-
 tools/testing/selftests/x86/sigaltstack.c     |  26 +-
 tools/testing/selftests/x86/sigreturn.c       |  24 +-
 .../selftests/x86/single_step_syscall.c       |  22 -
 .../testing/selftests/x86/syscall_arg_fault.c |  12 -
 tools/testing/selftests/x86/syscall_nt.c      |  12 -
 tools/testing/selftests/x86/sysret_rip.c      |  24 +-
 tools/testing/selftests/x86/test_vsyscall.c   |  13 -
 tools/testing/selftests/x86/unwind_vdso.c     |  12 -
 tools/testing/selftests/x86/xstate.c          | 477 ++++++++++++++++++
 tools/testing/selftests/x86/xstate.h          | 195 +++++++
 22 files changed, 753 insertions(+), 720 deletions(-)
 create mode 100644 tools/testing/selftests/x86/avx.c
 create mode 100644 tools/testing/selftests/x86/xstate.c
 create mode 100644 tools/testing/selftests/x86/xstate.h


base-commit: 5bff053d066ba892464995ae4a7246f7a78fce2d
-- 
2.45.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-02-26 12:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26  1:07 [PATCH 0/9] selftests/x86/xstate: Introduce common code for testing extended states Chang S. Bae
2025-02-26  1:07 ` [PATCH 1/9] selftests/x86: Consolidate redundant signal helper functions Chang S. Bae
2025-02-26  1:07 ` [PATCH 2/9] selftests/x86/xstate: Refactor XSAVE helpers for general use Chang S. Bae
2025-02-26  1:07 ` [PATCH 3/9] selftests/x86/xstate: Enumerate and name xstate components Chang S. Bae
2025-02-26  1:07 ` [PATCH 4/9] selftests/x86/xstate: Refactor context switching test Chang S. Bae
2025-02-26  1:07 ` [PATCH 5/9] selftests/x86/xstate: Refactor ptrace ABI test Chang S. Bae
2025-02-26  1:07 ` [PATCH 6/9] selftests/x86/xstate: Introduce signal " Chang S. Bae
2025-02-26  1:07 ` [PATCH 7/9] selftests/x86/xstate: Consolidate test invocations into a single entry Chang S. Bae
2025-02-26  1:07 ` [PATCH 8/9] selftests/x86/xstate: Clarify supported xstates Chang S. Bae
2025-02-26  1:07 ` [PATCH 9/9] selftests/x86/avx: Add AVX test Chang S. Bae
2025-02-26 12:07 ` [PATCH 0/9] selftests/x86/xstate: Introduce common code for testing extended states Ingo Molnar

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).