Skip to contentSkip to conversation

Linux 4.14.40-rt31-rc1

PATCH In review Steven Rostedt 2 participants 8 messages May 16, 2018 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover Linux 4.14.40-rt31-rc1

Dear RT Folks,

This is the RT stable review cycle of patch 4.14.40-rt31-rc1.

This only includes patches that are in mainline that fix the new histogram trigger code. This also needs to be applied to 4.16-rt before I release this into 4.14-rt.

Please scream at me if I messed something up. Please test the patches too.

The -rc release will be uploaded to kernel.org and will be deleted when the final release is out. This is just a review release (or release candidate).

The pre-releases will not be pushed to the git repository, only the final release is.

If all goes well, this patch will be converted to the next main release on 5/22/2018.

Enjoy,

-- Steve

To build 4.14.40-rt31-rc1 directly, the following patches should be applied:

http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz

http://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.40.xz

http://www.kernel.org/pub/linux/kernel/projects/rt/4.14/patch-4.14.40-rt31-rc1.patch.xz

You can also build from 4.14.40-rt30 by applying the incremental patch:

http://www.kernel.org/pub/linux/kernel/projects/rt/4.14/incr/patch-4.14.40-rt30-rt31-rc1.patch.xz

Changes from 4.14.40-rt30:

---

Dan Carpenter (1):
tracing: Uninitialized variable in create_tracing_map_fields()

Steven Rostedt (VMware) (1):

      Linux 4.14.40-rt31-rc1

Tom Zanussi (3):
tracing: Add field modifier parsing hist error for hist triggers
tracing: Add field parsing hist error for hist triggers
tracing: Restore proper field flag printing when displaying triggers

----

 kernel/trace/trace_events_hist.c | 14 +++++++++++++-
 localversion-rt                  |  2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)
author maintainer
#1 lore raw

PATCH 1/5 tracing: Add field modifier parsing hist error for hist triggers

4.14.40-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Tom Zanussi <[email protected]>

[ commit dcf234577cd31fa16874e828b90659166ad6b80d ]

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
---
 kernel/trace/trace_events_hist.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_events_hist.c +1 -0
index 37db86145c8b..b8fee11b5be9 100644
@@ -2466,6 +2466,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
 		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;
 		}
Signature · 1 line
2.17.0
author maintainer
#2 lore raw

PATCH 2/5 tracing: Add field parsing hist error for hist triggers

In reply to Steven Rostedt

4.14.40-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Tom Zanussi <[email protected]>

[ commit 5ec432d7bf9dd3b4a2b84f8974e3adb71f45fb1d ]

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
---
 kernel/trace/trace_events_hist.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_events_hist.c +1 -0
index b8fee11b5be9..9dac8bae4f34 100644
@@ -2482,6 +2482,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
 	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;
 		}
Signature · 1 line
2.17.0
author maintainer
#3 lore raw

PATCH 3/5 tracing: Restore proper field flag printing when displaying triggers

In reply to Steven Rostedt

4.14.40-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Tom Zanussi <[email protected]>

[ commit 608940dabe1bd2ce4c97524004ec86637cf80f2c ]

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]
---
 kernel/trace/trace_events_hist.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
kernel/trace/trace_events_hist.c +10 -0
index 9dac8bae4f34..4745ed588607 100644
@@ -4916,6 +4916,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,
Signature · 1 line
2.17.0
#4 lore raw

Re: [PATCH RT 3/5] tracing: Restore proper field flag printing when displaying triggers

Quoted 11 lines · Steven Rostedt
kernel/trace/trace_events_hist.c +3 -0
index 9dac8bae4f34..4745ed588607 100644
@@ -4916,6 +4916,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) &&

kernel/trace/trace_events_hist.c static void hist_field_print(struct seq_file *m, struct hist_field *hist_field) · line 4931

Quoted 10 lines
kernel/trace/trace_events_hist.c +7 -0
+		    !(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,

For v4.16 I needed commit 0ae7961e75c3 ("tracing: Fix display of hist trigger expressions containing timestamps") in order to get this one cleanly applied. Comparing with -rc3 it looks like commit 5e4cf2bf6d1c ("tracing: Fix a potential NULL dereference") would be great addition.

Safe to take them, right?

Sebastian

author maintainer
#5 lore raw

Re: [PATCH RT 3/5] tracing: Restore proper field flag printing when displaying triggers

Quoted 21 lines · On Wed, 16 May 2018 17:32:14 +0200 Sebastian Andrzej Siewior…
Quoted 20 lines · Steven Rostedt
kernel/trace/trace_events_hist.c +10 -0
index 9dac8bae4f34..4745ed588607 100644
@@ -4916,6 +4916,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);
+		}
+	}
 }
 
Quoted 4 lines

kernel/trace/trace_events_hist.c static void hist_field_print(struct seq_file *m, struct hist_field *hist_field) · line 4931

Quoted 1 line
kernel/trace/trace_events_hist.c +0 -0
 static int event_hist_trigger_print(struct seq_file *m,  

For v4.16 I needed commit 0ae7961e75c3 ("tracing: Fix display of hist trigger expressions containing timestamps") in order to get this one

Yes, I assumed you had it as you pulled it into 4.14-rt. I was just looking at what 4.14-rt has. Anything you added there you should add to 4.16-rt as well.

Quoted 2 lines

cleanly applied. Comparing with -rc3 it looks like commit 5e4cf2bf6d1c ("tracing: Fix a potential NULL dereference") would be great addition.

Good catch, yeah, I should pull that in too.

Quoted 2 lines

Safe to take them, right?

Yep.

-- Steve

author maintainer
#6 lore raw

PATCH 4/5 tracing: Uninitialized variable in create_tracing_map_fields()

In reply to Steven Rostedt

4.14.40-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

[ commit b28d7b2dc27f0eef1ae608b49d6860f2463910f1 ]

Smatch complains that idx can be used uninitialized when we check if (idx < 0). It has to be the first iteration through the loop and the HIST_FIELD_FL_STACKTRACE bit has to be clear and the HIST_FIELD_FL_VAR bit has to be set to reach the bug.

Fixes 30350d65ac56 ("tracing: Add variable support to hist triggers")
---
 kernel/trace/trace_events_hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +1 -1
index 4745ed588607..b3808969ac92 100644
@@ -4459,7 +4459,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data)
 	struct tracing_map *map = hist_data->map;
 	struct ftrace_event_field *field;
 	struct hist_field *hist_field;
-	int i, idx;
+	int i, idx = 0;
 
 	for_each_hist_field(i, hist_data) {
 		hist_field = hist_data->fields[i];
Signature · 1 line
2.17.0
author maintainer
#7 lore raw

PATCH 5/5 Linux 4.14.40-rt31-rc1

In reply to Steven Rostedt

4.14.40-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (VMware)" <[email protected]>

---
 localversion-rt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
localversion-rt +1 -1
index b72862e06be4..7f30ff78f82f 100644
@@ -1 +1 @@
--rt30
+-rt31-rc1
Signature · 1 line
2.17.0