linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [for-linus][PATCH 0/3] tracing: Some minor clean ups and fixes for 5.14
@ 2021-07-09 13:09 Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 1/3] tracing/histograms: Fix parsing of "sym-offset" modifier Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-07-09 13:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton


Baokun Li (1):
      ftrace: Use list_move instead of list_del/list_add

Steven Rostedt (VMware) (2):
      tracing/histograms: Fix parsing of "sym-offset" modifier
      tracing/selftests: Add tests to test histogram sym and sym-offset modifiers

----
 kernel/trace/ftrace.c                                  |  3 +--
 kernel/trace/trace_events_hist.c                       |  7 +++++++
 .../selftests/ftrace/test.d/trigger/trigger-hist.tc    | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

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

* [for-linus][PATCH 1/3] tracing/histograms: Fix parsing of "sym-offset" modifier
  2021-07-09 13:09 [for-linus][PATCH 0/3] tracing: Some minor clean ups and fixes for 5.14 Steven Rostedt
@ 2021-07-09 13:09 ` Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 2/3] tracing/selftests: Add tests to test histogram sym and sym-offset modifiers Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 3/3] ftrace: Use list_move instead of list_del/list_add Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-07-09 13:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Masami Hiramatsu, Namhyung Kim,
	Daniel Bristot de Oliveira, stable, Tom Zanussi

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

With the addition of simple mathematical operations (plus and minus), the
parsing of the "sym-offset" modifier broke, as it took the '-' part of the
"sym-offset" as a minus, and tried to break it up into a mathematical
operation of "field.sym - offset", in which case it failed to parse
(unless the event had a field called "offset").

Both .sym and .sym-offset modifiers should not be entered into
mathematical calculations anyway. If ".sym-offset" is found in the
modifier, then simply make it not an operation that can be calculated on.

Link: https://lkml.kernel.org/r/20210707110821.188ae255@oasis.local.home

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 100719dcef447 ("tracing: Add simple expression support to hist triggers")
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_hist.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index ba03b7d84fc2..0207aeed31e6 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1555,6 +1555,13 @@ static int contains_operator(char *str)
 
 	switch (*op) {
 	case '-':
+		/*
+		 * Unfortunately, the modifier ".sym-offset"
+		 * can confuse things.
+		 */
+		if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11))
+			return FIELD_OP_NONE;
+
 		if (*str == '-')
 			field_op = FIELD_OP_UNARY_MINUS;
 		else
-- 
2.30.2

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

* [for-linus][PATCH 2/3] tracing/selftests: Add tests to test histogram sym and sym-offset modifiers
  2021-07-09 13:09 [for-linus][PATCH 0/3] tracing: Some minor clean ups and fixes for 5.14 Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 1/3] tracing/histograms: Fix parsing of "sym-offset" modifier Steven Rostedt
@ 2021-07-09 13:09 ` Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 3/3] ftrace: Use list_move instead of list_del/list_add Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-07-09 13:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Tom Zanussi, Masami Hiramatsu

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

Add a test to the tracing selftests that will catch if the .sym or
.sym-offset modifiers break in the future.

Link: https://lkml.kernel.org/r/20210707121451.101a1002@oasis.local.home

Acked-by: Tom Zanussi <zanussi@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 .../ftrace/test.d/trigger/trigger-hist.tc      | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
index 2950bfbc6fce..adae72665500 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
@@ -39,6 +39,24 @@ grep "parent_comm: $COMM" events/sched/sched_process_fork/hist > /dev/null || \
 
 reset_trigger
 
+echo "Test histogram with sym modifier"
+
+echo 'hist:keys=call_site.sym' > events/kmem/kmalloc/trigger
+for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
+grep '{ call_site: \[[0-9a-f][0-9a-f]*\] [_a-zA-Z][_a-zA-Z]* *}' events/kmem/kmalloc/hist > /dev/null || \
+    fail "sym modifier on kmalloc call_site did not work"
+
+reset_trigger
+
+echo "Test histogram with sym-offset modifier"
+
+echo 'hist:keys=call_site.sym-offset' > events/kmem/kmalloc/trigger
+for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
+grep '{ call_site: \[[0-9a-f][0-9a-f]*\] [_a-zA-Z][_a-zA-Z]*+0x[0-9a-f][0-9a-f]*' events/kmem/kmalloc/hist > /dev/null || \
+    fail "sym-offset modifier on kmalloc call_site did not work"
+
+reset_trigger
+
 echo "Test histogram with sort key"
 
 echo 'hist:keys=parent_pid,child_pid:sort=child_pid.ascending' > events/sched/sched_process_fork/trigger
-- 
2.30.2

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

* [for-linus][PATCH 3/3] ftrace: Use list_move instead of list_del/list_add
  2021-07-09 13:09 [for-linus][PATCH 0/3] tracing: Some minor clean ups and fixes for 5.14 Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 1/3] tracing/histograms: Fix parsing of "sym-offset" modifier Steven Rostedt
  2021-07-09 13:09 ` [for-linus][PATCH 2/3] tracing/selftests: Add tests to test histogram sym and sym-offset modifiers Steven Rostedt
@ 2021-07-09 13:09 ` Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-07-09 13:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Hulk Robot, Baokun Li

From: Baokun Li <libaokun1@huawei.com>

Using list_move() instead of list_del() + list_add().

Link: https://lkml.kernel.org/r/20210608031108.2820996-1-libaokun1@huawei.com

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 72ef4dccbcc4..e6fb3e6e1ffc 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4212,8 +4212,7 @@ static void process_mod_list(struct list_head *head, struct ftrace_ops *ops,
 		if (!func) /* warn? */
 			continue;
 
-		list_del(&ftrace_mod->list);
-		list_add(&ftrace_mod->list, &process_mods);
+		list_move(&ftrace_mod->list, &process_mods);
 
 		/* Use the newly allocated func, as it may be "*" */
 		kfree(ftrace_mod->func);
-- 
2.30.2

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

end of thread, other threads:[~2021-07-09 13:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 13:09 [for-linus][PATCH 0/3] tracing: Some minor clean ups and fixes for 5.14 Steven Rostedt
2021-07-09 13:09 ` [for-linus][PATCH 1/3] tracing/histograms: Fix parsing of "sym-offset" modifier Steven Rostedt
2021-07-09 13:09 ` [for-linus][PATCH 2/3] tracing/selftests: Add tests to test histogram sym and sym-offset modifiers Steven Rostedt
2021-07-09 13:09 ` [for-linus][PATCH 3/3] ftrace: Use list_move instead of list_del/list_add Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).