Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1361119 > unrolled thread

[for-next][PATCH 0/8] tracing: Last minute updates for 4.6

Started bySteven Rostedt <rostedt@goodmis.org>
First post2016-03-19 15:20 +0100
Last post2016-03-19 15:20 +0100
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt <rostedt@goodmis.org> - 2016-03-19 15:20 +0100
    [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary Steven Rostedt <rostedt@goodmis.org> - 2016-03-19 15:20 +0100
    [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer Steven Rostedt <rostedt@goodmis.org> - 2016-03-19 15:20 +0100
    [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c Steven Rostedt <rostedt@goodmis.org> - 2016-03-19 15:20 +0100

#1361119 — [for-next][PATCH 0/8] tracing: Last minute updates for 4.6

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-03-19 15:20 +0100
Subject[for-next][PATCH 0/8] tracing: Last minute updates for 4.6
Message-ID<repTr-VC-5@gated-at.bofh.it>
  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 741f3a69f101250dc6b171b88e14ea51b099b1a9


Chunyu Hu (1):
      tracing: Fix return while holding a lock in register_tracer()

Dmitry Safonov (1):
      tracing: Remove redundant reset per-CPU buff in irqsoff tracer

Geliang Tang (1):
      ftrace: Use kasprintf() in ftrace_profile_tracefs()

Jiri Olsa (2):
      ftrace: Make ftrace_hash_rec_enable return update bool
      ftrace: Update dynamic ftrace calls only if necessary

Li Bin (1):
      x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c

Steven Rostedt (Red Hat) (2):
      tracing: Have preempt(irqs)off trace preempt disabled functions
      tracing: Fix crash from reading trace_pipe with sendfile

----
 arch/x86/kernel/ftrace.c     |  2 +-
 kernel/trace/ftrace.c        | 41 +++++++++++++++++++++++------------------
 kernel/trace/trace.c         | 11 ++++++++---
 kernel/trace/trace_irqsoff.c |  9 ++++++---
 4 files changed, 38 insertions(+), 25 deletions(-)

[toc] | [next] | [standalone]


#1361120 — [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-03-19 15:20 +0100
Subject[for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary
Message-ID<repTs-VC-25@gated-at.bofh.it>
In reply to#1361119
From: Jiri Olsa <jolsa@kernel.org>

Currently dynamic ftrace calls are updated any time
the ftrace_ops is un/registered. If we do  this update
only when it's needed, we save lot of time for perf
system wide ftrace function sampling/counting.

The reason is that for system wide sampling/counting,
perf creates event for each cpu in the system.

Each event then registers separate copy of ftrace_ops,
which ends up in FTRACE_UPDATE_CALLS updates. On servers
with many cpus that means serious stall (240 cpus server):

Counting:
  # time ./perf stat -e ftrace:function -a sleep 1

   Performance counter stats for 'system wide':

              370,663      ftrace:function

          1.401427505 seconds time elapsed

  real    3m51.743s
  user    0m0.023s
  sys     3m48.569s

Sampling:
  # time ./perf record -e ftrace:function -a sleep 1
  [ perf record: Woken up 0 times to write data ]
  Warning:
  Processed 141200 events and lost 5 chunks!

  [ perf record: Captured and wrote 10.703 MB perf.data (135950 samples) ]

  real    2m31.429s
  user    0m0.213s
  sys     2m29.494s

There's no reason to do the FTRACE_UPDATE_CALLS update
for each event in perf case, because all the ftrace_ops
always share the same filter, so the updated calls are
always the same.

It's required that only first ftrace_ops registration
does the FTRACE_UPDATE_CALLS update (also sometimes
the second if the first one used the trampoline), but
the rest can be only cheaply linked into the ftrace_ops
list.

Counting:
  # time ./perf stat -e ftrace:function -a sleep 1

   Performance counter stats for 'system wide':

             398,571      ftrace:function

         1.377503733 seconds time elapsed

  real    0m2.787s
  user    0m0.005s
  sys     0m1.883s

Sampling:
  # time ./perf record -e ftrace:function -a sleep 1
  [ perf record: Woken up 0 times to write data ]
  Warning:
  Processed 261730 events and lost 9 chunks!

  [ perf record: Captured and wrote 19.907 MB perf.data (256293 samples) ]

  real    1m31.948s
  user    0m0.309s
  sys     1m32.051s

Link: http://lkml.kernel.org/r/1458138873-1553-6-git-send-email-jolsa@kernel.org

Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 11ffcfd3804e..d3850cbb840f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2651,7 +2651,6 @@ static int ftrace_startup(struct ftrace_ops *ops, int command)
 		return ret;
 
 	ftrace_start_up++;
-	command |= FTRACE_UPDATE_CALLS;
 
 	/*
 	 * Note that ftrace probes uses this to start up
@@ -2672,7 +2671,8 @@ static int ftrace_startup(struct ftrace_ops *ops, int command)
 		return ret;
 	}
 
-	ftrace_hash_rec_enable(ops, 1);
+	if (ftrace_hash_rec_enable(ops, 1))
+		command |= FTRACE_UPDATE_CALLS;
 
 	ftrace_startup_enable(command);
 
@@ -2702,11 +2702,11 @@ static int ftrace_shutdown(struct ftrace_ops *ops, int command)
 
 	/* Disabling ipmodify never fails */
 	ftrace_hash_ipmodify_disable(ops);
-	ftrace_hash_rec_disable(ops, 1);
 
-	ops->flags &= ~FTRACE_OPS_FL_ENABLED;
+	if (ftrace_hash_rec_disable(ops, 1))
+		command |= FTRACE_UPDATE_CALLS;
 
-	command |= FTRACE_UPDATE_CALLS;
+	ops->flags &= ~FTRACE_OPS_FL_ENABLED;
 
 	if (saved_ftrace_func != ftrace_trace_function) {
 		saved_ftrace_func = ftrace_trace_function;
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1361121 — [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-03-19 15:20 +0100
Subject[for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer
Message-ID<repTs-VC-21@gated-at.bofh.it>
In reply to#1361119
From: Dmitry Safonov <0x7f454c46@gmail.com>

  There is no reason to do it twice: from commit b6f11df26fdc28
("trace: Call tracing_reset_online_cpus before tracer->init()")
resetting of per-CPU buffers done before tracer->init() call.

tracer->init() calls {irqs,preempt,preemptirqs}off_tracer_init() and it
calls __irqsoff_tracer_init(), which resets per-CPU ringbuffer second
time.
It's slowpath, but anyway.

Link: http://lkml.kernel.org/r/1445278226-16187-1-git-send-email-0x7f454c46@gmail.com

Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_irqsoff.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index be3222b7d72e..03cdff84d026 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -626,7 +626,6 @@ static int __irqsoff_tracer_init(struct trace_array *tr)
 	irqsoff_trace = tr;
 	/* make sure that the tracer is visible */
 	smp_wmb();
-	tracing_reset_online_cpus(&tr->trace_buffer);
 
 	ftrace_init_array_ops(tr, irqsoff_tracer_call);
 
-- 
2.7.0

[toc] | [prev] | [next] | [standalone]


#1361122 — [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-03-19 15:20 +0100
Subject[for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c
Message-ID<repTs-VC-27@gated-at.bofh.it>
In reply to#1361119
From: Li Bin <huawei.libin@huawei.com>

Fix the misleading comment for arch/x86/kernel/ftrace.c that it
had used nop instead of jmp.

Signed-off-by: Li Bin <huawei.libin@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 29408d6d6626..1b7d7e4fd7b0 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -1,5 +1,5 @@
 /*
- * Code for replacing ftrace calls with jumps.
+ * Dynamic function tracing support.
  *
  * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
  *
-- 
2.7.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web