aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-01-21 15:24:56 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-22 04:27:16 -0500
commit97b17efe4537e11bf6669106cfe4ee2c5331b267 (patch)
tree46310b25ea38628fc631d4c4c248ebe66426036f /kernel/trace
parent5bc4564b224c3d9fe6dddafa25f56059bd978231 (diff)
ring-buffer: do not swap if recording is disabled
If the ring buffer recording has been disabled. Do not let swapping of ring buffers occur. Simply return -EAGAIN. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ring_buffer.c15
-rw-r--r--kernel/trace/trace.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0b9de5a3d699..890020e28a35 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2266,9 +2266,24 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
2266 if (buffer_a->pages != buffer_b->pages) 2266 if (buffer_a->pages != buffer_b->pages)
2267 return -EINVAL; 2267 return -EINVAL;
2268 2268
2269 if (ring_buffer_flags != RB_BUFFERS_ON)
2270 return -EAGAIN;
2271
2272 if (atomic_read(&buffer_a->record_disabled))
2273 return -EAGAIN;
2274
2275 if (atomic_read(&buffer_b->record_disabled))
2276 return -EAGAIN;
2277
2269 cpu_buffer_a = buffer_a->buffers[cpu]; 2278 cpu_buffer_a = buffer_a->buffers[cpu];
2270 cpu_buffer_b = buffer_b->buffers[cpu]; 2279 cpu_buffer_b = buffer_b->buffers[cpu];
2271 2280
2281 if (atomic_read(&cpu_buffer_a->record_disabled))
2282 return -EAGAIN;
2283
2284 if (atomic_read(&cpu_buffer_b->record_disabled))
2285 return -EAGAIN;
2286
2272 /* 2287 /*
2273 * We can't do a synchronize_sched here because this 2288 * We can't do a synchronize_sched here because this
2274 * function can be called in atomic context. 2289 * function can be called in atomic context.
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 220c264e3111..757ae6f7e648 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -415,7 +415,7 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
415 415
416 ftrace_enable_cpu(); 416 ftrace_enable_cpu();
417 417
418 WARN_ON_ONCE(ret); 418 WARN_ON_ONCE(ret && ret != -EAGAIN);
419 419
420 __update_max_tr(tr, tsk, cpu); 420 __update_max_tr(tr, tsk, cpu);
421 __raw_spin_unlock(&ftrace_max_lock); 421 __raw_spin_unlock(&ftrace_max_lock);