OSDN Git Service

selftests/x86/amx: Add context switch test
authorChang S. Bae <chang.seok.bae@intel.com>
Tue, 26 Oct 2021 12:25:25 +0000 (05:25 -0700)
committerBorislav Petkov <bp@suse.de>
Thu, 28 Oct 2021 12:35:27 +0000 (14:35 +0200)
commit101c669d165d341b8c35424eb3878138044394ef
treecbc909ffd919ceabc57afb2b6ee3bcb342f9171d
parent6a3e0651b4a00daa314c59d6e4228dfa7a986983
selftests/x86/amx: Add context switch test

XSAVE state is thread-local.  The kernel switches between thread
state at context switch time.  Generally, running a selftest for
a while will naturally expose it to some context switching and
and will test the XSAVE code.

Instead of just hoping that the tests get context-switched at
random times, force context-switches on purpose.  Spawn off a few
userspace threads and force context-switches between them.
Ensure that the kernel correctly context switches each thread's
unique AMX state.

 [ dhansen: bunches of cleanups ]

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211026122525.6EFD5758@davehans-spike.ostc.intel.com
tools/testing/selftests/x86/amx.c