[tip: locking/futex] selftests/rseq: Mark variables only some builds read as unused

From: tip-bot2 for Sasha Levin

Date: Fri Dec 04 2026 - 09:55:35 EST


The following commit has been merged into the locking/futex branch of tip:

Commit-ID: 67aa84810c861eb94b8997386e723fa02330038b
Gitweb: https://git.kernel.org/tip/67aa84810c861eb94b8997386e723fa02330038b
Author: Sasha Levin <sashal@xxxxxxxxxx>
AuthorDate: Tue, 01 Dec 2026 13:08:53 -05:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Fri, 04 Dec 2026 15:52:38 +01:00

selftests/rseq: Mark variables only some builds read as unused

loop_cnt_1 to loop_cnt_6 are only read by the x86 delay injection
assembly, and verbose, opt_signal and signals_delivered only when
BENCHMARK is not defined. clang 23 warns about them in the other builds:

param_test.c:29:12: warning: variable 'loop_cnt_1' set but not used [-Wunused-but-set-global]
param_test.c:36:24: warning: variable 'verbose' set but not used [-Wunused-but-set-global]

It warns about loop_cnt_1 to loop_cnt_6 on x86 too, as it does not see
the assembly reading them.

Mark them unused, like yield_mod_cnt and nr_abort.

Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20261201180855.740952-5-sashal@xxxxxxxxxx
---
tools/testing/selftests/rseq/param_test.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/rseq/param_test.c b/tools/testing/selftests/rseq/param_test.c
index e1e98db..d40f60f 100644
--- a/tools/testing/selftests/rseq/param_test.c
+++ b/tools/testing/selftests/rseq/param_test.c
@@ -26,22 +26,22 @@ static inline pid_t rseq_gettid(void)
#define NR_INJECT 9
static int loop_cnt[NR_INJECT + 1];

-static int loop_cnt_1 asm("asm_loop_cnt_1") __attribute__((used));
-static int loop_cnt_2 asm("asm_loop_cnt_2") __attribute__((used));
-static int loop_cnt_3 asm("asm_loop_cnt_3") __attribute__((used));
-static int loop_cnt_4 asm("asm_loop_cnt_4") __attribute__((used));
-static int loop_cnt_5 asm("asm_loop_cnt_5") __attribute__((used));
-static int loop_cnt_6 asm("asm_loop_cnt_6") __attribute__((used));
+static int loop_cnt_1 asm("asm_loop_cnt_1") __attribute__((used, unused));
+static int loop_cnt_2 asm("asm_loop_cnt_2") __attribute__((used, unused));
+static int loop_cnt_3 asm("asm_loop_cnt_3") __attribute__((used, unused));
+static int loop_cnt_4 asm("asm_loop_cnt_4") __attribute__((used, unused));
+static int loop_cnt_5 asm("asm_loop_cnt_5") __attribute__((used, unused));
+static int loop_cnt_6 asm("asm_loop_cnt_6") __attribute__((used, unused));

-static int opt_modulo, verbose;
+static int opt_modulo, verbose __attribute__((unused));

-static int opt_yield, opt_signal, opt_sleep,
+static int opt_yield, opt_signal __attribute__((unused)), opt_sleep,
opt_disable_rseq, opt_threads = 200,
opt_disable_mod = 0, opt_test = 's';
static bool opt_rseq_legacy;
static long long opt_reps = 5000;

-static __thread __attribute__((tls_model("initial-exec")))
+static __thread __attribute__((tls_model("initial-exec"), unused))
unsigned int signals_delivered;

#ifndef BENCHMARK