]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/x86/xstate: Refactor context switching test
authorChang S. Bae <chang.seok.bae@intel.com>
Wed, 26 Feb 2025 01:07:24 +0000 (17:07 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 26 Feb 2025 12:05:29 +0000 (13:05 +0100)
commit40f6852ef2bffcd6fb3634cf71e6fbc2d1d6b768
treeaba5ac9ed408a08259bb94cbde2bacf8b0a80f7a
parent3fcb4d61465613aee76ebd5d86b488778657dda7
selftests/x86/xstate: Refactor context switching test

The existing context switching and ptrace tests in amx.c are not specific
to dynamic states, making them reusable for general xstate testing.

As a first step, move the context switching test to xstate.c. Refactor
the test code to allow specifying which xstate component being tested.

To decouple the test from dynamic states, remove the permission request
code. In fact, The permission request inside the test wrapper was
redundant.

Additionally, replace fatal_error() with ksft_exit_fail_msg() for
consistency in error handling.

  Expected output:
  $ amx_64
  ...
  [RUN]   AMX Tile data: check context switches, 10 iterations, 5 threads.
  [OK]    No incorrect case was found.

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250226010731.2456-5-chang.seok.bae@intel.com
tools/testing/selftests/x86/Makefile
tools/testing/selftests/x86/amx.c
tools/testing/selftests/x86/xstate.c [new file with mode: 0644]
tools/testing/selftests/x86/xstate.h