rcutorture changes for 3.20
Subsystems (4)
cover rcutorture changes for 3.20
Hello!
This series contains rcutorture updates for 3.20:
1. Issue warnings on close calls due to Reader Batch blows.
This diagnostic would have spotted the ugly preemptible-RCU CPU-hotplug bug some years back.
2. Make _batches_completed() functions return unsigned long to
avoid signed overflow issues.
3. Make build-output parsing correctly flag RCU's warnings.
These needed to be updated when the "rcu" directory was created in "kernel."
4. Use unsigned long for Reader Batch computations, avoiding
signed overflow.
5. Provide rcu_batches_completed_sched() for TINY_RCU for new
rcutorture compatibility.
6. Drop rcu_torture_completed() and friends. Now that the types
match, the wrappers aren't needed.
7. Remove redundant rcu_batches_completed() declaration.
8. Check from beginning to end of grace period instead of from
end of previous grace period to end of next one. This makes rcutorture more sensitive to RCU bugs that make the grace period too short.
9. Handle different mpstat versions -- new versions added fields.
10. torture: Add "-enable-kvm -soundhw pcspk" to qemu command line,
as newer versions of qemu complain if they are missing.
11. Flag console.log file to prevent holdovers from earlier runs,
which could make a run look successful when it didn't even get to the point of starting qemu.
12. Add more diagnostics in rcu_barrier() test failure case.
Thanx, Paul
------------------------------------------------------------------------
b/include/linux/rcutiny.h | 42 ++++++ b/include/linux/rcutree.h | 9 - b/kernel/rcu/rcutorture.c | 74 ++++++------ b/kernel/rcu/tree.c | 44 ++++++- b/kernel/rcu/tree.h | 3 b/kernel/rcu/tree_plugin.h | 34 ----- b/tools/testing/selftests/rcutorture/bin/cpus2use.sh | 2 b/tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh | 18 ++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 9 - b/tools/testing/selftests/rcutorture/bin/parse-build.sh | 20 ++- 10 files changed, 166 insertions(+), 89 deletions(-)
PATCH 1/12 rcutorture: Issue warnings on close calls due to Reader Batch blows
From: "Paul E. McKenney" <[email protected]>
Normal rcutorture checking overestimates grace periods somewhat due to the fact that there is a delay from a grace-period request until the start of the corresponding grace period and another delay from the end of that grace period to notification of the requestor. This means that rcutorture's detection of RCU bugs is less sensitive than it might be.
It turns out that rcutorture also checks the underlying grace-period "completed" counter (displayed in Reader Batch output), which in theory allows rcutorture to do exact checks. In practice, memory misordering (by both compiler and CPU) can result in false positives. However, experience on x86 shows that these false positives are quite rare, occuring less than one time per 1,000 hours of testing. This commit therefore does the exact checking, giving a warning if any Reader Batch blows happen, and flagging an error if they happen more often than once every three hours in long tests.
--- .../selftests/rcutorture/bin/kvm-recheck-rcu.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh +18 -0
@@ -30,6 +30,7 @@ else echo Unreadable results directory: $i exit 1 fi +. tools/testing/selftests/rcutorture/bin/functions.sh configfile=`echo $i | sed -e 's/^.*\///'` ngps=`grep ver: $i/console.log 2> /dev/null | tail -1 | sed -e 's/^.* ver: //' -e 's/ .*$//'`
@@ -48,4 +49,21 @@ else title="$title ($ngpsps per second)" fi echo $title + nclosecalls=`grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'` + if test -z "$nclosecalls" + then + exit 0 + fi + if test "$nclosecalls" -eq 0 + then + exit 0 + fi + # Compute number of close calls per tenth of an hour + nclosecalls10=`awk -v nclosecalls=$nclosecalls -v dur=$dur 'BEGIN { print int(nclosecalls * 36000 / dur) }' < /dev/null` + if test $nclosecalls10 -gt 5 -a $nclosecalls -gt 1 + then + print_bug $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i + else + print_warning $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i + fi fi
Signature · 1 line
1.8.1.5
PATCH 2/12 rcu: Make _batches_completed() functions return unsigned long
From: "Paul E. McKenney" <[email protected]>
Long ago, the various ->completed fields were of type long, but now are unsigned long due to signed-integer-overflow concerns. However, the various _batches_completed() functions remained of type long, even though their only purpose in life is to return the corresponding ->completed field. This patch cleans this up by changing these functions' return types to unsigned long.
--- include/linux/rcutiny.h | 4 ++-- include/linux/rcutree.h | 6 +++--- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree.h | 2 +- kernel/rcu/tree_plugin.h | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-)
include/linux/rcutiny.h +2 -2
@@ -94,7 +94,7 @@ static inline void rcu_virt_note_context_switch(int cpu)/* * Return the number of grace periods. */ -static inline long rcu_batches_completed (void ) +static inline unsigned long rcu_batches_completed (void ) {return 0 ; }
@@ -102,7 +102,7 @@ static inline long rcu_batches_completed(void)/* * Return the number of bottom-half grace periods. */ -static inline long rcu_batches_completed_bh (void ) +static inline unsigned long rcu_batches_completed_bh (void ) {return 0 ; }
include/linux/rcutree.h +3 -3
@@ -81,9 +81,9 @@ void cond_synchronize_rcu(unsigned long oldstate);extern unsigned long rcutorture_testseq;extern unsigned long rcutorture_vernum; -long rcu_batches_completed (void ); -long rcu_batches_completed_bh (void ); -long rcu_batches_completed_sched (void ); +unsigned long rcu_batches_completed (void ); +unsigned long rcu_batches_completed_bh (void ); +unsigned long rcu_batches_completed_sched (void );void show_rcu_gp_kthreads (void );void rcu_force_quiescent_state (void );
kernel/rcu/tree.c +2 -2
@@ -317,7 +317,7 @@ static int rcu_pending(void);/* * Return the number of RCU-sched batches processed thus far for debug & stats. */ -long rcu_batches_completed_sched (void ) +unsigned long rcu_batches_completed_sched (void ) {return rcu_sched_state.completed; }
@@ -326,7 +326,7 @@ EXPORT_SYMBOL_GPL(rcu_batches_completed_sched);/* * Return the number of RCU BH batches processed thus far for debug & stats. */ -long rcu_batches_completed_bh (void ) +unsigned long rcu_batches_completed_bh (void ) {return rcu_bh_state.completed; }
kernel/rcu/tree.h +1 -1
@@ -546,7 +546,7 @@ DECLARE_PER_CPU(char, rcu_cpu_has_work);/* Forward declarations for rcutree_plugin.h */ static void rcu_bootup_announce (void ); -long rcu_batches_completed (void ); +unsigned long rcu_batches_completed (void );static void rcu_preempt_note_context_switch (void );static int rcu_preempt_blocked_readers_cgp (struct rcu_node *rnp);#ifdef CONFIG_HOTPLUG_CPU
kernel/rcu/tree_plugin.h +3 -3
@@ -117,7 +117,7 @@ static void __init rcu_bootup_announce(void)* Return the number of RCU-preempt batches processed thus far * for debug and statistics. */ -static long rcu_batches_completed_preempt (void ) +static unsigned long rcu_batches_completed_preempt (void ) {return rcu_preempt_state.completed; }
@@ -126,7 +126,7 @@ EXPORT_SYMBOL_GPL(rcu_batches_completed_preempt);/* * Return the number of RCU batches processed thus far for debug & stats. */ -long rcu_batches_completed (void ) +unsigned long rcu_batches_completed (void ) {return rcu_batches_completed_preempt (); }
@@ -935,7 +935,7 @@ static void __init rcu_bootup_announce(void)/* * Return the number of RCU batches processed thus far for debug & stats. */ -long rcu_batches_completed (void ) +unsigned long rcu_batches_completed (void ) {return rcu_batches_completed_sched (); }
Signature · 1 line
1.8.1.5
PATCH 3/12 rcutorture: Make build-output parsing correctly flag RCU's warnings
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
--- .../testing/selftests/rcutorture/bin/parse-build.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
tools/testing/selftests/rcutorture/bin/parse-build.sh +13 -7
@@ -26,12 +26,15 @@ # # Authors: Paul E. McKenney <[email protected]> -T=$1 +F=$1 title=$2 +T=/tmp/parse-build.sh.$$ +trap 'rm -rf $T' 0 +mkdir $T . functions.sh -if grep -q CC < $T +if grep -q CC < $F then : else
@@ -39,18 +42,21 @@ else exit 1 fi -if grep -q "error:" < $T +if grep -q "error:" < $F then print_bug $title build errors: - grep "error:" < $T + grep "error:" < $F exit 2 fi -exit 0 -if egrep -q "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T +grep warning: < $F > $T/warnings +grep "include/linux/*rcu*\.h:" $T/warnings > $T/hwarnings +grep "kernel/rcu/[^/]*:" $T/warnings > $T/cwarnings +cat $T/hwarnings $T/cwarnings > $T/rcuwarnings +if test -s $T/rcuwarnings then print_warning $title build errors: - egrep "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T + cat $T/rcuwarnings exit 2 fi exit 0
Signature · 1 line
1.8.1.5
PATCH 4/12 rcutorture: Use unsigned for Reader Batch computations
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
The counter returned by the various ->completed functions is subject to overflow, which means that subtracting two such counters might result in overflow, which invokes undefined behavior in the C standard. This commit therefore changes these functions and variables to unsigned to avoid this undefined behavior.
--- kernel/rcu/rcutorture.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
kernel/rcu/rcutorture.c +9 -9
@@ -244,7 +244,7 @@ struct rcu_torture_ops {int (*readlock)(void );void (*read_delay)(struct torture_random_state *rrsp);void (*readunlock)(int idx); -int (*completed)(void ); +unsigned long (*completed)(void );void (*deferred_free)(struct rcu_torture *p);void (*sync)(void );void (*exp_sync)(void );
@@ -296,7 +296,7 @@ static void rcu_torture_read_unlock(int idx) __releases(RCU)rcu_read_unlock (); } -static int rcu_torture_completed (void ) +static unsigned long rcu_torture_completed (void ) {return rcu_batches_completed (); }
@@ -356,7 +356,7 @@ rcu_torture_cb(struct rcu_head *p) cur_ops->deferred_free (rp); } -static int rcu_no_completed (void ) +static unsigned long rcu_no_completed (void ) {return 0 ; }
@@ -407,7 +407,7 @@ static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)rcu_read_unlock_bh (); } -static int rcu_bh_torture_completed (void ) +static unsigned long rcu_bh_torture_completed (void ) {return rcu_batches_completed_bh (); }
@@ -510,7 +510,7 @@ static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl)srcu_read_unlock (&srcu_ctl, idx); } -static int srcu_torture_completed (void ) +static unsigned long srcu_torture_completed (void ) {return srcu_batches_completed (&srcu_ctl); }
@@ -1015,8 +1015,8 @@ static void rcutorture_trace_dump(void)static void rcu_torture_timer (unsigned long unused) {int idx; -int completed; -int completed_end; +unsigned long completed; +unsigned long completed_end;static DEFINE_TORTURE_RANDOM (rand);static DEFINE_SPINLOCK (rand_lock);struct rcu_torture *p;
@@ -1073,8 +1073,8 @@ static void rcu_torture_timer(unsigned long unused)static int rcu_torture_reader (void *arg) { -int completed; -int completed_end; +unsigned long completed; +unsigned long completed_end;int idx;DEFINE_TORTURE_RANDOM (rand);struct rcu_torture *p;
Signature · 1 line
1.8.1.5
PATCH 5/12 rcu: provide rcu_batches_completed_sched() for TINY_RCU
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
A bug in rcutorture has caused it to ignore completed batches. In preparation for fixing that bug, this commit provides TINY_RCU with the required rcu_batches_completed_sched().
--- include/linux/rcutiny.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/rcutiny.h +8 -0
@@ -107,6 +107,14 @@ static inline unsigned long rcu_batches_completed_bh(void)return 0 ; } +/* +* Return the number of sched grace periods. +*/ +static inline unsigned long rcu_batches_completed_sched (void ) +{ +return 0 ; +} +static inline void rcu_force_quiescent_state (void ) { }
Signature · 1 line
1.8.1.5
PATCH 6/12 rcutorture: Drop rcu_torture_completed() and friends
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
Now that the return type of rcu_batches_completed() and friends matches that of the rcu_torture_ops structure's ->completed field, the wrapper functions can be deleted. This commit carries out that deletion, while also wiring "sched"'s ->completed field to rcu_batches_completed_sched().
--- kernel/rcu/rcutorture.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
kernel/rcu/rcutorture.c +3 -13
@@ -296,11 +296,6 @@ static void rcu_torture_read_unlock(int idx) __releases(RCU)rcu_read_unlock (); } -static unsigned long rcu_torture_completed (void ) -{ -return rcu_batches_completed (); -} -/* * Update callback in the pipe. This should be invoked after a grace period. */
@@ -377,7 +372,7 @@ static struct rcu_torture_ops rcu_ops = { .readlock = rcu_torture_read_lock, .read_delay = rcu_read_delay, .readunlock = rcu_torture_read_unlock, - .completed = rcu_torture_completed, + .completed = rcu_batches_completed, .deferred_free = rcu_torture_deferred_free, .sync = synchronize_rcu, .exp_sync = synchronize_rcu_expedited,
@@ -407,11 +402,6 @@ static void rcu_bh_torture_read_unlock(int idx) __releases(RCU_BH)rcu_read_unlock_bh (); } -static unsigned long rcu_bh_torture_completed (void ) -{ -return rcu_batches_completed_bh (); -} -static void rcu_bh_torture_deferred_free (struct rcu_torture *p) {call_rcu_bh (&p->rtort_rcu, rcu_torture_cb);
@@ -423,7 +413,7 @@ static struct rcu_torture_ops rcu_bh_ops = { .readlock = rcu_bh_torture_read_lock, .read_delay = rcu_read_delay, /* just reuse rcu's version. */ .readunlock = rcu_bh_torture_read_unlock, - .completed = rcu_bh_torture_completed, + .completed = rcu_batches_completed_bh, .deferred_free = rcu_bh_torture_deferred_free, .sync = synchronize_rcu_bh, .exp_sync = synchronize_rcu_bh_expedited,
@@ -600,7 +590,7 @@ static struct rcu_torture_ops sched_ops = { .readlock = sched_torture_read_lock, .read_delay = rcu_read_delay, /* just reuse rcu's version. */ .readunlock = sched_torture_read_unlock, - .completed = rcu_no_completed, + .completed = rcu_batches_completed_sched, .deferred_free = rcu_sched_torture_deferred_free, .sync = synchronize_sched, .exp_sync = synchronize_sched_expedited,
Signature · 1 line
1.8.1.5
PATCH 7/12 rcu: Remove redundant rcu_batches_completed() declaration
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
--- kernel/rcu/tree.h | 1 - 1 file changed, 1 deletion(-)
kernel/rcu/tree.h +0 -1
@@ -546,7 +546,6 @@ DECLARE_PER_CPU(char, rcu_cpu_has_work);/* Forward declarations for rcutree_plugin.h */ static void rcu_bootup_announce (void ); -unsigned long rcu_batches_completed (void );static void rcu_preempt_note_context_switch (void );static int rcu_preempt_blocked_readers_cgp (struct rcu_node *rnp);#ifdef CONFIG_HOTPLUG_CPU
Signature · 1 line
1.8.1.5
PATCH 8/12 rcutorture: Check from beginning to end of grace period
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
Currently, rcutorture's Reader Batch checks measure from the end of the previous grace period to the end of the current one. This commit tightens up these checks by measuring from the start and end of the same grace period. This involves adding rcu_batches_started() and friends corresponding to the existing rcu_batches_completed() and friends.
We leave SRCU alone for the moment, as it does not yet have a way of tracking both ends of its grace periods.
--- include/linux/rcutiny.h | 30 +++++++++++++++++++++++++++--- include/linux/rcutree.h | 3 +++ kernel/rcu/rcutorture.c | 37 +++++++++++++++++++++++++++---------- kernel/rcu/tree.c | 40 ++++++++++++++++++++++++++++++++++++++-- kernel/rcu/tree_plugin.h | 28 ---------------------------- 5 files changed, 95 insertions(+), 43 deletions(-)
include/linux/rcutiny.h +27 -3
@@ -92,7 +92,31 @@ static inline void rcu_virt_note_context_switch(int cpu) }/* -* Return the number of grace periods. +* Return the number of grace periods started. +*/ +static inline unsigned long rcu_batches_started (void ) +{ +return 0 ; +} + +/* +* Return the number of bottom-half grace periods started. +*/ +static inline unsigned long rcu_batches_started_bh (void ) +{ +return 0 ; +} + +/* +* Return the number of sched grace periods started. +*/ +static inline unsigned long rcu_batches_started_sched (void ) +{ +return 0 ; +} + +/* +* Return the number of grace periods completed. */ static inline unsigned long rcu_batches_completed (void ) {
@@ -100,7 +124,7 @@ static inline unsigned long rcu_batches_completed(void) }/* -* Return the number of bottom-half grace periods. +* Return the number of bottom-half grace periods completed. */ static inline unsigned long rcu_batches_completed_bh (void ) {
@@ -108,7 +132,7 @@ static inline unsigned long rcu_batches_completed_bh(void) }/* -* Return the number of sched grace periods. +* Return the number of sched grace periods completed. */ static inline unsigned long rcu_batches_completed_sched (void ) {
include/linux/rcutree.h +3 -0
@@ -81,6 +81,9 @@ void cond_synchronize_rcu(unsigned long oldstate);extern unsigned long rcutorture_testseq;extern unsigned long rcutorture_vernum; +unsigned long rcu_batches_started (void ); +unsigned long rcu_batches_started_bh (void ); +unsigned long rcu_batches_started_sched (void );unsigned long rcu_batches_completed (void );unsigned long rcu_batches_completed_bh (void );unsigned long rcu_batches_completed_sched (void );
kernel/rcu/rcutorture.c +27 -10
@@ -244,6 +244,7 @@ struct rcu_torture_ops {int (*readlock)(void );void (*read_delay)(struct torture_random_state *rrsp);void (*readunlock)(int idx); +unsigned long (*started)(void );unsigned long (*completed)(void );void (*deferred_free)(struct rcu_torture *p);void (*sync)(void );
@@ -372,6 +373,7 @@ static struct rcu_torture_ops rcu_ops = { .readlock = rcu_torture_read_lock, .read_delay = rcu_read_delay, .readunlock = rcu_torture_read_unlock, + .started = rcu_batches_started, .completed = rcu_batches_completed, .deferred_free = rcu_torture_deferred_free, .sync = synchronize_rcu,
@@ -413,6 +415,7 @@ static struct rcu_torture_ops rcu_bh_ops = { .readlock = rcu_bh_torture_read_lock, .read_delay = rcu_read_delay, /* just reuse rcu's version. */ .readunlock = rcu_bh_torture_read_unlock, + .started = rcu_batches_started_bh, .completed = rcu_batches_completed_bh, .deferred_free = rcu_bh_torture_deferred_free, .sync = synchronize_rcu_bh,
@@ -456,6 +459,7 @@ static struct rcu_torture_ops rcu_busted_ops = { .readlock = rcu_torture_read_lock, .read_delay = rcu_read_delay, /* just reuse rcu's version. */ .readunlock = rcu_torture_read_unlock, + .started = rcu_no_completed, .completed = rcu_no_completed, .deferred_free = rcu_busted_torture_deferred_free, .sync = synchronize_rcu_busted,
@@ -554,6 +558,7 @@ static struct rcu_torture_ops srcu_ops = { .readlock = srcu_torture_read_lock, .read_delay = srcu_read_delay, .readunlock = srcu_torture_read_unlock, + .started = NULL, .completed = srcu_torture_completed, .deferred_free = srcu_torture_deferred_free, .sync = srcu_torture_synchronize,
@@ -590,6 +595,7 @@ static struct rcu_torture_ops sched_ops = { .readlock = sched_torture_read_lock, .read_delay = rcu_read_delay, /* just reuse rcu's version. */ .readunlock = sched_torture_read_unlock, + .started = rcu_batches_started_sched, .completed = rcu_batches_completed_sched, .deferred_free = rcu_sched_torture_deferred_free, .sync = synchronize_sched,
@@ -628,6 +634,7 @@ static struct rcu_torture_ops tasks_ops = { .readlock = tasks_torture_read_lock, .read_delay = rcu_read_delay, /* just reuse rcu's version. */ .readunlock = tasks_torture_read_unlock, + .started = rcu_no_completed, .completed = rcu_no_completed, .deferred_free = rcu_tasks_torture_deferred_free, .sync = synchronize_rcu_tasks,
@@ -1005,8 +1012,8 @@ static void rcutorture_trace_dump(void)static void rcu_torture_timer (unsigned long unused) {int idx; +unsigned long started;unsigned long completed; -unsigned long completed_end;static DEFINE_TORTURE_RANDOM (rand);static DEFINE_SPINLOCK (rand_lock);struct rcu_torture *p;
@@ -1014,7 +1021,10 @@ static void rcu_torture_timer(unsigned long unused)unsigned long long ts; idx = cur_ops->readlock (); - completed = cur_ops->completed (); +if (cur_ops->started) + started = cur_ops->started (); +else + started = cur_ops->completed (); ts =rcu_trace_clock_local (); p = rcu_dereference_check(rcu_torture_current, rcu_read_lock_bh_held() ||
@@ -1037,14 +1047,16 @@ static void rcu_torture_timer(unsigned long unused)/* Should not happen, but... */ pipe_count =RCU_TORTURE_PIPE_LEN ; } - completed_end = cur_ops->completed (); + completed = cur_ops->completed ();if (pipe_count >1 ) {do_trace_rcu_torture_read (cur_ops->name, &p->rtort_rcu, ts, - completed, completed_end); + started, completed);rcutorture_trace_dump (); }__this_cpu_inc (rcu_torture_count[pipe_count]); - completed = completed_end - completed; + completed = completed - started; +if (cur_ops->started) + completed++;if (completed >RCU_TORTURE_PIPE_LEN ) {/* Should not happen, but... */ completed =RCU_TORTURE_PIPE_LEN ;
@@ -1063,8 +1075,8 @@ static void rcu_torture_timer(unsigned long unused)static int rcu_torture_reader (void *arg) { +unsigned long started;unsigned long completed; -unsigned long completed_end;int idx;DEFINE_TORTURE_RANDOM (rand);struct rcu_torture *p;
@@ -1083,7 +1095,10 @@ rcu_torture_reader(void *arg)mod_timer (&t, jiffies +1 ); } idx = cur_ops->readlock (); - completed = cur_ops->completed (); +if (cur_ops->started) + started = cur_ops->started (); +else + started = cur_ops->completed (); ts =rcu_trace_clock_local (); p = rcu_dereference_check(rcu_torture_current, rcu_read_lock_bh_held() ||
@@ -1104,14 +1119,16 @@ rcu_torture_reader(void *arg)/* Should not happen, but... */ pipe_count =RCU_TORTURE_PIPE_LEN ; } - completed_end = cur_ops->completed (); + completed = cur_ops->completed ();if (pipe_count >1 ) {do_trace_rcu_torture_read (cur_ops->name, &p->rtort_rcu, - ts, completed, completed_end); + ts, started, completed);rcutorture_trace_dump (); }__this_cpu_inc (rcu_torture_count[pipe_count]); - completed = completed_end - completed; + completed = completed - started; +if (cur_ops->started) + completed++;if (completed >RCU_TORTURE_PIPE_LEN ) {/* Should not happen, but... */ completed =RCU_TORTURE_PIPE_LEN ;
kernel/rcu/tree.c +38 -2
@@ -315,7 +315,43 @@ static void force_quiescent_state(struct rcu_state *rsp);static int rcu_pending (void );/* -* Return the number of RCU-sched batches processed thus far for debug & stats. +* Return the number of RCU batches started thus far for debug & stats. +*/ +unsigned long rcu_batches_started (void ) +{ +return rcu_state_p->gpnum; +} +EXPORT_SYMBOL_GPL (rcu_batches_started); + +/* +* Return the number of RCU-sched batches started thus far for debug & stats. +*/ +unsigned long rcu_batches_started_sched (void ) +{ +return rcu_sched_state.gpnum; +} +EXPORT_SYMBOL_GPL (rcu_batches_started_sched); + +/* +* Return the number of RCU BH batches started thus far for debug & stats. +*/ +unsigned long rcu_batches_started_bh (void ) +{ +return rcu_bh_state.gpnum; +} +EXPORT_SYMBOL_GPL (rcu_batches_started_bh); + +/* +* Return the number of RCU batches completed thus far for debug & stats. +*/ +unsigned long rcu_batches_completed (void ) +{ +return rcu_state_p->completed; +} +EXPORT_SYMBOL_GPL (rcu_batches_completed); + +/* +* Return the number of RCU-sched batches completed thus far for debug & stats. */ unsigned long rcu_batches_completed_sched (void ) {
@@ -324,7 +360,7 @@ unsigned long rcu_batches_completed_sched(void)EXPORT_SYMBOL_GPL (rcu_batches_completed_sched);/* -* Return the number of RCU BH batches processed thus far for debug & stats. +* Return the number of RCU BH batches completed thus far for debug & stats. */ unsigned long rcu_batches_completed_bh (void ) {
kernel/rcu/tree_plugin.h +0 -28
@@ -114,25 +114,6 @@ static void __init rcu_bootup_announce(void) }/* -* Return the number of RCU-preempt batches processed thus far -* for debug and statistics. -*/ -static unsigned long rcu_batches_completed_preempt (void ) -{ -return rcu_preempt_state.completed; -} -EXPORT_SYMBOL_GPL (rcu_batches_completed_preempt); - -/* -* Return the number of RCU batches processed thus far for debug & stats. -*/ -unsigned long rcu_batches_completed (void ) -{ -return rcu_batches_completed_preempt (); -} -EXPORT_SYMBOL_GPL (rcu_batches_completed); - -/* * Record a preemptible-RCU quiescent state for the specified CPU. Note * that this just means that the task currently running on the CPU is * not in a quiescent state. There might be any number of tasks blocked
@@ -933,15 +914,6 @@ static void __init rcu_bootup_announce(void) }/* -* Return the number of RCU batches processed thus far for debug & stats. -*/ -unsigned long rcu_batches_completed (void ) -{ -return rcu_batches_completed_sched (); -} -EXPORT_SYMBOL_GPL (rcu_batches_completed); - -/* * Because preemptible RCU does not exist, we never have to check for * CPUs being in quiescent states. */
Signature · 1 line
1.8.1.5
PATCH 9/12 rcutorture: Handle different mpstat versions
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
The mpstat command recently added the %gnice column, which messes up the cpu2use.sh script's idle-CPU calculations. This commit therefore uses $NF instead of $12 to select the last (%idle) column.
--- tools/testing/selftests/rcutorture/bin/cpus2use.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/cpus2use.sh +1 -1
@@ -24,7 +24,7 @@ ncpus=`grep '^processor' /proc/cpuinfo | wc -l` idlecpus=`mpstat | tail -1 | \ - awk -v ncpus=$ncpus '{ print ncpus * ($7 + $12) / 100 }'` + awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'` awk -v ncpus=$ncpus -v idlecpus=$idlecpus < /dev/null ' BEGIN { cpus2use = idlecpus;
Signature · 1 line
1.8.1.5
PATCH 10/12 torture: Add "-enable-kvm -soundhw pcspk" to qemu command line
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
More recent qemu implementations really want "-enable-kvm", and the "-soundhw pcspk" makes the script a bit less dependent on odd audio libraries being installed. This commit therefore adds both to the default qemu command line.
--- tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +4 -4
@@ -8,9 +8,9 @@ # # Usage: kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args # -# qemu-args defaults to "-nographic", along with arguments specifying the -# number of CPUs and other options generated from -# the underlying CPU architecture. +# qemu-args defaults to "-enable-kvm -soundhw pcspk -nographic", along with +# arguments specifying the number of CPUs and other +# options generated from the underlying CPU architecture. # boot_args defaults to value returned by the per_version_boot_params # shell function. #
@@ -138,7 +138,7 @@ then fi # Generate -smp qemu argument. -qemu_args="-nographic $qemu_args" +qemu_args="-enable-kvm -soundhw pcspk -nographic $qemu_args" cpu_count=`configNR_CPUS.sh $config_template` cpu_count=`configfrag_boot_cpus "$boot_args" "$config_template" "$cpu_count"` vcpus=`identify_qemu_vcpus`
Signature · 1 line
1.8.1.5
PATCH 11/12 torture: Flag console.log file to prevent holdovers from earlier runs
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
A system misconfiguration that prevents qemu from running at all (for example, a missing dynamically linked library) will keep the console.log file from the previous run. This can fool the developer into thinking that this failed run actually completed correctly. This commit therefore overwrites the console.log file just before launching qemu.
--- tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1 -0
@@ -168,6 +168,7 @@ then touch $resdir/buildonly exit 0 fi +echo "NOTE: $QEMU either did not run or was interactive" > $builddir/console.log echo $QEMU $qemu_args -m 512 -kernel $resdir/bzImage -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd ( $QEMU $qemu_args -m 512 -kernel $resdir/bzImage -append "$qemu_append $boot_args"; echo $? > $resdir/qemu-retval ) & qemu_pid=$!
Signature · 1 line
1.8.1.5
PATCH 12/12 rcutorture: Add more diagnostics in rcu_barrier() test failure case
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
--- kernel/rcu/rcutorture.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/rcu/rcutorture.c +3 -0
@@ -1427,6 +1427,9 @@ static int rcu_torture_barrier(void *arg) cur_ops->cb_barrier ();/* Implies smp_mb() for wait_event(). */ if (atomic_read (&barrier_cbs_invoked) != n_barrier_cbs) { n_rcu_torture_barrier_error++; +pr_err ("barrier_cbs_invoked = %d, n_barrier_cbs = %d\n" , +atomic_read (&barrier_cbs_invoked), + n_barrier_cbs);WARN_ON_ONCE (1 ); } n_barrier_successes++;
Signature · 1 line
1.8.1.5