|
21 | 21 | #include <linux/spinlock.h>
|
22 | 22 | #include <linux/smp.h>
|
23 | 23 | #include <linux/rcupdate_wait.h>
|
| 24 | +#include <linux/rcu_notifier.h> |
24 | 25 | #include <linux/interrupt.h>
|
25 | 26 | #include <linux/sched/signal.h>
|
26 | 27 | #include <uapi/linux/sched/types.h>
|
@@ -2428,16 +2429,31 @@ static int rcutorture_booster_init(unsigned int cpu)
|
2428 | 2429 | return 0;
|
2429 | 2430 | }
|
2430 | 2431 |
|
| 2432 | +static int rcu_torture_stall_nf(struct notifier_block *nb, unsigned long v, void *ptr) |
| 2433 | +{ |
| 2434 | + pr_info("%s: v=%lu, duration=%lu.\n", __func__, v, (unsigned long)ptr); |
| 2435 | + return NOTIFY_OK; |
| 2436 | +} |
| 2437 | + |
| 2438 | +static struct notifier_block rcu_torture_stall_block = { |
| 2439 | + .notifier_call = rcu_torture_stall_nf, |
| 2440 | +}; |
| 2441 | + |
2431 | 2442 | /*
|
2432 | 2443 | * CPU-stall kthread. It waits as specified by stall_cpu_holdoff, then
|
2433 | 2444 | * induces a CPU stall for the time specified by stall_cpu.
|
2434 | 2445 | */
|
2435 | 2446 | static int rcu_torture_stall(void *args)
|
2436 | 2447 | {
|
2437 | 2448 | int idx;
|
| 2449 | + int ret; |
2438 | 2450 | unsigned long stop_at;
|
2439 | 2451 |
|
2440 | 2452 | VERBOSE_TOROUT_STRING("rcu_torture_stall task started");
|
| 2453 | + ret = rcu_stall_chain_notifier_register(&rcu_torture_stall_block); |
| 2454 | + if (ret) |
| 2455 | + pr_info("%s: rcu_stall_chain_notifier_register() returned %d, %sexpected.\n", |
| 2456 | + __func__, ret, !IS_ENABLED(CONFIG_RCU_STALL_COMMON) ? "un" : ""); |
2441 | 2457 | if (stall_cpu_holdoff > 0) {
|
2442 | 2458 | VERBOSE_TOROUT_STRING("rcu_torture_stall begin holdoff");
|
2443 | 2459 | schedule_timeout_interruptible(stall_cpu_holdoff * HZ);
|
@@ -2481,6 +2497,11 @@ static int rcu_torture_stall(void *args)
|
2481 | 2497 | cur_ops->readunlock(idx);
|
2482 | 2498 | }
|
2483 | 2499 | pr_alert("%s end.\n", __func__);
|
| 2500 | + if (!ret) { |
| 2501 | + ret = rcu_stall_chain_notifier_unregister(&rcu_torture_stall_block); |
| 2502 | + if (ret) |
| 2503 | + pr_info("%s: rcu_stall_chain_notifier_unregister() returned %d.\n", __func__, ret); |
| 2504 | + } |
2484 | 2505 | torture_shutdown_absorb("rcu_torture_stall");
|
2485 | 2506 | while (!kthread_should_stop())
|
2486 | 2507 | schedule_timeout_interruptible(10 * HZ);
|
|
0 commit comments