BPF List
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	kkd@meta.com, kernel-team@meta.com
Subject: [PATCH bpf-next v1 3/3] selftests/bpf: Make CS length configurable for rqspinlock stress test
Date: Tue, 25 Nov 2025 02:07:49 +0000	[thread overview]
Message-ID: <20251125020749.2421610-4-memxor@gmail.com> (raw)
In-Reply-To: <20251125020749.2421610-1-memxor@gmail.com>

Allow users to configure the critical section delay for both task/normal
and NMI contexts, and set to 20ms and 10ms as before by default.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 .../selftests/bpf/test_kmods/bpf_test_rqspinlock.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c b/tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c
index 4ea7ec420e4e..e8dd3fbc6ea5 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c
@@ -51,6 +51,16 @@ module_param(test_mode, int, 0644);
 MODULE_PARM_DESC(test_mode,
 		 "rqspinlock test mode: 0 = AA, 1 = ABBA, 2 = ABBCCA");
 
+static int normal_delay = 20;
+module_param(normal_delay, int, 0644);
+MODULE_PARM_DESC(normal_delay,
+		 "rqspinlock critical section length for normal context (20ms default)");
+
+static int nmi_delay = 10;
+module_param(nmi_delay, int, 0644);
+MODULE_PARM_DESC(nmi_delay,
+		 "rqspinlock critical section length for NMI context (10ms default)");
+
 static struct perf_event **rqsl_evts;
 static int rqsl_nevts;
 
@@ -138,7 +148,7 @@ static int rqspinlock_worker_fn(void *arg)
 			start_ns = ktime_get_mono_fast_ns();
 			ret = raw_res_spin_lock_irqsave(worker_lock, flags);
 			rqsl_record_lock_time(ktime_get_mono_fast_ns() - start_ns, false);
-			mdelay(20);
+			mdelay(normal_delay);
 			if (!ret)
 				raw_res_spin_unlock_irqrestore(worker_lock, flags);
 			cpu_relax();
@@ -182,7 +192,7 @@ static void nmi_cb(struct perf_event *event, struct perf_sample_data *data,
 	ret = raw_res_spin_lock_irqsave(locks.nmi_lock, flags);
 	rqsl_record_lock_time(ktime_get_mono_fast_ns() - start_ns, true);
 
-	mdelay(10);
+	mdelay(nmi_delay);
 
 	if (!ret)
 		raw_res_spin_unlock_irqrestore(locks.nmi_lock, flags);
-- 
2.51.0


  parent reply	other threads:[~2025-11-25  2:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  2:07 [PATCH bpf-next v1 0/3] General enhancements to rqspinlock stress test Kumar Kartikeya Dwivedi
2025-11-25  2:07 ` [PATCH bpf-next v1 1/3] selftests/bpf: Relax CPU requirements for " Kumar Kartikeya Dwivedi
2025-11-25  2:07 ` [PATCH bpf-next v1 2/3] selftests/bpf: Add lock wait time stats to " Kumar Kartikeya Dwivedi
2025-11-25  2:07 ` Kumar Kartikeya Dwivedi [this message]
2025-11-25 23:40 ` [PATCH bpf-next v1 0/3] General enhancements " patchwork-bot+netdevbpf

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=20251125020749.2421610-4-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=martin.lau@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