kselftest/arm64: Count SIGUSR2 deliveries in FP stress tests
authorMark Brown <broonie@kernel.org>
Mon, 29 Aug 2022 15:44:50 +0000 (16:44 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 6 Sep 2022 17:31:41 +0000 (18:31 +0100)
Currently the floating point stress tests mostly support testing that the
data they are checking can be disrupted from a signal handler triggered by
SIGUSR1. This is not properly implemented for all the tests and in testing
is frequently modified to just handle the signal without corrupting data in
order to ensure that signal handling does not corrupt data. Directly support
this usage by installing a SIGUSR2 handler which simply counts the signal
delivery.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220829154452.824870-3-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
tools/testing/selftests/arm64/fp/asm-offsets.h
tools/testing/selftests/arm64/fp/fpsimd-test.S
tools/testing/selftests/arm64/fp/sve-test.S
tools/testing/selftests/arm64/fp/za-test.S

index a180851496ecf2c702ae8379a69c6f32446f1fd8..757b2fd75dd78c2655ad730bdf8b9540392b56b6 100644 (file)
@@ -3,6 +3,7 @@
 #define sa_handler 0
 #define sa_mask_sz 8
 #define SIGUSR1 10
+#define SIGUSR2 12
 #define SIGTERM 15
 #define SIGINT 2
 #define SIGABRT 6
index e21e8ea52c7ef6a0f48b892f0ae16f06e8cb7aae..f0f92192351aa58484293b6939de8bd426c7b432 100644 (file)
@@ -151,6 +151,15 @@ function irritator_handler
        ret
 endfunction
 
+function tickle_handler
+       // Increment the signal count (x23):
+       ldr     x0, [x2, #ucontext_regs + 8 * 23]
+       add     x0, x0, #1
+       str     x0, [x2, #ucontext_regs + 8 * 23]
+
+       ret
+endfunction
+
 function terminate_handler
        mov     w21, w0
        mov     x20, x2
@@ -255,6 +264,12 @@ _start:
        orr     w2, w2, #SA_NODEFER
        bl      setsignal
 
+       mov     w0, #SIGUSR2
+       adr     x1, tickle_handler
+       mov     w2, #SA_SIGINFO
+       orr     w2, w2, #SA_NODEFER
+       bl      setsignal
+
        mov     x22, #0         // generation number, increments per iteration
 .Ltest_loop:
 
index 589264231a2d0afd8b1184f63d6c629b882d900c..79c56e6c5b2349ce69a24742f3763e969c0c9734 100644 (file)
@@ -314,6 +314,15 @@ function irritator_handler
        ret
 endfunction
 
+function tickle_handler
+       // Increment the signal count (x23):
+       ldr     x0, [x2, #ucontext_regs + 8 * 23]
+       add     x0, x0, #1
+       str     x0, [x2, #ucontext_regs + 8 * 23]
+
+       ret
+endfunction
+
 function terminate_handler
        mov     w21, w0
        mov     x20, x2
@@ -423,6 +432,12 @@ _start:
        orr     w2, w2, #SA_NODEFER
        bl      setsignal
 
+       mov     w0, #SIGUSR2
+       adr     x1, tickle_handler
+       mov     w2, #SA_SIGINFO
+       orr     w2, w2, #SA_NODEFER
+       bl      setsignal
+
 #ifdef SSVE
        smstart_sm              // syscalls will have exited streaming mode
 #endif
index 2dd358f9edf28382d35fddfd795147bf0479d157..901839107205454cec23a9202c6272b034bd0b3e 100644 (file)
@@ -167,6 +167,15 @@ function irritator_handler
        ret
 endfunction
 
+function tickle_handler
+       // Increment the signal count (x23):
+       ldr     x0, [x2, #ucontext_regs + 8 * 23]
+       add     x0, x0, #1
+       str     x0, [x2, #ucontext_regs + 8 * 23]
+
+       ret
+endfunction
+
 function terminate_handler
        mov     w21, w0
        mov     x20, x2
@@ -273,6 +282,12 @@ _start:
        orr     w2, w2, #SA_NODEFER
        bl      setsignal
 
+       mov     w0, #SIGUSR2
+       adr     x1, tickle_handler
+       mov     w2, #SA_SIGINFO
+       orr     w2, w2, #SA_NODEFER
+       bl      setsignal
+
        mov     x22, #0         // generation number, increments per iteration
 .Ltest_loop:
        rdsvl   0, 8