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
698/*698/*
699 * Tracepoint for rcutorture readers. The first argument is the name699 * Tracepoint for rcutorture readers. The first argument is the name
700 * of the RCU flavor from rcutorture's viewpoint and the second argument700 * 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.
702 */705 */
703TRACE_EVENT(rcu_torture_read,706TRACE_EVENT(rcu_torture_read,
704 707
kernel/rcu/rcutorture.c+10−1
@@ -289,15 +289,24 @@ static int rcu_torture_read_lock(void) __acquires(RCU) · 288 unmodified lines
289 289
290static void rcu_read_delay(struct torture_random_state *rrsp)290static void rcu_read_delay(struct torture_random_state *rrsp)
291{291{
292 unsigned long started;
293 unsigned long completed;
292 const unsigned long shortdelay_us = 200;294 const unsigned long shortdelay_us = 200;
293 const unsigned long longdelay_ms = 50;295 const unsigned long longdelay_ms = 50;
296 unsigned long long ts;
294 297
295 /* We want a short delay sometimes to make a reader delay the grace298 /* We want a short delay sometimes to make a reader delay the grace
296 * period, and we want a long delay occasionally to trigger299 * period, and we want a long delay occasionally to trigger
297 * force_quiescent_state. */300 * force_quiescent_state. */
298 301
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();
300 mdelay(longdelay_ms);305 mdelay(longdelay_ms);
306 completed = cur_ops->completed();
307 do_trace_rcu_torture_read(cur_ops->name, NULL, ts,
308 started, completed);
309 }
301 if (!(torture_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))310 if (!(torture_random(rrsp) % (nrealreaders * 2 * shortdelay_us)))
302 udelay(shortdelay_us);311 udelay(shortdelay_us);
303#ifdef CONFIG_PREEMPT312#ifdef CONFIG_PREEMPT