tracing: Fix synthetic event parser
Subsystems (3)
Masami Hiramatsu
maintainercover tracing: Fix synthetic event parser
Hi,
I found another bug in synthetic event. This is a small fix, but confusingly, there is also a bug in a test case.
Steve, since the testcase bugfix ([2/2]) breaks the test result unless corresponding fix ([1/2]), I would like to ask you to send these fixes from your tree.
Shuah, could you give this your ack?
Thank you,
---
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 +++- .../trigger-synthetic-event-createremove.tc | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-)
--
Masami Hiramatsu (Linaro) <[email protected]>
Masami Hiramatsu
maintainerPATCH 1/2 tracing: Return -ENOENT if there is no target synthetic event
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
--- kernel/trace/trace_events_hist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +3 -1
@@ -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 ;
Masami Hiramatsu
maintainerPATCH 2/2 selftests/ftrace: Fix synthetic event test to delete event correctly
In reply to Masami HiramatsuFix 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 ('>').
--- .../trigger-synthetic-event-createremove.tc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc +6 -6
@@ -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
Hi Masami,
Quoted 10 lines · Masami Hiramatsu
Hi,
I found another bug in synthetic event. This is a small fix, but confusingly, there is also a bug in a test case.
Steve, since the testcase bugfix ([2/2]) breaks the test result unless corresponding fix ([1/2]), I would like to ask you to send these fixes from your tree.
Shuah, could you give this your ack?
Yes, I think the silent failing mode is confusing to users, and so these changes make more sense.
Thanks,
Tom
Quoted 17 lines
Thank you,
---
Masami Hiramatsu (2):
tracing: Return-ENOENTif there is no target synthetic event selftests/ftrace: Fix synthetic event test to delete event
correctlykernel/trace/trace_events_hist.c | 4 +++- .../trigger-synthetic-event-createremove.tc | 12 ++++++-- ---- 2 files changed, 9 insertions(+), 7 deletions(-)--
Masami Hiramatsu (Linaro) <[email protected]>
Steven Rostedt
maintainerQuoted 8 lines · On Mon, 22 Oct 2018 00:07:50 +0900 Masami Hiramatsu <[email protected]> wrote:
Hi,
I found another bug in synthetic event. This is a small fix, but confusingly, there is also a bug in a test case.
Steve, since the testcase bugfix ([2/2]) breaks the test result unless corresponding fix ([1/2]), I would like to ask you to send these fixes from your tree.
Hi Masami,
I'm currently in travel mode, but I'm letting you know that I'll be working on these today. It might take a bit to get out.
I'll add them on top of my linux-next code, and include them in the pull request I'm hoping to do on Tuesday.
-- Steve
Steven Rostedt
maintainerQuoted 2 lines · On Sun, 28 Oct 2018 04:01:35 -0400 Steven Rostedt <[email protected]> wrote:
I'll add them on top of my linux-next code, and include them in the pull request I'm hoping to do on Tuesday.
Bah, I think this is on a different branch, and that will make it go as a separate pull. Anyway, it probably will still be on Tuesday where I push it to Linus.
-- Steve
Quoted 12 lines · Steven Rostedt
Quoted 2 lines · On Sun, 28 Oct 2018 04:01:35 -0400 Steven Rostedt <[email protected]> wrote:
I'll add them on top of my linux-next code, and include them in the pull request I'm hoping to do on Tuesday.
Bah, I think this is on a different branch, and that will make it go as a separate pull. Anyway, it probably will still be on Tuesday where I push it to Linus.
-- Steve
Here it is
thanks,
-- Shuah
Steven Rostedt
maintainerQuoted 4 lines · On Sun, 28 Oct 2018 12:10:17 -0600 Shuah Khan <[email protected]> wrote:
Here it is
Acked-by Shuah Khan <[email protected]>
Thanks a lot Shuah!
-- Steve
Shuah Khan
maintainerQuoted 14 lines · Steven Rostedt
Quoted 8 lines · On Mon, 22 Oct 2018 00:07:50 +0900 Masami Hiramatsu <[email protected]> wrote:
Hi,
I found another bug in synthetic event. This is a small fix, but confusingly, there is also a bug in a test case.
Steve, since the testcase bugfix ([2/2]) breaks the test result unless corresponding fix ([1/2]), I would like to ask you to send these fixes from your tree.
Hi Masami,
Quoted 8 lines
I'm currently in travel mode, but I'm letting you know that I'll be working on these today. It might take a bit to get out.
I'll add them on top of my linux-next code, and include them in the pull request I'm hoping to do on Tuesday.
-- Steve
Hi Steve,
Are there any dependencies on my pull request I sent to Linus? It hasn't been pulled in yet. If there is one, could please you mention that in your pull request for this.
thanks,
-- Shuah
Steven Rostedt
maintainerQuoted 5 lines · On Sun, 28 Oct 2018 11:33:35 -0600 Shuah Khan <[email protected]> wrote:
Hi Steve,
Are there any dependencies on my pull request I sent to Linus? It hasn't been pulled in yet. If there is one, could please you mention that in your pull request for this.
There's no dependency on the patches you took. But if you could ack the selftest one that would be awesome.
Thanks,
-- Steve