* [PATCH 1/3] tracing: Add a resize function to make one buffer equivalent to another buffer
2012-11-29 1:23 [PATCH 0/3] [GIT PULL] tracing: Some more updates Steven Rostedt
@ 2012-11-29 1:23 ` Steven Rostedt
2012-11-29 1:23 ` [PATCH 2/3] tracing: Remove unneeded checks from the stack tracer Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2012-11-29 1:23 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Hiraku Toyooka
[-- Attachment #1: Type: text/plain, Size: 3357 bytes --]
From: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Trace buffer size is now per-cpu, so that there are the following two
patterns in resizing of buffers.
(1) resize per-cpu buffers to same given size
(2) resize per-cpu buffers to another trace_array's buffer size
for each CPU (such as preparing the max_tr which is equivalent
to the global_trace's size)
__tracing_resize_ring_buffer() can be used for (1), and had
implemented (2) inside it for resetting the global_trace to the
original size.
(2) was also implemented in another place. So this patch assembles
them in a new function - resize_buffer_duplicate_size().
Link: http://lkml.kernel.org/r/20121017025616.2627.91226.stgit@falsita
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.c | 58 +++++++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 27 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index b69cc38..64ad9bc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3034,6 +3034,31 @@ static void set_buffer_entries(struct trace_array *tr, unsigned long val)
tr->data[cpu]->entries = val;
}
+/* resize @tr's buffer to the size of @size_tr's entries */
+static int resize_buffer_duplicate_size(struct trace_array *tr,
+ struct trace_array *size_tr, int cpu_id)
+{
+ int cpu, ret = 0;
+
+ if (cpu_id == RING_BUFFER_ALL_CPUS) {
+ for_each_tracing_cpu(cpu) {
+ ret = ring_buffer_resize(tr->buffer,
+ size_tr->data[cpu]->entries, cpu);
+ if (ret < 0)
+ break;
+ tr->data[cpu]->entries = size_tr->data[cpu]->entries;
+ }
+ } else {
+ ret = ring_buffer_resize(tr->buffer,
+ size_tr->data[cpu_id]->entries, cpu_id);
+ if (ret == 0)
+ tr->data[cpu_id]->entries =
+ size_tr->data[cpu_id]->entries;
+ }
+
+ return ret;
+}
+
static int __tracing_resize_ring_buffer(unsigned long size, int cpu)
{
int ret;
@@ -3058,23 +3083,8 @@ static int __tracing_resize_ring_buffer(unsigned long size, int cpu)
ret = ring_buffer_resize(max_tr.buffer, size, cpu);
if (ret < 0) {
- int r = 0;
-
- if (cpu == RING_BUFFER_ALL_CPUS) {
- int i;
- for_each_tracing_cpu(i) {
- r = ring_buffer_resize(global_trace.buffer,
- global_trace.data[i]->entries,
- i);
- if (r < 0)
- break;
- }
- } else {
- r = ring_buffer_resize(global_trace.buffer,
- global_trace.data[cpu]->entries,
- cpu);
- }
-
+ int r = resize_buffer_duplicate_size(&global_trace,
+ &global_trace, cpu);
if (r < 0) {
/*
* AARGH! We are left with different
@@ -3212,17 +3222,11 @@ static int tracing_set_tracer(const char *buf)
topts = create_trace_option_files(t);
if (t->use_max_tr) {
- int cpu;
/* we need to make per cpu buffer sizes equivalent */
- for_each_tracing_cpu(cpu) {
- ret = ring_buffer_resize(max_tr.buffer,
- global_trace.data[cpu]->entries,
- cpu);
- if (ret < 0)
- goto out;
- max_tr.data[cpu]->entries =
- global_trace.data[cpu]->entries;
- }
+ ret = resize_buffer_duplicate_size(&max_tr, &global_trace,
+ RING_BUFFER_ALL_CPUS);
+ if (ret < 0)
+ goto out;
}
if (t->init) {
--
1.7.10.4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] tracing: Remove unneeded checks from the stack tracer
2012-11-29 1:23 [PATCH 0/3] [GIT PULL] tracing: Some more updates Steven Rostedt
2012-11-29 1:23 ` [PATCH 1/3] tracing: Add a resize function to make one buffer equivalent to another buffer Steven Rostedt
@ 2012-11-29 1:23 ` Steven Rostedt
2012-11-29 1:23 ` [PATCH 3/3] tracing: Remove unnecessary WARN_ONCEs from tracing_buffers_splice_read Steven Rostedt
2012-12-14 1:17 ` [PATCH 0/3] [GIT PULL] tracing: Some more updates Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2012-11-29 1:23 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Anton Vorontsov
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
From: Anton Vorontsov <anton.vorontsov@linaro.org>
It seems that 'ftrace_enabled' flag should not be used inside the tracer
functions. The ftrace core is using this flag for internal purposes, and
the flag wasn't meant to be used in tracers' runtime checks.
stack tracer is the only tracer that abusing the flag. So stop it from
serving as a bad example.
Also, there is a local 'stack_trace_disabled' flag in the stack tracer,
which is never updated; so it can be removed as well.
Link: http://lkml.kernel.org/r/1342637761-9655-1-git-send-email-anton.vorontsov@linaro.org
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_stack.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 0c1b1657..42ca822 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -33,7 +33,6 @@ static unsigned long max_stack_size;
static arch_spinlock_t max_stack_lock =
(arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
-static int stack_trace_disabled __read_mostly;
static DEFINE_PER_CPU(int, trace_active);
static DEFINE_MUTEX(stack_sysctl_mutex);
@@ -116,9 +115,6 @@ stack_trace_call(unsigned long ip, unsigned long parent_ip,
{
int cpu;
- if (unlikely(!ftrace_enabled || stack_trace_disabled))
- return;
-
preempt_disable_notrace();
cpu = raw_smp_processor_id();
--
1.7.10.4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 3/3] tracing: Remove unnecessary WARN_ONCEs from tracing_buffers_splice_read
2012-11-29 1:23 [PATCH 0/3] [GIT PULL] tracing: Some more updates Steven Rostedt
2012-11-29 1:23 ` [PATCH 1/3] tracing: Add a resize function to make one buffer equivalent to another buffer Steven Rostedt
2012-11-29 1:23 ` [PATCH 2/3] tracing: Remove unneeded checks from the stack tracer Steven Rostedt
@ 2012-11-29 1:23 ` Steven Rostedt
2012-12-14 1:17 ` [PATCH 0/3] [GIT PULL] tracing: Some more updates Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2012-11-29 1:23 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Dave Jones
[-- Attachment #1: Type: text/plain, Size: 932 bytes --]
From: Dave Jones <davej@redhat.com>
WARN shouldn't be used as a means of communicating failure to a userspace programmer.
Link: http://lkml.kernel.org/r/20120725153908.GA25203@redhat.com
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 64ad9bc..5bc3590 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4275,13 +4275,11 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
return -ENOMEM;
if (*ppos & (PAGE_SIZE - 1)) {
- WARN_ONCE(1, "Ftrace: previous read must page-align\n");
ret = -EINVAL;
goto out;
}
if (len & (PAGE_SIZE - 1)) {
- WARN_ONCE(1, "Ftrace: splice_read should page-align\n");
if (len < PAGE_SIZE) {
ret = -EINVAL;
goto out;
--
1.7.10.4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] [GIT PULL] tracing: Some more updates
2012-11-29 1:23 [PATCH 0/3] [GIT PULL] tracing: Some more updates Steven Rostedt
` (2 preceding siblings ...)
2012-11-29 1:23 ` [PATCH 3/3] tracing: Remove unnecessary WARN_ONCEs from tracing_buffers_splice_read Steven Rostedt
@ 2012-12-14 1:17 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2012-12-14 1:17 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker
On Wed, 2012-11-28 at 20:23 -0500, Steven Rostedt wrote:
> Ingo,
>
> This is based off of my last pull request on tip/perf/core.
>
> Please pull the latest tip/perf/core-2 tree, which can be found at:
Ping?
This has been in linux-next for a few weeks too. It's all ready to go in
this merge window.
-- Steve
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
> tip/perf/core-2
>
> Head SHA1: bf3071f5a054db9e5bab873355d27a7330ce5187
>
>
> Anton Vorontsov (1):
> tracing: Remove unneeded checks from the stack tracer
>
> Dave Jones (1):
> tracing: Remove unnecessary WARN_ONCE's from tracing_buffers_splice_read
>
> Hiraku Toyooka (1):
> tracing: Add a resize function to make one buffer equivalent to another buffer
>
> ----
> kernel/trace/trace.c | 60 +++++++++++++++++++++++---------------------
> kernel/trace/trace_stack.c | 4 ---
> 2 files changed, 31 insertions(+), 33 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread