Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Boqun Feng <boqun@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	llvm@lists.linux.dev
Subject: [PATCH] selftests/rseq: Mark variables only some builds read as unused
Date: Tue,  1 Dec 2026 13:08:53 -0500	[thread overview]
Message-ID: <20261201180855.740952-5-sashal@kernel.org> (raw)

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@kernel.org>
---
 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 e1e98dbabe4bc..d40f60f62c9e9 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
-- 
2.53.0


                 reply	other threads:[~2026-12-01 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201180855.740952-5-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=boqun@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=nathan@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox