History

torture: Trace long read-side delays

Although rcutorture will occasionally do a 50-millisecond grace-period delay, these delays are quite rare. And rightly so, because otherwise the read rate would be quite low. Thie means that it can be important to identify whether or not a given run contained a long-delay read. This commit therefore inserts a trace_rcu_torture_read() event to flag runs containing long delays.

Paul E. McKenney committed 10 years ago

Commit d0af39e1 parent f2151a02 files · +14 −2Browse files

Unified · Split

2 files
  1. include/trace/events/rcu.h +4 −1
  2. kernel/rcu/rcutorture.c +10 −1
include/trace/events/rcu.h+4−1
@@ -698,7 +698,10 @@ TRACE_EVENT(rcu_batch_end, · 697 unmodified lines
698698 /*
699699 * Tracepoint for rcutorture readers. The first argument is the name
700700 * of the RCU flavor from rcutorture's viewpoint and the second argument
701− * is the callback address.
701+ * is the callback address. The third argument is the start time in
702+ * seconds, and the last two arguments are the grace period numbers
703+ * at the beginning and end of the read, respectively. Note that the
704+ * callback address can be NULL.
702705 */
703706 TRACE_EVENT(rcu_torture_read,
704707
kernel/rcu/rcutorture.c+10−1
@@ -289,15 +289,24 @@ static int rcu_torture_read_lock(void) __acquires(RCU) · 288 unmodified lines
289289
290290 static void rcu_read_delay(struct torture_random_state *rrsp)
291291 {
292+ unsigned long started;
293+ unsigned long completed;
292294 const unsigned long shortdelay_us = 200;
293295 const unsigned long longdelay_ms = 50;
296+ unsigned long long ts;
294297
295298 /* We want a short delay sometimes to make a reader delay the grace
296299 * period, and we want a long delay occasionally to trigger
297300 * force_quiescent_state. */
298301
299− if (!(torture_random(rrsp) % (nrealreaders * 2000 * longdelay_ms)))
302+ if (!(torture_random(rrsp) % (nrealreaders * 2000 * longdelay_ms))) {
303+ started = cur_ops->completed();
304+ ts = rcu_trace_clock_local();
300305 mdelay(longdelay_ms);
306+ completed = cur_ops->completed();
307+ do_trace_rcu_torture_read(cur_ops->name, NULL, ts,
308+ started, completed);
309+ }
301310 if (!(torture_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))
302311 udelay(shortdelay_us);
303312 #ifdef CONFIG_PREEMPT