Skip to content

Commit 5188291

Browse files
kkdwvdKernel Patches Daemon
authored andcommitted
selftests/bpf: Make CS length configurable for rqspinlock stress test
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 <[email protected]>
1 parent 5421e25 commit 5188291

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ module_param(test_mode, int, 0644);
5151
MODULE_PARM_DESC(test_mode,
5252
"rqspinlock test mode: 0 = AA, 1 = ABBA, 2 = ABBCCA");
5353

54+
static int normal_delay = 20;
55+
module_param(normal_delay, int, 0644);
56+
MODULE_PARM_DESC(normal_delay,
57+
"rqspinlock critical section length for normal context (20ms default)");
58+
59+
static int nmi_delay = 10;
60+
module_param(nmi_delay, int, 0644);
61+
MODULE_PARM_DESC(nmi_delay,
62+
"rqspinlock critical section length for NMI context (10ms default)");
63+
5464
static struct perf_event **rqsl_evts;
5565
static int rqsl_nevts;
5666

@@ -138,7 +148,7 @@ static int rqspinlock_worker_fn(void *arg)
138148
start_ns = ktime_get_mono_fast_ns();
139149
ret = raw_res_spin_lock_irqsave(worker_lock, flags);
140150
rqsl_record_lock_time(ktime_get_mono_fast_ns() - start_ns, false);
141-
mdelay(20);
151+
mdelay(normal_delay);
142152
if (!ret)
143153
raw_res_spin_unlock_irqrestore(worker_lock, flags);
144154
cpu_relax();
@@ -182,7 +192,7 @@ static void nmi_cb(struct perf_event *event, struct perf_sample_data *data,
182192
ret = raw_res_spin_lock_irqsave(locks.nmi_lock, flags);
183193
rqsl_record_lock_time(ktime_get_mono_fast_ns() - start_ns, true);
184194

185-
mdelay(10);
195+
mdelay(nmi_delay);
186196

187197
if (!ret)
188198
raw_res_spin_unlock_irqrestore(locks.nmi_lock, flags);

0 commit comments

Comments
 (0)