LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/3] A few hist trigger fixes
@ 2018-04-27 1:04 Tom Zanussi
2018-04-27 1:04 ` [PATCH 1/3] tracing: Restore proper field flag printing when displaying triggers Tom Zanussi
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Tom Zanussi @ 2018-04-27 1:04 UTC (permalink / raw)
To: rostedt
Cc: tglx, mhiramat, namhyung, vedang.patel, bigeasy, joel.opensrc,
joelaf, mathieu.desnoyers, baohong.liu, rajvi.jingar, julia,
fengguang.wu, linux-kernel, linux-rt-users, Tom Zanussi
Hi Steve,
Here are a few patches that fix some problems found when testing the
hist trigger inter-event (e.g. latency) support patches.
The first fixes a problem I noticed when printing flags.
The remaining two add some hist_err() calls for fields, the first
reported by Masami, the second something I noticed when fixing the
first.
Thanks,
Tom
The following changes since commit 0566e40ce7c493d39006cdd7edf17bfdc52eb2ac:
tracing: initcall: Ordered comparison of function pointers (2018-04-26 15:02:46 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/hist-fixes-1
Tom Zanussi (3):
tracing: Restore proper field flag printing when displaying triggers
tracing: Add field parsing hist error for hist triggers
tracing: Add field modifier parsing hist error for hist triggers
kernel/trace/trace_events_hist.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--
1.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] tracing: Restore proper field flag printing when displaying triggers
2018-04-27 1:04 [PATCH 0/3] A few hist trigger fixes Tom Zanussi
@ 2018-04-27 1:04 ` Tom Zanussi
2018-04-27 1:04 ` [PATCH 2/3] tracing: Add field parsing hist error for hist triggers Tom Zanussi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Tom Zanussi @ 2018-04-27 1:04 UTC (permalink / raw)
To: rostedt
Cc: tglx, mhiramat, namhyung, vedang.patel, bigeasy, joel.opensrc,
joelaf, mathieu.desnoyers, baohong.liu, rajvi.jingar, julia,
fengguang.wu, linux-kernel, linux-rt-users, Tom Zanussi
The flag-printing code used when displaying hist triggers somehow got
dropped during refactoring of the inter-event patchset. This restores
it.
Below are a couple examples - in the first case, .usecs wasn't being
displayed properly for common_timestamps and the second illustrates
the same for other flags such as .execname.
Before:
# echo 'hist:key=common_pid.execname:val=count:sort=count' > /sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger
# cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger
hist:keys=common_pid:vals=hitcount,count:sort=count:size=2048 [active]
# echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
hist:keys=pid:vals=hitcount:ts0=common_timestamp:sort=hitcount:size=2048:clock=global if comm=="cyclictest" [active]
After:
# echo 'hist:key=common_pid.execname:val=count:sort=count' > /sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger
# cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger
hist:keys=common_pid.execname:vals=hitcount,count:sort=count:size=2048 [active]
# echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
hist:keys=pid:vals=hitcount:ts0=common_timestamp.usecs:sort=hitcount:size=2048:clock=global if comm=="cyclictest" [active]
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
kernel/trace/trace_events_hist.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 0d7b3ff..66c87be 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -4913,6 +4913,16 @@ static void hist_field_print(struct seq_file *m, struct hist_field *hist_field)
seq_printf(m, "%s", field_name);
} else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP)
seq_puts(m, "common_timestamp");
+
+ if (hist_field->flags) {
+ if (!(hist_field->flags & HIST_FIELD_FL_VAR_REF) &&
+ !(hist_field->flags & HIST_FIELD_FL_EXPR)) {
+ const char *flags = get_hist_field_flags(hist_field);
+
+ if (flags)
+ seq_printf(m, ".%s", flags);
+ }
+ }
}
static int event_hist_trigger_print(struct seq_file *m,
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] tracing: Add field parsing hist error for hist triggers
2018-04-27 1:04 [PATCH 0/3] A few hist trigger fixes Tom Zanussi
2018-04-27 1:04 ` [PATCH 1/3] tracing: Restore proper field flag printing when displaying triggers Tom Zanussi
@ 2018-04-27 1:04 ` Tom Zanussi
2018-04-27 1:04 ` [PATCH 3/3] tracing: Add field modifier " Tom Zanussi
2018-04-27 1:40 ` [PATCH 0/3] A few hist trigger fixes Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Tom Zanussi @ 2018-04-27 1:04 UTC (permalink / raw)
To: rostedt
Cc: tglx, mhiramat, namhyung, vedang.patel, bigeasy, joel.opensrc,
joelaf, mathieu.desnoyers, baohong.liu, rajvi.jingar, julia,
fengguang.wu, linux-kernel, linux-rt-users, Tom Zanussi
If the user specifies a nonexistent field for a hist trigger, the
current code correctly flags that as an error, but doesn't tell the
user what happened.
Fix this by invoking hist_err() with an appropriate message when
nonexistent fields are specified.
Before:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
-su: echo: write error: Invalid argument
# cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
After:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
-su: echo: write error: Invalid argument
# cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
ERROR: Couldn't find field: pid
Last command: keys=pid:ts0=common_timestamp.usecs
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Reported-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/trace/trace_events_hist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 66c87be..f231fa2 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -2481,6 +2481,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data,
else {
field = trace_find_event_field(file->event_call, field_name);
if (!field || !field->size) {
+ hist_err("Couldn't find field: ", field_name);
field = ERR_PTR(-EINVAL);
goto out;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] tracing: Add field modifier parsing hist error for hist triggers
2018-04-27 1:04 [PATCH 0/3] A few hist trigger fixes Tom Zanussi
2018-04-27 1:04 ` [PATCH 1/3] tracing: Restore proper field flag printing when displaying triggers Tom Zanussi
2018-04-27 1:04 ` [PATCH 2/3] tracing: Add field parsing hist error for hist triggers Tom Zanussi
@ 2018-04-27 1:04 ` Tom Zanussi
2018-04-27 1:40 ` [PATCH 0/3] A few hist trigger fixes Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Tom Zanussi @ 2018-04-27 1:04 UTC (permalink / raw)
To: rostedt
Cc: tglx, mhiramat, namhyung, vedang.patel, bigeasy, joel.opensrc,
joelaf, mathieu.desnoyers, baohong.liu, rajvi.jingar, julia,
fengguang.wu, linux-kernel, linux-rt-users, Tom Zanussi
If the user specifies an invalid field modifier for a hist trigger,
the current code correctly flags that as an error, but doesn't tell
the user what happened.
Fix this by invoking hist_err() with an appropriate message when
invalid modifiers are specified.
Before:
# echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
-su: echo: write error: Invalid argument
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist
After:
# echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
-su: echo: write error: Invalid argument
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist
ERROR: Invalid field modifier: junkusecs
Last command: keys=pid:ts0=common_timestamp.junkusecs
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
kernel/trace/trace_events_hist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index f231fa2..b9061ed 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -2466,6 +2466,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data,
else if (strcmp(modifier, "usecs") == 0)
*flags |= HIST_FIELD_FL_TIMESTAMP_USECS;
else {
+ hist_err("Invalid field modifier: ", modifier);
field = ERR_PTR(-EINVAL);
goto out;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] A few hist trigger fixes
2018-04-27 1:04 [PATCH 0/3] A few hist trigger fixes Tom Zanussi
` (2 preceding siblings ...)
2018-04-27 1:04 ` [PATCH 3/3] tracing: Add field modifier " Tom Zanussi
@ 2018-04-27 1:40 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2018-04-27 1:40 UTC (permalink / raw)
To: Tom Zanussi
Cc: tglx, mhiramat, namhyung, vedang.patel, bigeasy, joel.opensrc,
joelaf, mathieu.desnoyers, baohong.liu, rajvi.jingar, julia,
fengguang.wu, linux-kernel, linux-rt-users
On Thu, 26 Apr 2018 20:04:46 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:
> Hi Steve,
>
> Here are a few patches that fix some problems found when testing the
> hist trigger inter-event (e.g. latency) support patches.
>
> The first fixes a problem I noticed when printing flags.
>
> The remaining two add some hist_err() calls for fields, the first
> reported by Masami, the second something I noticed when fixing the
> first.
>
They look good and I queued them up.
Thanks!
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-27 1:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 1:04 [PATCH 0/3] A few hist trigger fixes Tom Zanussi
2018-04-27 1:04 ` [PATCH 1/3] tracing: Restore proper field flag printing when displaying triggers Tom Zanussi
2018-04-27 1:04 ` [PATCH 2/3] tracing: Add field parsing hist error for hist triggers Tom Zanussi
2018-04-27 1:04 ` [PATCH 3/3] tracing: Add field modifier " Tom Zanussi
2018-04-27 1:40 ` [PATCH 0/3] A few hist trigger fixes 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).