All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events
@ 2018-10-30 13:13 Steven Rostedt
  2018-10-30 13:13 ` [PATCH 1/2] tracing: Return -ENOENT if there is no target synthetic event Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Steven Rostedt @ 2018-10-30 13:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Ingo Molnar, Andrew Morton


Linus,

This is not my 4.20 pull request (that will be coming shortly). This
is just some last minute fixes that Masami sent me that I finally got
around to test.

Masami had a couple more fixes to the synthetic events. One was a proper
error return value, and the other is for the self tests.

Please pull the latest trace-v4.19-rc8-3 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v4.19-rc8-3

Tag SHA1: 11638fdbcb30c761886e38a7efb561d6ca11272a
Head SHA1: 0d0352d8b3d6d7ca9a710b40e194cbbaeb841c88


Masami Hiramatsu (2):
      tracing: Return -ENOENT if there is no target synthetic event
      selftests/ftrace: Fix synthetic event test to delete event correctly

----
 kernel/trace/trace_events_hist.c                             |  4 +++-
 .../inter-event/trigger-synthetic-event-createremove.tc      | 12 ++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

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

* [PATCH 1/2] tracing: Return -ENOENT if there is no target synthetic event
  2018-10-30 13:13 [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Steven Rostedt
@ 2018-10-30 13:13 ` Steven Rostedt
  2018-10-30 13:13 ` [PATCH 2/2] selftests/ftrace: Fix synthetic event test to delete event correctly Steven Rostedt
  2018-10-30 16:48 ` [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Linus Torvalds
  2 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2018-10-30 13:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Ingo Molnar, Andrew Morton, Tom Zanussi,
	Shuah Khan, Rajvi Jingar, stable, Masami Hiramatsu

From: Masami Hiramatsu <mhiramat@kernel.org>

Return -ENOENT error if there is no target synthetic event.
This notices an operation failure to user as below;

  # echo 'wakeup_latency u64 lat; pid_t pid;' > synthetic_events
  # echo '!wakeup' >> synthetic_events
  sh: write error: No such file or directory

Link: http://lkml.kernel.org/r/154013449986.25576.9487131386597290172.stgit@devbox

Acked-by: Tom Zanussi <zanussi@linux.intel.com>
Tested-by: Tom Zanussi <zanussi@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Rajvi Jingar <rajvi.jingar@intel.com>
Cc: stable@vger.kernel.org
Fixes: 4b147936fa50 ('tracing: Add support for 'synthetic' events')
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_hist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index d239004aaf29..eb908ef2ecec 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1063,8 +1063,10 @@ static int create_synth_event(int argc, char **argv)
 		event = NULL;
 		ret = -EEXIST;
 		goto out;
-	} else if (delete_event)
+	} else if (delete_event) {
+		ret = -ENOENT;
 		goto out;
+	}
 
 	if (argc < 2) {
 		ret = -EINVAL;
-- 
2.19.0



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

* [PATCH 2/2] selftests/ftrace: Fix synthetic event test to delete event correctly
  2018-10-30 13:13 [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Steven Rostedt
  2018-10-30 13:13 ` [PATCH 1/2] tracing: Return -ENOENT if there is no target synthetic event Steven Rostedt
@ 2018-10-30 13:13 ` Steven Rostedt
  2018-10-30 16:48 ` [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Linus Torvalds
  2 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2018-10-30 13:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Ingo Molnar, Andrew Morton, Shuah Khan,
	Tom Zanussi, Tom Zanussi, Tom Zanussi, Rajvi Jingar, stable,
	Masami Hiramatsu

From: Masami Hiramatsu <mhiramat@kernel.org>

Fix the synthetic event test case to remove event correctly.
If redirecting command to synthetic_event file without append
mode, it cleans up all existing events and execute (parse) the
command. This means "delete event" always fails to find the
target event.

Since previous synthetic event has a bug which doesn't return
-ENOENT even if it fails to find the deleting event, this test
passed. But fixing that bug, this test fails because this test
itself has a bug.

This fixes that bug by trying to delete event right after
adding an event, and use append mode redirection ('>>') instead
of normal redirection ('>').

Link: http://lkml.kernel.org/r/154013452832.25576.2305459545429386517.stgit@devbox

Acked-by: Shuah Khan <shuah@kernel.org>
Acked-by: Tom Zanussi <zanussi@linux.intel.com>
Tested-by: Tom Zanussi <zanussi@linux.intel.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: Rajvi Jingar <rajvi.jingar@intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: stable@vger.kernel.org
Fixes: f06eec4d0f2c ('selftests: ftrace: Add inter-event hist triggers testcases')
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 .../trigger-synthetic-event-createremove.tc          | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
index cef11377dcbd..c604438df13b 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
@@ -35,18 +35,18 @@ fi
 
 reset_trigger
 
-echo "Test create synthetic event with an error"
-echo 'wakeup_latency  u64 lat pid_t pid char' > synthetic_events > /dev/null
+echo "Test remove synthetic event"
+echo '!wakeup_latency  u64 lat pid_t pid char comm[16]' >> synthetic_events
 if [ -d events/synthetic/wakeup_latency ]; then
-    fail "Created wakeup_latency synthetic event with an invalid format"
+    fail "Failed to delete wakeup_latency synthetic event"
 fi
 
 reset_trigger
 
-echo "Test remove synthetic event"
-echo '!wakeup_latency  u64 lat pid_t pid char comm[16]' > synthetic_events
+echo "Test create synthetic event with an error"
+echo 'wakeup_latency  u64 lat pid_t pid char' > synthetic_events > /dev/null
 if [ -d events/synthetic/wakeup_latency ]; then
-    fail "Failed to delete wakeup_latency synthetic event"
+    fail "Created wakeup_latency synthetic event with an invalid format"
 fi
 
 do_reset
-- 
2.19.0



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

* Re: [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events
  2018-10-30 13:13 [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Steven Rostedt
  2018-10-30 13:13 ` [PATCH 1/2] tracing: Return -ENOENT if there is no target synthetic event Steven Rostedt
  2018-10-30 13:13 ` [PATCH 2/2] selftests/ftrace: Fix synthetic event test to delete event correctly Steven Rostedt
@ 2018-10-30 16:48 ` Linus Torvalds
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2018-10-30 16:48 UTC (permalink / raw)
  To: rostedt; +Cc: Linux Kernel Mailing List, Ingo Molnar, Andrew Morton

On Tue, Oct 30, 2018 at 6:15 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> This is not my 4.20 pull request (that will be coming shortly). This
> is just some last minute fixes that Masami sent me that I finally got
> around to test.

Pulled. Real pull request is next,

                  Linus

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

* [PATCH 2/2] selftests/ftrace: Fix synthetic event test to delete event correctly
  2018-10-21 15:07 [PATCH 0/2] tracing: Fix synthetic event parser Masami Hiramatsu
@ 2018-10-21 15:08 ` Masami Hiramatsu
  0 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2018-10-21 15:08 UTC (permalink / raw)
  To: Steven Rostedt, Shuah Khan
  Cc: Rajvi Jingar, Tom Zanussi, Masami Hiramatsu, linux-kernel,
	stable, Tom Zanussi

Fix the synthetic event test case to remove event correctly.
If redirecting command to synthetic_event file without append
mode, it cleans up all existing events and execute (parse) the
command. This means "delete event" always fails to find the
target event.

Since previous synthetic event has a bug which doesn't return
-ENOENT even if it fails to find the deleting event, this test
passed. But fixing that bug, this test fails because this test
itself has a bug.

This fixes that bug by trying to delete event right after
adding an event, and use append mode redirection ('>>') instead
of normal redirection ('>').

Fixes: f06eec4d0f2c ('selftests: ftrace: Add inter-event hist triggers testcases')
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
Cc: Rajvi Jingar <rajvi.jingar@intel.com>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 .../trigger-synthetic-event-createremove.tc        |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
index cef11377dcbd..c604438df13b 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
@@ -35,18 +35,18 @@ fi
 
 reset_trigger
 
-echo "Test create synthetic event with an error"
-echo 'wakeup_latency  u64 lat pid_t pid char' > synthetic_events > /dev/null
+echo "Test remove synthetic event"
+echo '!wakeup_latency  u64 lat pid_t pid char comm[16]' >> synthetic_events
 if [ -d events/synthetic/wakeup_latency ]; then
-    fail "Created wakeup_latency synthetic event with an invalid format"
+    fail "Failed to delete wakeup_latency synthetic event"
 fi
 
 reset_trigger
 
-echo "Test remove synthetic event"
-echo '!wakeup_latency  u64 lat pid_t pid char comm[16]' > synthetic_events
+echo "Test create synthetic event with an error"
+echo 'wakeup_latency  u64 lat pid_t pid char' > synthetic_events > /dev/null
 if [ -d events/synthetic/wakeup_latency ]; then
-    fail "Failed to delete wakeup_latency synthetic event"
+    fail "Created wakeup_latency synthetic event with an invalid format"
 fi
 
 do_reset


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

end of thread, other threads:[~2018-10-30 16:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 13:13 [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Steven Rostedt
2018-10-30 13:13 ` [PATCH 1/2] tracing: Return -ENOENT if there is no target synthetic event Steven Rostedt
2018-10-30 13:13 ` [PATCH 2/2] selftests/ftrace: Fix synthetic event test to delete event correctly Steven Rostedt
2018-10-30 16:48 ` [PATCH 0/2] [GIT PULL] tracing: Fixes to synthetic events Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2018-10-21 15:07 [PATCH 0/2] tracing: Fix synthetic event parser Masami Hiramatsu
2018-10-21 15:08 ` [PATCH 2/2] selftests/ftrace: Fix synthetic event test to delete event correctly Masami Hiramatsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.