History log of /linux-master/tools/testing/selftests/powerpc/math/fpu_preempt.c
Revision Date Author Comments
# 60d2c3af 28-Nov-2023 Michael Ellerman <mpe@ellerman.id.au>

selftests/powerpc: Run fpu_preempt test for 60 seconds

The FPU preempt test only runs for 20 seconds, which is not particularly
long. Run it for 60 seconds to increase the chance of detecting
corruption.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231128132748.1990179-4-mpe@ellerman.id.au


# 2ba107f6 28-Nov-2023 Michael Ellerman <mpe@ellerman.id.au>

selftests/powerpc: Generate better bit patterns for FPU tests

The fpu_preempt test randomly initialises an array of doubles to try and
detect FPU register corruption.

However the values it generates do not occupy the full range of values
possible in the 64-bit double, meaning some partial register corruption
could go undetected.

Without getting too carried away, add some better initialisation to
generate values that occupy more bits.

Sample values before:

f0 902677510 (raw 0x41cae6e203000000)
f1 325217596 (raw 0x41b3626d3c000000)
f2 1856578300 (raw 0x41dbaa48bf000000)
f3 1247189984 (raw 0x41d295a6f8000000)

And after:

f0 1.1078153481413311e-09 (raw 0x3e13083932805cc2)
f1 1.0576648474801922e+17 (raw 0x43777c20eb88c261)
f2 -6.6245033413594075e-10 (raw 0xbe06c2f989facae9)
f3 3.0085988827156291e+18 (raw 0x43c4e0585f2df37b)

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231128132748.1990179-3-mpe@ellerman.id.au


# e5d00aaa 28-Nov-2023 Michael Ellerman <mpe@ellerman.id.au>

selftests/powerpc: Check all FPRs in fpu_preempt

There's a selftest that checks FPRs aren't corrupted by preemption, or
just process scheduling. However it only checks the non-volatile FPRs,
meaning corruption of the volatile FPRs could go undetected.

The check_fpu function it calls is used by several other tests, so for
now add a new routine to check all the FPRs. Increase the size of the
array of FPRs to 32, and initialise them all with random values.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231128132748.1990179-2-mpe@ellerman.id.au


# 9dbd5927 28-Nov-2023 Michael Ellerman <mpe@ellerman.id.au>

selftests/powerpc: Fix error handling in FPU/VMX preemption tests

The FPU & VMX preemption tests do not check for errors returned by the
low-level asm routines, preempt_fpu() / preempt_vsx() respectively.
That means any register corruption detected by the asm routines does not
result in a test failure.

Fix it by returning the return value of the asm routines from the
pthread child routines.

Fixes: e5ab8be68e44 ("selftests/powerpc: Test preservation of FPU and VMX regs across preemption")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231128132748.1990179-1-mpe@ellerman.id.au


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e5ab8be6 28-Feb-2016 Cyril Bur <cyrilbur@gmail.com>

selftests/powerpc: Test preservation of FPU and VMX regs across preemption

Loop in assembly checking the registers with many threads.

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>