mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [for-next][PATCH 0/8] tracing: Last minute updates for 4.6
@ 2016-03-19 14:15 Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 1/8] ftrace: Make ftrace_hash_rec_enable return update bool Steven Rostedt
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

  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(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 1/8] ftrace: Make ftrace_hash_rec_enable return update bool
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary Steven Rostedt
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Namhyung Kim, Jiri Olsa

[-- Attachment #1: 0001-ftrace-Make-ftrace_hash_rec_enable-return-update-boo.patch --]
[-- Type: text/plain, Size: 3119 bytes --]

From: Jiri Olsa <jolsa@kernel.org>

Change __ftrace_hash_rec_update to return true in case
we need to update dynamic ftrace call records. It return
false in case no update is needed.

Link: http://lkml.kernel.org/r/1458138873-1553-5-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 | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 57a6eea84694..11ffcfd3804e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1610,7 +1610,7 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec)
 	return  keep_regs;
 }
 
-static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
+static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
 				     int filter_hash,
 				     bool inc)
 {
@@ -1618,12 +1618,13 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 	struct ftrace_hash *other_hash;
 	struct ftrace_page *pg;
 	struct dyn_ftrace *rec;
+	bool update = false;
 	int count = 0;
 	int all = 0;
 
 	/* Only update if the ops has been registered */
 	if (!(ops->flags & FTRACE_OPS_FL_ENABLED))
-		return;
+		return false;
 
 	/*
 	 * In the filter_hash case:
@@ -1650,7 +1651,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 		 * then there's nothing to do.
 		 */
 		if (ftrace_hash_empty(hash))
-			return;
+			return false;
 	}
 
 	do_for_each_ftrace_rec(pg, rec) {
@@ -1694,7 +1695,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 		if (inc) {
 			rec->flags++;
 			if (FTRACE_WARN_ON(ftrace_rec_count(rec) == FTRACE_REF_MAX))
-				return;
+				return false;
 
 			/*
 			 * If there's only a single callback registered to a
@@ -1720,7 +1721,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 				rec->flags |= FTRACE_FL_REGS;
 		} else {
 			if (FTRACE_WARN_ON(ftrace_rec_count(rec) == 0))
-				return;
+				return false;
 			rec->flags--;
 
 			/*
@@ -1753,22 +1754,28 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
 			 */
 		}
 		count++;
+
+		/* Must match FTRACE_UPDATE_CALLS in ftrace_modify_all_code() */
+		update |= ftrace_test_record(rec, 1) != FTRACE_UPDATE_IGNORE;
+
 		/* Shortcut, if we handled all records, we are done. */
 		if (!all && count == hash->count)
-			return;
+			return update;
 	} while_for_each_ftrace_rec();
+
+	return update;
 }
 
-static void ftrace_hash_rec_disable(struct ftrace_ops *ops,
+static bool ftrace_hash_rec_disable(struct ftrace_ops *ops,
 				    int filter_hash)
 {
-	__ftrace_hash_rec_update(ops, filter_hash, 0);
+	return __ftrace_hash_rec_update(ops, filter_hash, 0);
 }
 
-static void ftrace_hash_rec_enable(struct ftrace_ops *ops,
+static bool ftrace_hash_rec_enable(struct ftrace_ops *ops,
 				   int filter_hash)
 {
-	__ftrace_hash_rec_update(ops, filter_hash, 1);
+	return __ftrace_hash_rec_update(ops, filter_hash, 1);
 }
 
 static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,
-- 
2.7.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 1/8] ftrace: Make ftrace_hash_rec_enable return update bool Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs() Steven Rostedt
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Namhyung Kim, Jiri Olsa

[-- Attachment #1: 0002-ftrace-Update-dynamic-ftrace-calls-only-if-necessary.patch --]
[-- Type: text/plain, Size: 3490 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs()
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 1/8] ftrace: Make ftrace_hash_rec_enable return update bool Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 4/8] tracing: Fix return while holding a lock in register_tracer() Steven Rostedt
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Namhyung Kim, Geliang Tang

[-- Attachment #1: 0003-ftrace-Use-kasprintf-in-ftrace_profile_tracefs.patch --]
[-- Type: text/plain, Size: 1262 bytes --]

From: Geliang Tang <geliangtang@163.com>

Use kasprintf() instead of kmalloc() and snprintf().

Link: http://lkml.kernel.org/r/135a7bc36e51fd9eaa57124dd2140285b771f738.1458050835.git.geliangtang@163.com

Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d3850cbb840f..6a93faafbea4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1030,8 +1030,7 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
 	for_each_possible_cpu(cpu) {
 		stat = &per_cpu(ftrace_profile_stats, cpu);
 
-		/* allocate enough for function name + cpu number */
-		name = kmalloc(32, GFP_KERNEL);
+		name = kasprintf(GFP_KERNEL, "function%d", cpu);
 		if (!name) {
 			/*
 			 * The files created are permanent, if something happens
@@ -1043,7 +1042,6 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
 			return;
 		}
 		stat->stat = function_stats;
-		snprintf(name, 32, "function%d", cpu);
 		stat->stat.name = name;
 		ret = register_stat_tracer(&stat->stat);
 		if (ret) {
-- 
2.7.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 4/8] tracing: Fix return while holding a lock in register_tracer()
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
                   ` (2 preceding siblings ...)
  2016-03-19 14:15 ` [for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs() Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 5/8] tracing: Have preempt(irqs)off trace preempt disabled functions Steven Rostedt
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Dan Carpenter, Chunyu Hu

[-- Attachment #1: 0004-tracing-Fix-return-while-holding-a-lock-in-register_.patch --]
[-- Type: text/plain, Size: 1249 bytes --]

From: Chunyu Hu <chuhu@redhat.com>

commit d39cdd2036a6 ("tracing: Make tracer_flags use the right set_flag
callback")  introduces a potential mutex deadlock issue, as it forgets to
free the mutex when allocaing the tracer_flags gets fail.

The issue was found by Dan Carpenter through Smatch static code check tool.

Link: http://lkml.kernel.org/r/1457958941-30265-1-git-send-email-chuhu@redhat.com

Fixes: d39cdd2036a6 ("tracing: Make tracer_flags use the right set_flag callback")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index b401a1892dc6..0ae46048f724 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1256,8 +1256,10 @@ int __init register_tracer(struct tracer *type)
 	if (!type->flags) {
 		/*allocate a dummy tracer_flags*/
 		type->flags = kmalloc(sizeof(*type->flags), GFP_KERNEL);
-		if (!type->flags)
-			return -ENOMEM;
+		if (!type->flags) {
+			ret = -ENOMEM;
+			goto out;
+		}
 		type->flags->val = 0;
 		type->flags->opts = dummy_tracer_opt;
 	} else
-- 
2.7.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 5/8] tracing: Have preempt(irqs)off trace preempt disabled functions
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
                   ` (3 preceding siblings ...)
  2016-03-19 14:15 ` [for-next][PATCH 4/8] tracing: Fix return while holding a lock in register_tracer() Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 6/8] tracing: Fix crash from reading trace_pipe with sendfile Steven Rostedt
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, stable, Joel Fernandes

[-- Attachment #1: 0005-tracing-Have-preempt-irqs-off-trace-preempt-disabled.patch --]
[-- Type: text/plain, Size: 3093 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Joel Fernandes reported that the function tracing of preempt disabled
sections was not being reported when running either the preemptirqsoff or
preemptoff tracers. This was due to the fact that the function tracer
callback for those tracers checked if irqs were disabled before tracing. But
this fails when we want to trace preempt off locations as well.

Joel explained that he wanted to see funcitons where interrupts are enabled
but preemption was disabled. The expected output he wanted:

   <...>-2265    1d.h1 3419us : preempt_count_sub <-irq_exit
   <...>-2265    1d..1 3419us : __do_softirq <-irq_exit
   <...>-2265    1d..1 3419us : msecs_to_jiffies <-__do_softirq
   <...>-2265    1d..1 3420us : irqtime_account_irq <-__do_softirq
   <...>-2265    1d..1 3420us : __local_bh_disable_ip <-__do_softirq
   <...>-2265    1..s1 3421us : run_timer_softirq <-__do_softirq
   <...>-2265    1..s1 3421us : hrtimer_run_pending <-run_timer_softirq
   <...>-2265    1..s1 3421us : _raw_spin_lock_irq <-run_timer_softirq
   <...>-2265    1d.s1 3422us : preempt_count_add <-_raw_spin_lock_irq
   <...>-2265    1d.s2 3422us : _raw_spin_unlock_irq <-run_timer_softirq
   <...>-2265    1..s2 3422us : preempt_count_sub <-_raw_spin_unlock_irq
   <...>-2265    1..s1 3423us : rcu_bh_qs <-__do_softirq
   <...>-2265    1d.s1 3423us : irqtime_account_irq <-__do_softirq
   <...>-2265    1d.s1 3423us : __local_bh_enable <-__do_softirq

There's a comment saying that the irq disabled check is because there's a
possible race that tracing_cpu may be set when the function is executed. But
I don't remember that race. For now, I added a check for preemption being
enabled too to not record the function, as there would be no race if that
was the case. I need to re-investigate this, as I'm now thinking that the
tracing_cpu will always be correct. But no harm in keeping the check for
now, except for the slight performance hit.

Link: http://lkml.kernel.org/r/1457770386-88717-1-git-send-email-agnel.joel@gmail.com

Fixes: 5e6d2b9cfa3a "tracing: Use one prologue for the preempt irqs off tracer function tracers"
Cc: stable@vget.kernel.org # 2.6.37+
Reported-by: Joel Fernandes <agnel.joel@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_irqsoff.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index e4e56589ec1d..be3222b7d72e 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -109,8 +109,12 @@ static int func_prolog_dec(struct trace_array *tr,
 		return 0;
 
 	local_save_flags(*flags);
-	/* slight chance to get a false positive on tracing_cpu */
-	if (!irqs_disabled_flags(*flags))
+	/*
+	 * Slight chance to get a false positive on tracing_cpu,
+	 * although I'm starting to think there isn't a chance.
+	 * Leave this for now just to be paranoid.
+	 */
+	if (!irqs_disabled_flags(*flags) && !preempt_count())
 		return 0;
 
 	*data = per_cpu_ptr(tr->trace_buffer.data, cpu);
-- 
2.7.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 6/8] tracing: Fix crash from reading trace_pipe with sendfile
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
                   ` (4 preceding siblings ...)
  2016-03-19 14:15 ` [for-next][PATCH 5/8] tracing: Have preempt(irqs)off trace preempt disabled functions Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer Steven Rostedt
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, stable, Rabin Vincent

[-- Attachment #1: 0006-tracing-Fix-crash-from-reading-trace_pipe-with-sendf.patch --]
[-- Type: text/plain, Size: 1069 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

If tracing contains data and the trace_pipe file is read with sendfile(),
then it can trigger a NULL pointer dereference and various BUG_ON within the
VM code.

There's a patch to fix this in the splice_to_pipe() code, but it's also a
good idea to not let that happen from trace_pipe either.

Link: http://lkml.kernel.org/r/1457641146-9068-1-git-send-email-rabin@rab.in

Cc: stable@vger.kernel.org # 2.6.30+
Reported-by: Rabin Vincent <rabin.vincent@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0ae46048f724..cb2b708e4ea7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4954,7 +4954,10 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
 
 	spd.nr_pages = i;
 
-	ret = splice_to_pipe(pipe, &spd);
+	if (i)
+		ret = splice_to_pipe(pipe, &spd);
+	else
+		ret = 0;
 out:
 	splice_shrink_spd(&spd);
 	return ret;
-- 
2.7.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
                   ` (5 preceding siblings ...)
  2016-03-19 14:15 ` [for-next][PATCH 6/8] tracing: Fix crash from reading trace_pipe with sendfile Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  2016-03-19 14:15 ` [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer Steven Rostedt
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Li Bin

[-- Attachment #1: 0007-x86-ftrace-Fix-the-misleading-comment-for-arch-x86-k.patch --]
[-- Type: text/plain, Size: 675 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer
  2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
                   ` (6 preceding siblings ...)
  2016-03-19 14:15 ` [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c Steven Rostedt
@ 2016-03-19 14:15 ` Steven Rostedt
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2016-03-19 14:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Dmitry Safonov

[-- Attachment #1: 0008-tracing-Remove-redundant-reset-per-CPU-buff-in-irqso.patch --]
[-- Type: text/plain, Size: 1128 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-19 14:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 1/8] ftrace: Make ftrace_hash_rec_enable return update bool Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs() Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 4/8] tracing: Fix return while holding a lock in register_tracer() Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 5/8] tracing: Have preempt(irqs)off trace preempt disabled functions Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 6/8] tracing: Fix crash from reading trace_pipe with sendfile Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®