ring-buffer: have benchmark test handle discarded events
Steven Rostedt [Tue, 16 Jun 2009 15:46:09 +0000 (11:46 -0400)]
With the addition of commit:

  c7b0930857e2278f2e7714db6294e94c57f623b0
  ring-buffer: prevent adding write in discarded area

The ring buffer may now add discarded events when a write passes
the end of a buffer page. Before, a discarded event was only added
when the tracer deliberately created one. The ring buffer benchmark
test does not handle discarded events when it reads the buffer and
fails when it encounters one.

Also fix the increment for large data entries (luckily, the test did
not add any yet).

[ Impact: fix false failure of ring buffer self test ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

kernel/trace/ring_buffer_benchmark.c

index 8d68e14..cf6b0f5 100644 (file)
@@ -102,8 +102,10 @@ static enum event_status read_page(int cpu)
                        event = (void *)&rpage->data[i];
                        switch (event->type_len) {
                        case RINGBUF_TYPE_PADDING:
-                               /* We don't expect any padding */
-                               KILL_TEST();
+                               /* failed writes may be discarded events */
+                               if (!event->time_delta)
+                                       KILL_TEST();
+                               inc = event->array[0] + 4;
                                break;
                        case RINGBUF_TYPE_TIME_EXTEND:
                                inc = 8;
@@ -119,7 +121,7 @@ static enum event_status read_page(int cpu)
                                        KILL_TEST();
                                        break;
                                }
-                               inc = event->array[0];
+                               inc = event->array[0] + 4;
                                break;
                        default:
                                entry = ring_buffer_event_data(event);