Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branches 'expedited.2018.07.12a', 'fixes.2018.07.12a', 'srcu.2018.06.25b' and 'torture.2018.06.25b' into HEAD

expedited.2018.07.12a: Expedited grace-period updates.
fixes.2018.07.12a: Pre-gp_seq miscellaneous fixes.
srcu.2018.06.25b: SRCU updates.
torture.2018.06.25b: Pre-gp_seq torture-test updates.

+206 -65
+17
include/linux/srcu.h
··· 195 195 return retval; 196 196 } 197 197 198 + /* Used by tracing, cannot be traced and cannot invoke lockdep. */ 199 + static inline notrace int 200 + srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp) 201 + { 202 + int retval; 203 + 204 + retval = __srcu_read_lock(sp); 205 + return retval; 206 + } 207 + 198 208 /** 199 209 * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. 200 210 * @sp: srcu_struct in which to unregister the old reader. ··· 216 206 __releases(sp) 217 207 { 218 208 rcu_lock_release(&(sp)->dep_map); 209 + __srcu_read_unlock(sp, idx); 210 + } 211 + 212 + /* Used by tracing, cannot be traced and cannot call lockdep. */ 213 + static inline notrace void 214 + srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp) 215 + { 219 216 __srcu_read_unlock(sp, idx); 220 217 } 221 218
+1 -1
include/linux/torture.h
··· 79 79 int torture_stutter_init(int s); 80 80 81 81 /* Initialization and cleanup. */ 82 - bool torture_init_begin(char *ttype, bool v); 82 + bool torture_init_begin(char *ttype, int v); 83 83 void torture_init_end(void); 84 84 bool torture_cleanup_begin(void); 85 85 void torture_cleanup_end(void);
+4 -1
kernel/locking/locktorture.c
··· 21 21 * Davidlohr Bueso <dave@stgolabs.net> 22 22 * Based on kernel/rcu/torture.c. 23 23 */ 24 + 25 + #define pr_fmt(fmt) fmt 26 + 24 27 #include <linux/kernel.h> 25 28 #include <linux/module.h> 26 29 #include <linux/kthread.h> ··· 60 57 torture_param(int, stat_interval, 60, 61 58 "Number of seconds between stats printk()s"); 62 59 torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable"); 63 - torture_param(bool, verbose, true, 60 + torture_param(int, verbose, 1, 64 61 "Enable verbose debugging printk()s"); 65 62 66 63 static char *torture_type = "spin_lock";
+4 -1
kernel/rcu/rcuperf.c
··· 19 19 * 20 20 * Authors: Paul E. McKenney <paulmck@us.ibm.com> 21 21 */ 22 + 23 + #define pr_fmt(fmt) fmt 24 + 22 25 #include <linux/types.h> 23 26 #include <linux/kernel.h> 24 27 #include <linux/init.h> ··· 91 88 torture_param(int, nwriters, -1, "Number of RCU updater threads"); 92 89 torture_param(bool, shutdown, !IS_ENABLED(MODULE), 93 90 "Shutdown at end of performance tests."); 94 - torture_param(bool, verbose, true, "Enable verbose debugging printk()s"); 91 + torture_param(int, verbose, 1, "Enable verbose debugging printk()s"); 95 92 torture_param(int, writer_holdoff, 0, "Holdoff (us) between GPs, zero to disable"); 96 93 97 94 static char *perf_type = "rcu";
+4 -1
kernel/rcu/rcutorture.c
··· 22 22 * 23 23 * See also: Documentation/RCU/torture.txt 24 24 */ 25 + 26 + #define pr_fmt(fmt) fmt 27 + 25 28 #include <linux/types.h> 26 29 #include <linux/kernel.h> 27 30 #include <linux/init.h> ··· 104 101 "Interval between boost tests, seconds."); 105 102 torture_param(bool, test_no_idle_hz, true, 106 103 "Test support for tickless idle CPUs"); 107 - torture_param(bool, verbose, true, 104 + torture_param(int, verbose, 1, 108 105 "Enable verbose debugging printk()s"); 109 106 110 107 static char *torture_type = "rcu";
+15 -11
kernel/rcu/srcutree.c
··· 641 641 * period s. Losers must either ensure that their desired grace-period 642 642 * number is recorded on at least their leaf srcu_node structure, or they 643 643 * must take steps to invoke their own callbacks. 644 + * 645 + * Note that this function also does the work of srcu_funnel_exp_start(), 646 + * in some cases by directly invoking it. 644 647 */ 645 648 static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp, 646 649 unsigned long s, bool do_norm) ··· 826 823 * more than one CPU, this means that when "func()" is invoked, each CPU 827 824 * is guaranteed to have executed a full memory barrier since the end of 828 825 * its last corresponding SRCU read-side critical section whose beginning 829 - * preceded the call to call_rcu(). It also means that each CPU executing 826 + * preceded the call to call_srcu(). It also means that each CPU executing 830 827 * an SRCU read-side critical section that continues beyond the start of 831 - * "func()" must have executed a memory barrier after the call_rcu() 828 + * "func()" must have executed a memory barrier after the call_srcu() 832 829 * but before the beginning of that SRCU read-side critical section. 833 830 * Note that these guarantees include CPUs that are offline, idle, or 834 831 * executing in user mode, as well as CPUs that are executing in the kernel. 835 832 * 836 - * Furthermore, if CPU A invoked call_rcu() and CPU B invoked the 833 + * Furthermore, if CPU A invoked call_srcu() and CPU B invoked the 837 834 * resulting SRCU callback function "func()", then both CPU A and CPU 838 835 * B are guaranteed to execute a full memory barrier during the time 839 - * interval between the call to call_rcu() and the invocation of "func()". 836 + * interval between the call to call_srcu() and the invocation of "func()". 840 837 * This guarantee applies even if CPU A and CPU B are the same CPU (but 841 838 * again only if the system has more than one CPU). 842 839 * ··· 1271 1268 unsigned long l0, l1; 1272 1269 unsigned long u0, u1; 1273 1270 long c0, c1; 1274 - struct srcu_data *counts; 1271 + struct srcu_data *sdp; 1275 1272 1276 - counts = per_cpu_ptr(sp->sda, cpu); 1277 - u0 = counts->srcu_unlock_count[!idx]; 1278 - u1 = counts->srcu_unlock_count[idx]; 1273 + sdp = per_cpu_ptr(sp->sda, cpu); 1274 + u0 = sdp->srcu_unlock_count[!idx]; 1275 + u1 = sdp->srcu_unlock_count[idx]; 1279 1276 1280 1277 /* 1281 1278 * Make sure that a lock is always counted if the corresponding ··· 1283 1280 */ 1284 1281 smp_rmb(); 1285 1282 1286 - l0 = counts->srcu_lock_count[!idx]; 1287 - l1 = counts->srcu_lock_count[idx]; 1283 + l0 = sdp->srcu_lock_count[!idx]; 1284 + l1 = sdp->srcu_lock_count[idx]; 1288 1285 1289 1286 c0 = l0 - u0; 1290 1287 c1 = l1 - u1; 1291 - pr_cont(" %d(%ld,%ld)", cpu, c0, c1); 1288 + pr_cont(" %d(%ld,%ld %1p)", 1289 + cpu, c0, c1, rcu_segcblist_head(&sdp->srcu_cblist)); 1292 1290 s0 += c0; 1293 1291 s1 += c1; 1294 1292 }
+81 -19
kernel/rcu/tree.c
··· 1368 1368 static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gpnum) 1369 1369 { 1370 1370 int cpu; 1371 - long delta; 1372 1371 unsigned long flags; 1373 1372 unsigned long gpa; 1374 1373 unsigned long j; ··· 1379 1380 rcu_stall_kick_kthreads(rsp); 1380 1381 if (rcu_cpu_stall_suppress) 1381 1382 return; 1382 - 1383 - /* Only let one CPU complain about others per time interval. */ 1384 - 1385 - raw_spin_lock_irqsave_rcu_node(rnp, flags); 1386 - delta = jiffies - READ_ONCE(rsp->jiffies_stall); 1387 - if (delta < RCU_STALL_RAT_DELAY || !rcu_gp_in_progress(rsp)) { 1388 - raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 1389 - return; 1390 - } 1391 - WRITE_ONCE(rsp->jiffies_stall, 1392 - jiffies + 3 * rcu_jiffies_till_stall_check() + 3); 1393 - raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 1394 1383 1395 1384 /* 1396 1385 * OK, time to rat on our buddy... ··· 1428 1441 sched_show_task(current); 1429 1442 } 1430 1443 } 1444 + /* Rewrite if needed in case of slow consoles. */ 1445 + if (ULONG_CMP_GE(jiffies, READ_ONCE(rsp->jiffies_stall))) 1446 + WRITE_ONCE(rsp->jiffies_stall, 1447 + jiffies + 3 * rcu_jiffies_till_stall_check() + 3); 1431 1448 1432 1449 rcu_check_gp_kthread_starvation(rsp); 1433 1450 ··· 1476 1485 rcu_dump_cpu_stacks(rsp); 1477 1486 1478 1487 raw_spin_lock_irqsave_rcu_node(rnp, flags); 1488 + /* Rewrite if needed in case of slow consoles. */ 1479 1489 if (ULONG_CMP_GE(jiffies, READ_ONCE(rsp->jiffies_stall))) 1480 1490 WRITE_ONCE(rsp->jiffies_stall, 1481 1491 jiffies + 3 * rcu_jiffies_till_stall_check() + 3); ··· 1500 1508 unsigned long gpnum; 1501 1509 unsigned long gps; 1502 1510 unsigned long j; 1511 + unsigned long jn; 1503 1512 unsigned long js; 1504 1513 struct rcu_node *rnp; 1505 1514 ··· 1539 1546 ULONG_CMP_GE(gps, js)) 1540 1547 return; /* No stall or GP completed since entering function. */ 1541 1548 rnp = rdp->mynode; 1549 + jn = jiffies + 3 * rcu_jiffies_till_stall_check() + 3; 1542 1550 if (rcu_gp_in_progress(rsp) && 1543 - (READ_ONCE(rnp->qsmask) & rdp->grpmask)) { 1551 + (READ_ONCE(rnp->qsmask) & rdp->grpmask) && 1552 + cmpxchg(&rsp->jiffies_stall, js, jn) == js) { 1544 1553 1545 1554 /* We haven't checked in, so go dump stack. */ 1546 1555 print_cpu_stall(rsp); 1547 1556 1548 1557 } else if (rcu_gp_in_progress(rsp) && 1549 - ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY)) { 1558 + ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY) && 1559 + cmpxchg(&rsp->jiffies_stall, js, jn) == js) { 1550 1560 1551 1561 /* They had a few time units to dump stack, so complain. */ 1552 1562 print_other_cpu_stall(rsp, gpnum); ··· 1681 1685 } 1682 1686 trace_rcu_this_gp(rnp_root, rdp, c, TPS("Startedroot")); 1683 1687 WRITE_ONCE(rsp->gp_flags, rsp->gp_flags | RCU_GP_FLAG_INIT); 1688 + rsp->gp_req_activity = jiffies; 1684 1689 if (!rsp->gp_kthread) { 1685 1690 trace_rcu_this_gp(rnp_root, rdp, c, TPS("NoGPkthread")); 1686 1691 goto unlock_out; ··· 2081 2084 */ 2082 2085 rcu_for_each_node_breadth_first(rsp, rnp) { 2083 2086 raw_spin_lock_irq_rcu_node(rnp); 2084 - WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp)); 2087 + if (WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp))) 2088 + dump_blkd_tasks(rnp, 10); 2085 2089 WARN_ON_ONCE(rnp->qsmask); 2086 2090 WRITE_ONCE(rnp->completed, rsp->gpnum); 2087 2091 rdp = this_cpu_ptr(rsp->rda); ··· 2114 2116 /* Advance CBs to reduce false positives below. */ 2115 2117 if (!rcu_accelerate_cbs(rsp, rnp, rdp) && needgp) { 2116 2118 WRITE_ONCE(rsp->gp_flags, RCU_GP_FLAG_INIT); 2119 + rsp->gp_req_activity = jiffies; 2117 2120 trace_rcu_grace_period(rsp->name, READ_ONCE(rsp->gpnum), 2118 2121 TPS("newreq")); 2122 + } else { 2123 + WRITE_ONCE(rsp->gp_flags, rsp->gp_flags & RCU_GP_FLAG_INIT); 2119 2124 } 2120 - WRITE_ONCE(rsp->gp_flags, rsp->gp_flags & RCU_GP_FLAG_INIT); 2121 2125 raw_spin_unlock_irq_rcu_node(rnp); 2122 2126 } 2123 2127 ··· 2294 2294 raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 2295 2295 return; 2296 2296 } 2297 + rnp->completedqs = rnp->gpnum; 2297 2298 mask = rnp->grpmask; 2298 2299 if (rnp->parent == NULL) { 2299 2300 ··· 2748 2747 } 2749 2748 2750 2749 /* 2750 + * This function checks for grace-period requests that fail to motivate 2751 + * RCU to come out of its idle mode. 2752 + */ 2753 + static void 2754 + rcu_check_gp_start_stall(struct rcu_state *rsp, struct rcu_node *rnp, 2755 + struct rcu_data *rdp) 2756 + { 2757 + unsigned long flags; 2758 + unsigned long j; 2759 + struct rcu_node *rnp_root = rcu_get_root(rsp); 2760 + static atomic_t warned = ATOMIC_INIT(0); 2761 + 2762 + if (!IS_ENABLED(CONFIG_PROVE_RCU) || 2763 + rcu_gp_in_progress(rsp) || !need_any_future_gp(rcu_get_root(rsp))) 2764 + return; 2765 + j = jiffies; /* Expensive access, and in common case don't get here. */ 2766 + if (time_before(j, READ_ONCE(rsp->gp_req_activity) + HZ) || 2767 + time_before(j, READ_ONCE(rsp->gp_activity) + HZ) || 2768 + atomic_read(&warned)) 2769 + return; 2770 + 2771 + raw_spin_lock_irqsave_rcu_node(rnp, flags); 2772 + j = jiffies; 2773 + if (rcu_gp_in_progress(rsp) || !need_any_future_gp(rcu_get_root(rsp)) || 2774 + time_before(j, READ_ONCE(rsp->gp_req_activity) + HZ) || 2775 + time_before(j, READ_ONCE(rsp->gp_activity) + HZ) || 2776 + atomic_read(&warned)) { 2777 + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 2778 + return; 2779 + } 2780 + /* Hold onto the leaf lock to make others see warned==1. */ 2781 + 2782 + if (rnp_root != rnp) 2783 + raw_spin_lock_rcu_node(rnp_root); /* irqs already disabled. */ 2784 + j = jiffies; 2785 + if (rcu_gp_in_progress(rsp) || !need_any_future_gp(rcu_get_root(rsp)) || 2786 + time_before(j, rsp->gp_req_activity + HZ) || 2787 + time_before(j, rsp->gp_activity + HZ) || 2788 + atomic_xchg(&warned, 1)) { 2789 + raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */ 2790 + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 2791 + return; 2792 + } 2793 + pr_alert("%s: g%lu %d%d%d%d gar:%lu ga:%lu f%#x %s->state:%#lx\n", 2794 + __func__, READ_ONCE(rsp->gpnum), 2795 + need_future_gp_element(rcu_get_root(rsp), 0), 2796 + need_future_gp_element(rcu_get_root(rsp), 1), 2797 + need_future_gp_element(rcu_get_root(rsp), 2), 2798 + need_future_gp_element(rcu_get_root(rsp), 3), 2799 + j - rsp->gp_req_activity, j - rsp->gp_activity, 2800 + rsp->gp_flags, rsp->name, 2801 + rsp->gp_kthread ? rsp->gp_kthread->state : 0x1ffffL); 2802 + WARN_ON(1); 2803 + if (rnp_root != rnp) 2804 + raw_spin_unlock_rcu_node(rnp_root); 2805 + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 2806 + } 2807 + 2808 + /* 2751 2809 * This does the RCU core processing work for the specified rcu_state 2752 2810 * and rcu_data structures. This may be called only from the CPU to 2753 2811 * whom the rdp belongs. ··· 2817 2757 unsigned long flags; 2818 2758 bool needwake; 2819 2759 struct rcu_data *rdp = raw_cpu_ptr(rsp->rda); 2820 - struct rcu_node *rnp; 2760 + struct rcu_node *rnp = rdp->mynode; 2821 2761 2822 2762 WARN_ON_ONCE(!rdp->beenonline); 2823 2763 ··· 2831 2771 if (rcu_segcblist_restempty(&rdp->cblist, RCU_NEXT_READY_TAIL)) { 2832 2772 local_irq_restore(flags); 2833 2773 } else { 2834 - rnp = rdp->mynode; 2835 2774 raw_spin_lock_rcu_node(rnp); /* irqs disabled. */ 2836 2775 needwake = rcu_accelerate_cbs(rsp, rnp, rdp); 2837 2776 raw_spin_unlock_irqrestore_rcu_node(rnp, flags); ··· 2838 2779 rcu_gp_kthread_wake(rsp); 2839 2780 } 2840 2781 } 2782 + 2783 + rcu_check_gp_start_stall(rsp, rnp, rdp); 2841 2784 2842 2785 /* If there are callbacks ready, invoke them. */ 2843 2786 if (rcu_segcblist_ready_cbs(&rdp->cblist)) ··· 3991 3930 &rcu_fqs_class[i], fqs[i]); 3992 3931 rnp->gpnum = rsp->gpnum; 3993 3932 rnp->completed = rsp->completed; 3933 + rnp->completedqs = rsp->completed; 3994 3934 rnp->qsmask = 0; 3995 3935 rnp->qsmaskinit = 0; 3996 3936 rnp->grplo = j * cpustride;
+4
kernel/rcu/tree.h
··· 87 87 unsigned long completed; /* Last GP completed for this node. */ 88 88 /* This will either be equal to or one */ 89 89 /* behind the root rcu_node's gpnum. */ 90 + unsigned long completedqs; /* All QSes done for this node. */ 90 91 unsigned long qsmask; /* CPUs or groups that need to switch in */ 91 92 /* order for current grace period to proceed.*/ 92 93 /* In leaf rcu_node, each bit corresponds to */ ··· 374 373 /* but in jiffies. */ 375 374 unsigned long gp_activity; /* Time of last GP kthread */ 376 375 /* activity in jiffies. */ 376 + unsigned long gp_req_activity; /* Time of last GP request */ 377 + /* in jiffies. */ 377 378 unsigned long jiffies_stall; /* Time at which to check */ 378 379 /* for CPU stalls. */ 379 380 unsigned long jiffies_resched; /* Time at which to resched */ ··· 456 453 static void rcu_preempt_check_callbacks(void); 457 454 void call_rcu(struct rcu_head *head, rcu_callback_t func); 458 455 static void __init __rcu_init_preempt(void); 456 + static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck); 459 457 static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags); 460 458 static void rcu_preempt_boost_start_gp(struct rcu_node *rnp); 461 459 static void invoke_rcu_callbacks_kthread(void);
+36 -2
kernel/rcu/tree_plugin.h
··· 260 260 * ->exp_tasks pointers, respectively, to reference the newly 261 261 * blocked tasks. 262 262 */ 263 - if (!rnp->gp_tasks && (blkd_state & RCU_GP_BLKD)) 263 + if (!rnp->gp_tasks && (blkd_state & RCU_GP_BLKD)) { 264 264 rnp->gp_tasks = &t->rcu_node_entry; 265 + WARN_ON_ONCE(rnp->completedqs == rnp->gpnum); 266 + } 265 267 if (!rnp->exp_tasks && (blkd_state & RCU_EXP_BLKD)) 266 268 rnp->exp_tasks = &t->rcu_node_entry; 267 269 WARN_ON_ONCE(!(blkd_state & RCU_GP_BLKD) != ··· 537 535 WARN_ON_ONCE(rnp != t->rcu_blocked_node); 538 536 WARN_ON_ONCE(!rcu_is_leaf_node(rnp)); 539 537 empty_norm = !rcu_preempt_blocked_readers_cgp(rnp); 538 + WARN_ON_ONCE(rnp->completedqs == rnp->gpnum && 539 + (!empty_norm || rnp->qsmask)); 540 540 empty_exp = sync_rcu_preempt_exp_done(rnp); 541 541 smp_mb(); /* ensure expedited fastpath sees end of RCU c-s. */ 542 542 np = rcu_next_node_entry(t, rnp); ··· 701 697 struct task_struct *t; 702 698 703 699 RCU_LOCKDEP_WARN(preemptible(), "rcu_preempt_check_blocked_tasks() invoked with preemption enabled!!!\n"); 704 - WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp)); 700 + if (WARN_ON_ONCE(rcu_preempt_blocked_readers_cgp(rnp))) 701 + dump_blkd_tasks(rnp, 10); 705 702 if (rcu_preempt_has_tasks(rnp)) { 706 703 rnp->gp_tasks = rnp->blkd_tasks.next; 707 704 t = container_of(rnp->gp_tasks, struct task_struct, ··· 846 841 __rcu_read_unlock(); 847 842 } 848 843 844 + /* 845 + * Dump the blocked-tasks state, but limit the list dump to the 846 + * specified number of elements. 847 + */ 848 + static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck) 849 + { 850 + int i; 851 + struct list_head *lhp; 852 + 853 + raw_lockdep_assert_held_rcu_node(rnp); 854 + pr_info("%s: grp: %d-%d level: %d ->qamask %#lx ->gp_tasks %p ->boost_tasks %p ->exp_tasks %p &->blkd_tasks: %p offset: %u\n", __func__, rnp->grplo, rnp->grphi, rnp->level, rnp->qsmask, rnp->gp_tasks, rnp->boost_tasks, rnp->exp_tasks, &rnp->blkd_tasks, (unsigned int)offsetof(typeof(*rnp), blkd_tasks)); 855 + pr_cont("\t->blkd_tasks"); 856 + i = 0; 857 + list_for_each(lhp, &rnp->blkd_tasks) { 858 + pr_cont(" %p", lhp); 859 + if (++i >= 10) 860 + break; 861 + } 862 + pr_cont("\n"); 863 + } 864 + 849 865 #else /* #ifdef CONFIG_PREEMPT_RCU */ 850 866 851 867 static struct rcu_state *const rcu_state_p = &rcu_sched_state; ··· 973 947 */ 974 948 void exit_rcu(void) 975 949 { 950 + } 951 + 952 + /* 953 + * Dump the guaranteed-empty blocked-tasks state. Trust but verify. 954 + */ 955 + static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck) 956 + { 957 + WARN_ON_ONCE(!list_empty(&rnp->blkd_tasks)); 976 958 } 977 959 978 960 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
+9 -6
kernel/torture.c
··· 20 20 * Author: Paul E. McKenney <paulmck@us.ibm.com> 21 21 * Based on kernel/rcu/torture.c. 22 22 */ 23 + 24 + #define pr_fmt(fmt) fmt 25 + 23 26 #include <linux/types.h> 24 27 #include <linux/kernel.h> 25 28 #include <linux/init.h> ··· 56 53 MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com>"); 57 54 58 55 static char *torture_type; 59 - static bool verbose; 56 + static int verbose; 60 57 61 58 /* Mediate rmmod and system shutdown. Concurrent rmmod & shutdown illegal! */ 62 59 #define FULLSTOP_DONTSTOP 0 /* Normal operation. */ ··· 101 98 if (!cpu_online(cpu) || !cpu_is_hotpluggable(cpu)) 102 99 return false; 103 100 104 - if (verbose) 101 + if (verbose > 1) 105 102 pr_alert("%s" TORTURE_FLAG 106 103 "torture_onoff task: offlining %d\n", 107 104 torture_type, cpu); ··· 114 111 "torture_onoff task: offline %d failed: errno %d\n", 115 112 torture_type, cpu, ret); 116 113 } else { 117 - if (verbose) 114 + if (verbose > 1) 118 115 pr_alert("%s" TORTURE_FLAG 119 116 "torture_onoff task: offlined %d\n", 120 117 torture_type, cpu); ··· 150 147 if (cpu_online(cpu) || !cpu_is_hotpluggable(cpu)) 151 148 return false; 152 149 153 - if (verbose) 150 + if (verbose > 1) 154 151 pr_alert("%s" TORTURE_FLAG 155 152 "torture_onoff task: onlining %d\n", 156 153 torture_type, cpu); ··· 163 160 "torture_onoff task: online %d failed: errno %d\n", 164 161 torture_type, cpu, ret); 165 162 } else { 166 - if (verbose) 163 + if (verbose > 1) 167 164 pr_alert("%s" TORTURE_FLAG 168 165 "torture_onoff task: onlined %d\n", 169 166 torture_type, cpu); ··· 650 647 * The runnable parameter points to a flag that controls whether or not 651 648 * the test is currently runnable. If there is no such flag, pass in NULL. 652 649 */ 653 - bool torture_init_begin(char *ttype, bool v) 650 + bool torture_init_begin(char *ttype, int v) 654 651 { 655 652 mutex_lock(&fullstop_mutex); 656 653 if (torture_type != NULL) {
+12 -14
tools/testing/selftests/rcutorture/bin/configinit.sh
··· 1 1 #!/bin/bash 2 2 # 3 - # Usage: configinit.sh config-spec-file [ build output dir ] 3 + # Usage: configinit.sh config-spec-file build-output-dir results-dir 4 4 # 5 5 # Create a .config file from the spec file. Run from the kernel source tree. 6 6 # Exits with 0 if all went well, with 1 if all went well but the config ··· 40 40 41 41 c=$1 42 42 buildloc=$2 43 + resdir=$3 43 44 builddir= 44 - if test -n $buildloc 45 + if echo $buildloc | grep -q '^O=' 45 46 then 46 - if echo $buildloc | grep -q '^O=' 47 + builddir=`echo $buildloc | sed -e 's/^O=//'` 48 + if test ! -d $builddir 47 49 then 48 - builddir=`echo $buildloc | sed -e 's/^O=//'` 49 - if test ! -d $builddir 50 - then 51 - mkdir $builddir 52 - fi 53 - else 54 - echo Bad build directory: \"$buildloc\" 55 - exit 2 50 + mkdir $builddir 56 51 fi 52 + else 53 + echo Bad build directory: \"$buildloc\" 54 + exit 2 57 55 fi 58 56 59 57 sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh ··· 59 61 grep '^grep' < $T/u.sh > $T/upd.sh 60 62 echo "cat - $c" >> $T/upd.sh 61 63 make mrproper 62 - make $buildloc distclean > $builddir/Make.distclean 2>&1 63 - make $buildloc $TORTURE_DEFCONFIG > $builddir/Make.defconfig.out 2>&1 64 + make $buildloc distclean > $resdir/Make.distclean 2>&1 65 + make $buildloc $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 64 66 mv $builddir/.config $builddir/.config.sav 65 67 sh $T/upd.sh < $builddir/.config.sav > $builddir/.config 66 68 cp $builddir/.config $builddir/.config.new 67 - yes '' | make $buildloc oldconfig > $builddir/Make.oldconfig.out 2> $builddir/Make.oldconfig.err 69 + yes '' | make $buildloc oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err 68 70 69 71 # verify new config matches specification. 70 72 configcheck.sh $builddir/.config $c
+6 -5
tools/testing/selftests/rcutorture/bin/kvm-build.sh
··· 2 2 # 3 3 # Build a kvm-ready Linux kernel from the tree in the current directory. 4 4 # 5 - # Usage: kvm-build.sh config-template build-dir 5 + # Usage: kvm-build.sh config-template build-dir resdir 6 6 # 7 7 # This program is free software; you can redistribute it and/or modify 8 8 # it under the terms of the GNU General Public License as published by ··· 29 29 exit 1 30 30 fi 31 31 builddir=${2} 32 + resdir=${3} 32 33 33 34 T=${TMPDIR-/tmp}/test-linux.sh.$$ 34 35 trap 'rm -rf $T' 0 ··· 42 41 CONFIG_VIRTIO_CONSOLE=y 43 42 ___EOF___ 44 43 45 - configinit.sh $T/config O=$builddir 44 + configinit.sh $T/config O=$builddir $resdir 46 45 retval=$? 47 46 if test $retval -gt 1 48 47 then 49 48 exit 2 50 49 fi 51 50 ncpus=`cpus2use.sh` 52 - make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $builddir/Make.out 2>&1 51 + make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1 53 52 retval=$? 54 - if test $retval -ne 0 || grep "rcu[^/]*": < $builddir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $builddir/Make.out 53 + if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $resdir/Make.out 55 54 then 56 55 echo Kernel build error 57 - egrep "Stop|Error|error:|warning:" < $builddir/Make.out 56 + egrep "Stop|Error|error:|warning:" < $resdir/Make.out 58 57 echo Run aborted. 59 58 exit 3 60 59 fi
+1
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh
··· 70 70 else 71 71 print_warning $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i 72 72 fi 73 + echo $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i > $i/console.log.rcu.diags 73 74 fi
+1
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
··· 39 39 head -1 $resdir/log 40 40 fi 41 41 TORTURE_SUITE="`cat $i/../TORTURE_SUITE`" 42 + rm -f $i/console.log.*.diags 42 43 kvm-recheck-${TORTURE_SUITE}.sh $i 43 44 if test -f "$i/console.log" 44 45 then
+3 -2
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
··· 98 98 ln -s $base_resdir/.config $resdir # for kvm-recheck.sh 99 99 # Arch-independent indicator 100 100 touch $resdir/builtkernel 101 - elif kvm-build.sh $T/Kc2 $builddir 101 + elif kvm-build.sh $T/Kc2 $builddir $resdir 102 102 then 103 103 # Had to build a kernel for this test. 104 104 QEMU="`identify_qemu $builddir/vmlinux`" 105 105 BOOT_IMAGE="`identify_boot_image $QEMU`" 106 - cp $builddir/Make*.out $resdir 107 106 cp $builddir/vmlinux $resdir 108 107 cp $builddir/.config $resdir 108 + cp $builddir/Module.symvers $resdir > /dev/null || : 109 + cp $builddir/System.map $resdir > /dev/null || : 109 110 if test -n "$BOOT_IMAGE" 110 111 then 111 112 cp $builddir/$BOOT_IMAGE $resdir
+1 -1
tools/testing/selftests/rcutorture/bin/kvm.sh
··· 347 347 print "needqemurun=" 348 348 jn=1 349 349 for (j = first; j < pastlast; j++) { 350 - builddir=KVM "/b" jn 350 + builddir=KVM "/b1" 351 351 cpusr[jn] = cpus[j]; 352 352 if (cfrep[cf[j]] == "") { 353 353 cfr[jn] = cf[j];
+7
tools/testing/selftests/rcutorture/bin/parse-console.sh
··· 163 163 print_warning Summary: $summary 164 164 cat $T.diags >> $file.diags 165 165 fi 166 + for i in $file.*.diags 167 + do 168 + if test -f "$i" 169 + then 170 + cat $i >> $file.diags 171 + fi 172 + done 166 173 if ! test -s $file.diags 167 174 then 168 175 rm -f $file.diags
-1
tools/testing/selftests/rcutorture/configs/rcu/TREE08-T.boot
··· 1 - rcutree.rcu_fanout_exact=1