* [PATCH 0/2] tracing: Fix config dependency and trigger parser
@ 2020-06-20 3:45 Masami Hiramatsu
2020-06-20 3:45 ` [PATCH 1/2] tracing/boot: Fix config dependency for synthedic event Masami Hiramatsu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2020-06-20 3:45 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Tom Zanussi
Hi,
These are some fixes which I found recentry on ftrace.
- Since the boot-time tracing synthetic event feature is decoupled
from trigger recenty, it should use CONFIG_SYNTH_EVENT.
- The parser of event trigger seems rejecting some redundant
spaces. But it is hard users to find the wrong point. Such
spaces should be accepted.
BTW, I also found the trigger parser accepts some inputs which
may not correctly formatted, e.g.
# echo "traceon 1" > events/ftrace/print/trigger
(from the document, it must be "traceon:1")
But I think this does not decrease the usability.
Thank you,
---
Masami Hiramatsu (2):
tracing/boot: Fix config dependency for synthedic event
tracing: Fix event trigger to accept redundant spaces
kernel/trace/trace_boot.c | 2 +-
kernel/trace/trace_events_trigger.c | 21 +++++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
--
Masami Hiramatsu (Linaro) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] tracing/boot: Fix config dependency for synthedic event
2020-06-20 3:45 [PATCH 0/2] tracing: Fix config dependency and trigger parser Masami Hiramatsu
@ 2020-06-20 3:45 ` Masami Hiramatsu
2020-06-20 3:46 ` [PATCH 2/2] tracing: Fix event trigger to accept redundant spaces Masami Hiramatsu
2020-06-23 21:03 ` [PATCH 0/2] tracing: Fix config dependency and trigger parser Tom Zanussi
2 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2020-06-20 3:45 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Tom Zanussi
Since commit 726721a51838 ("tracing: Move synthetic events to
a separate file") decoupled synthetic event from histogram,
boot-time tracing also has to check CONFIG_SYNTH_EVENT instead
of CONFIG_HIST_TRIGGERS.
Fixes: 726721a51838 ("tracing: Move synthetic events to a separate file")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/trace/trace_boot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index 9de29bb45a27..8b5490cb02bb 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -120,7 +120,7 @@ trace_boot_add_kprobe_event(struct xbc_node *node, const char *event)
}
#endif
-#ifdef CONFIG_HIST_TRIGGERS
+#ifdef CONFIG_SYNTH_EVENTS
static int __init
trace_boot_add_synth_event(struct xbc_node *node, const char *event)
{
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] tracing: Fix event trigger to accept redundant spaces
2020-06-20 3:45 [PATCH 0/2] tracing: Fix config dependency and trigger parser Masami Hiramatsu
2020-06-20 3:45 ` [PATCH 1/2] tracing/boot: Fix config dependency for synthedic event Masami Hiramatsu
@ 2020-06-20 3:46 ` Masami Hiramatsu
2020-06-23 21:03 ` [PATCH 0/2] tracing: Fix config dependency and trigger parser Tom Zanussi
2 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2020-06-20 3:46 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Tom Zanussi
Fix the event trigger to accept redundant spaces in
the trigger input.
For example, these return -EINVAL
echo " traceon" > events/ftrace/print/trigger
echo "traceon if common_pid == 0" > events/ftrace/print/trigger
echo "disable_event:kmem:kmalloc " > events/ftrace/print/trigger
But these are hard to find what is wrong.
To fix this issue, use skip_spaces() to remove spaces
in front of actual tokens, and set NULL if there is no
token.
Fixes: 85f2b08268c0 ("tracing: Add basic event trigger framework")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/trace/trace_events_trigger.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 3a74736da363..f725802160c0 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -216,11 +216,17 @@ static int event_trigger_regex_open(struct inode *inode, struct file *file)
int trigger_process_regex(struct trace_event_file *file, char *buff)
{
- char *command, *next = buff;
+ char *command, *next;
struct event_command *p;
int ret = -EINVAL;
+ next = buff = skip_spaces(buff);
command = strsep(&next, ": \t");
+ if (next) {
+ next = skip_spaces(next);
+ if (!*next)
+ next = NULL;
+ }
command = (command[0] != '!') ? command : command + 1;
mutex_lock(&trigger_cmd_mutex);
@@ -630,8 +636,14 @@ event_trigger_callback(struct event_command *cmd_ops,
int ret;
/* separate the trigger from the filter (t:n [if filter]) */
- if (param && isdigit(param[0]))
+ if (param && isdigit(param[0])) {
trigger = strsep(¶m, " \t");
+ if (param) {
+ param = skip_spaces(param);
+ if (!*param)
+ param = NULL;
+ }
+ }
trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
@@ -1368,6 +1380,11 @@ int event_enable_trigger_func(struct event_command *cmd_ops,
trigger = strsep(¶m, " \t");
if (!trigger)
return -EINVAL;
+ if (param) {
+ param = skip_spaces(param);
+ if (!*param)
+ param = NULL;
+ }
system = strsep(&trigger, ":");
if (!trigger)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] tracing: Fix config dependency and trigger parser
2020-06-20 3:45 [PATCH 0/2] tracing: Fix config dependency and trigger parser Masami Hiramatsu
2020-06-20 3:45 ` [PATCH 1/2] tracing/boot: Fix config dependency for synthedic event Masami Hiramatsu
2020-06-20 3:46 ` [PATCH 2/2] tracing: Fix event trigger to accept redundant spaces Masami Hiramatsu
@ 2020-06-23 21:03 ` Tom Zanussi
2 siblings, 0 replies; 4+ messages in thread
From: Tom Zanussi @ 2020-06-23 21:03 UTC (permalink / raw)
To: Masami Hiramatsu, Steven Rostedt; +Cc: LKML
Hi Masami,
On Sat, 2020-06-20 at 12:45 +0900, Masami Hiramatsu wrote:
> Hi,
>
> These are some fixes which I found recentry on ftrace.
>
> - Since the boot-time tracing synthetic event feature is decoupled
> from trigger recenty, it should use CONFIG_SYNTH_EVENT.
Oops, yeah, I missed this one in the update, thanks for finding it.
> - The parser of event trigger seems rejecting some redundant
> spaces. But it is hard users to find the wrong point. Such
> spaces should be accepted.
>
Agreed, your patch makes things much better, thanks.
You can add my reviewed-by for both patches.
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Thanks,
Tom
> BTW, I also found the trigger parser accepts some inputs which
> may not correctly formatted, e.g.
>
> # echo "traceon 1" > events/ftrace/print/trigger
>
> (from the document, it must be "traceon:1")
> But I think this does not decrease the usability.
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (2):
> tracing/boot: Fix config dependency for synthedic event
> tracing: Fix event trigger to accept redundant spaces
>
>
> kernel/trace/trace_boot.c | 2 +-
> kernel/trace/trace_events_trigger.c | 21 +++++++++++++++++++--
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> --
> Masami Hiramatsu (Linaro) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-23 21:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 3:45 [PATCH 0/2] tracing: Fix config dependency and trigger parser Masami Hiramatsu
2020-06-20 3:45 ` [PATCH 1/2] tracing/boot: Fix config dependency for synthedic event Masami Hiramatsu
2020-06-20 3:46 ` [PATCH 2/2] tracing: Fix event trigger to accept redundant spaces Masami Hiramatsu
2020-06-23 21:03 ` [PATCH 0/2] tracing: Fix config dependency and trigger parser Tom Zanussi
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).