From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 2/5] ring-buffer: do not swap if recording is disabled
Date: Wed, 21 Jan 2009 18:53:08 -0500 [thread overview]
Message-ID: <20090121235805.992357373@goodmis.org> (raw)
In-Reply-To: 20090121235306.224764198@goodmis.org
[-- Attachment #1: 0002-ring-buffer-do-not-swap-if-recording-is-disabled.patch --]
[-- Type: text/plain, Size: 1614 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
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>
---
kernel/trace/ring_buffer.c | 15 +++++++++++++++
kernel/trace/trace.c | 2 +-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 8de026d..cb260dd 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,
if (buffer_a->pages != buffer_b->pages)
return -EINVAL;
+ if (ring_buffer_flags != RB_BUFFERS_ON)
+ return -EAGAIN;
+
+ if (atomic_read(&buffer_a->record_disabled))
+ return -EAGAIN;
+
+ if (atomic_read(&buffer_b->record_disabled))
+ return -EAGAIN;
+
cpu_buffer_a = buffer_a->buffers[cpu];
cpu_buffer_b = buffer_b->buffers[cpu];
+ if (atomic_read(&cpu_buffer_a->record_disabled))
+ return -EAGAIN;
+
+ if (atomic_read(&cpu_buffer_b->record_disabled))
+ return -EAGAIN;
+
/*
* We can't do a synchronize_sched here because this
* function can be called in atomic context.
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 220c264..757ae6f 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)
ftrace_enable_cpu();
- WARN_ON_ONCE(ret);
+ WARN_ON_ONCE(ret && ret != -EAGAIN);
__update_max_tr(tr, tsk, cpu);
__raw_spin_unlock(&ftrace_max_lock);
--
1.5.6.5
--
next prev parent reply other threads:[~2009-01-21 23:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 23:53 [PATCH 0/5] ftrace: updates for tip Steven Rostedt
2009-01-21 23:53 ` [PATCH 1/5] trace: do not disable wake up tracer on output of trace Steven Rostedt
2009-01-22 8:41 ` Ingo Molnar
2009-01-22 9:29 ` Ingo Molnar
2009-01-22 12:02 ` Steven Rostedt
2009-01-22 12:03 ` Ingo Molnar
2009-01-21 23:53 ` Steven Rostedt [this message]
2009-01-21 23:53 ` [PATCH 3/5] trace: separate out rt tasks from wakeup tracer Steven Rostedt
2009-01-21 23:53 ` [PATCH 4/5] wakeup-tracer: show scheduling data in output Steven Rostedt
2009-01-21 23:53 ` [PATCH 5/5] ring-buffer: reset timestamps when ring buffer is reset Steven Rostedt
2009-01-22 9:32 ` [PATCH 0/5] ftrace: updates for tip Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090121235805.992357373@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=srostedt@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox