Skip to content

Commit 6ae0c15

Browse files
committed
Merge tag 'scftorture.2023.08.15a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull smp_call_function torture-test updates from Paul McKenney: "This prevents some memory-exhaustion false-postitive failures in scftorture testing" * tag 'scftorture.2023.08.15a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: scftorture: Add CONFIG_PREEMPT_DYNAMIC=n to NOPREEMPT scenario scftorture: Pause testing after memory-allocation failure scftorture: Forgive memory-allocation failure if KASAN torture: Scale scftorture memory based on number of CPUs
2 parents 68cadad + 3f68f9c commit 6ae0c15

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

kernel/scftorture.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ static void scf_torture_stats_print(void)
171171
scfs.n_all_wait += scf_stats_p[i].n_all_wait;
172172
}
173173
if (atomic_read(&n_errs) || atomic_read(&n_mb_in_errs) ||
174-
atomic_read(&n_mb_out_errs) || atomic_read(&n_alloc_errs))
174+
atomic_read(&n_mb_out_errs) ||
175+
(!IS_ENABLED(CONFIG_KASAN) && atomic_read(&n_alloc_errs)))
175176
bangstr = "!!! ";
176177
pr_alert("%s %sscf_invoked_count %s: %lld resched: %lld single: %lld/%lld single_ofl: %lld/%lld single_rpc: %lld single_rpc_ofl: %lld many: %lld/%lld all: %lld/%lld ",
177178
SCFTORT_FLAG, bangstr, isdone ? "VER" : "ver", invoked_count, scfs.n_resched,
@@ -312,6 +313,7 @@ static void scf_handler_1(void *scfc_in)
312313
// Randomly do an smp_call_function*() invocation.
313314
static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_random_state *trsp)
314315
{
316+
bool allocfail = false;
315317
uintptr_t cpu;
316318
int ret = 0;
317319
struct scf_check *scfcp = NULL;
@@ -323,8 +325,10 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
323325
preempt_disable();
324326
if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) {
325327
scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC);
326-
if (WARN_ON_ONCE(!scfcp)) {
328+
if (!scfcp) {
329+
WARN_ON_ONCE(!IS_ENABLED(CONFIG_KASAN));
327330
atomic_inc(&n_alloc_errs);
331+
allocfail = true;
328332
} else {
329333
scfcp->scfc_cpu = -1;
330334
scfcp->scfc_wait = scfsp->scfs_wait;
@@ -431,7 +435,9 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
431435
cpus_read_unlock();
432436
else
433437
preempt_enable();
434-
if (!(torture_random(trsp) & 0xfff))
438+
if (allocfail)
439+
schedule_timeout_idle((1 + longwait) * HZ); // Let no-wait handlers complete.
440+
else if (!(torture_random(trsp) & 0xfff))
435441
schedule_timeout_uninterruptible(1);
436442
}
437443

tools/testing/selftests/rcutorture/bin/torture.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,10 @@ fi
424424

425425
if test "$do_scftorture" = "yes"
426426
then
427+
# Scale memory based on the number of CPUs.
428+
scfmem=$((2+HALF_ALLOTED_CPUS/16))
427429
torture_bootargs="scftorture.nthreads=$HALF_ALLOTED_CPUS torture.disable_onoff_at_boot csdlock_debug=1"
428-
torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --configs "$configs_scftorture" --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --memory 2G --trust-make
430+
torture_set "scftorture" tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration "$duration_scftorture" --configs "$configs_scftorture" --kconfig "CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --memory ${scfmem}G --trust-make
429431
fi
430432

431433
if test "$do_rt" = "yes"

tools/testing/selftests/rcutorture/configs/scf/NOPREEMPT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ CONFIG_SMP=y
22
CONFIG_PREEMPT_NONE=y
33
CONFIG_PREEMPT_VOLUNTARY=n
44
CONFIG_PREEMPT=n
5+
CONFIG_PREEMPT_DYNAMIC=n
6+
#CHECK#CONFIG_PREEMPT_RCU=n
57
CONFIG_HZ_PERIODIC=n
68
CONFIG_NO_HZ_IDLE=n
79
CONFIG_NO_HZ_FULL=y

0 commit comments

Comments
 (0)