Skip to contentSkip to conversation

torture: avoid build error without CONFIG_RCU_TORTURE_TEST

PATCH RESEND In review Hongbo Yao 2 participants 2 messages Feb 13, 2020 Torture-test modules

lore
Share & tools
lore

Hongbo Yao

author
#0 lore raw

PATCH RESEND 1/1 torture: avoid build error without CONFIG_RCU_TORTURE_TEST

If TORTURE_TEST=y(selected by TORTURE_LOCK_TEST) and RCU_TORTURE_TEST=n, the following error is seen while building kernel/torture.c

kernel/torture.c: In function torture_onoff:
kernel/torture.c:239:3: error: implicit declaration of function rcutorture_sched_setaffinity; did you mean __NR_ia32_sched_setaffinity? [-Werror=implicit-function-declaration]
rcutorture_sched_setaffinity(current->pid, cpumask_of(0));

Using sched_setaffnity() instead of rcutorture_sched_setaffinity() to avoid the error.

Fixes bc3db9afb849 ("EXP: rcutorture hack to force CPU hotplug onto CPU 0")
---
 kernel/torture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/torture.c +1 -1
index b29adec50e01..834214cbd1cd 100644
@@ -236,7 +236,7 @@ torture_onoff(void *arg)
 			schedule_timeout_interruptible(HZ / 10);
 			continue;
 		}
-		rcutorture_sched_setaffinity(current->pid, cpumask_of(0));
+		sched_setaffinity(current->pid, cpumask_of(0));
 		cpu = (torture_random(&rand) >> 4) % (maxcpu + 1);
 		if (!torture_offline(cpu,
 				     &n_offline_attempts, &n_offline_successes,
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 9 lines · Hongbo Yao

If TORTURE_TEST=y(selected by TORTURE_LOCK_TEST) and RCU_TORTURE_TEST=n, the following error is seen while building kernel/torture.c

kernel/torture.c: In function torture_onoff:
kernel/torture.c:239:3: error: implicit declaration of function rcutorture_sched_setaffinity; did you mean __NR_ia32_sched_setaffinity? [-Werror=implicit-function-declaration]
rcutorture_sched_setaffinity(current->pid, cpumask_of(0));

Quoted 6 lines

Using sched_setaffnity() instead of rcutorture_sched_setaffinity() to avoid the error.

Fixes bc3db9afb849 ("EXP: rcutorture hack to force CPU hotplug onto CPU 0")

Thank you for finding this!

However, this was due to a debugging commit used to chase a particular bug (hence the "EXP:" at the beginning of the subject line). Now that this bug has been fixes (woo-hoo!!!), I will be dropping this commit. In case you are interested, the fix is here:

97be2ad9946f ("rcu: Make rcu_barrier() account for offline no-CBs CPUs")

Either way, thank you for your testing efforts!

Thanx, Paul

Quoted 20 lines
---
 kernel/torture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/torture.c +1 -1
index b29adec50e01..834214cbd1cd 100644
@@ -236,7 +236,7 @@ torture_onoff(void *arg)
 			schedule_timeout_interruptible(HZ / 10);
 			continue;
 		}
-		rcutorture_sched_setaffinity(current->pid, cpumask_of(0));
+		sched_setaffinity(current->pid, cpumask_of(0));
 		cpu = (torture_random(&rand) >> 4) % (maxcpu + 1);
 		if (!torture_offline(cpu,
 				     &n_offline_attempts, &n_offline_successes,
Signature · 1 line
2.17.1