[rt] Update to 4.14.1-rt3

This commit is contained in:
Ben Hutchings 2017-11-29 23:05:39 +00:00
parent b0a4fbf1cd
commit fb72f17cab
378 changed files with 6262 additions and 1392 deletions

1
debian/changelog vendored
View File

@ -21,6 +21,7 @@ linux (4.14.2-1~exp1) UNRELEASED; urgency=medium
* SCSI: Enable SCSI_MQ_DEFAULT. This can be reverted using the kernel
parameter: scsi_mod.use_blk_mq=n
* [rt] Add new signing subkey for Steven Rostedt
* [rt] Update to 4.14.1-rt3
-- Ben Hutchings <ben@decadent.org.uk> Mon, 20 Nov 2017 14:16:28 +0000

View File

@ -1,24 +1,28 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 13 Nov 2017 20:23:44 +0100
Subject: [PATCH 01/36] timers: Use static keys for migrate_enable and
nohz_active
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Thu, 23 Nov 2017 16:38:42 +0100
Subject: [PATCH 01/36] timers: Use static keys for migrate_enable/nohz_active
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The migration_enabled and nohz_active will be later moved into the bitfield. In
the bitfield a change to one bit causes RMW operation and without holding a
lock it might happen that a concurrent change on a second CPU might cause the
loss of the an update.
To avoid that and since both fields are changed to static_branch.
The members migrate_enable and nohz_active in the timer/hrtimer per CPU
bases have been introduced to avoid accessing global variables for these
decisions.
Still that results in a (cache hot) load and conditional branch, which can
be avoided by using static keys.
Implement it with static keys and optimize for the most critical case of
high performance networking which tends to disable the timer migration
functionality.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 4 -
kernel/time/hrtimer.c | 17 ++------
kernel/time/tick-internal.h | 21 +++++++---
kernel/time/tick-internal.h | 19 +++++----
kernel/time/tick-sched.c | 2
kernel/time/timer.c | 91 ++++++++++++++++++++++----------------------
5 files changed, 69 insertions(+), 66 deletions(-)
5 files changed, 65 insertions(+), 68 deletions(-)
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@ -81,34 +85,30 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
hrtimer_reprogram(timer, new_base);
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -150,14 +150,25 @@ static inline void tick_nohz_init(void)
@@ -150,14 +150,19 @@ static inline void tick_nohz_init(void)
#ifdef CONFIG_NO_HZ_COMMON
extern unsigned long tick_nohz_active;
-#else
+extern void timers_update_nohz(void);
+extern struct static_key_false timers_nohz_active;
+
+static inline bool is_timers_nohz_active(void)
+{
+ return static_branch_unlikely(&timers_nohz_active);
+}
+
+#ifdef CONFIG_SMP
+# ifdef CONFIG_SMP
+extern struct static_key_false timers_migration_enabled;
+#endif
#else
+# endif
+#else /* CONFIG_NO_HZ_COMMON */
+static inline void timers_update_nohz(void) { }
#define tick_nohz_active (0)
-#endif
-
-#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
-extern void timers_update_migration(bool update_nohz);
-#else
-static inline void timers_update_migration(bool update_nohz) { }
+static inline bool is_timers_nohz_active(void)
+{
+ return false;
+}
+static inline bool is_timers_nohz_active(void) { return false; }
#endif
DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ From: Steven Rostedt <rostedt@goodmis.org>
Date: Fri, 22 Sep 2017 14:58:15 -0500
Subject: [PATCH 01/42] tracing: Steve's unofficial trace_recursive_lock()
patch
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
On Tue, 5 Sep 2017 16:57:52 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:39 +0200
Date: Thu, 23 Nov 2017 16:38:43 +0100
Subject: [PATCH 02/36] hrtimer: Correct blantanly wrong comment
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The protection of a hrtimer which runs its callback against migration to a
different CPU has nothing to do with hard interrupt context.
@ -14,7 +14,6 @@ callback is running.
Reported-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 6 +++---

View File

@ -0,0 +1,24 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 17 Nov 2017 14:32:41 -0600
Subject: [PATCH 02/37] tracing: Add Documentation for log2 modifier
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add a line for the log2 modifier, to keep it aligned with
tracing/README.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/trace/histogram.txt | 1 +
1 file changed, 1 insertion(+)
--- a/Documentation/trace/histogram.txt
+++ b/Documentation/trace/histogram.txt
@@ -73,6 +73,7 @@
.sym-offset display an address as a symbol and offset
.syscall display a syscall id as a system call name
.execname display a common_pid as a program name
+ .log2 display log2 value rather than raw number
Note that in general the semantics of a given field aren't
interpreted when applying a modifier to it, but there are some

View File

@ -2,7 +2,7 @@ From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Date: Fri, 22 Sep 2017 14:58:16 -0500
Subject: [PATCH 02/42] tracing: Reverse the order of trace_types_lock and
event_mutex
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
In order to make future changes where we need to call
tracing_set_clock() from within an event command, the order of

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:40 +0200
Subject: [PATCH 03/36] hrtimer: Fix kerneldoc for struct hrtimer_cpu_base
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The sequence '/**' marks the start of a struct description. Add the
missing second asterisk. While at it adapt the ordering of the struct
@ -9,6 +9,7 @@ members to the struct definition and document the purpose of
expires_next more precisely.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 8 ++++----

View File

@ -1,7 +1,7 @@
From: Vedang Patel <vedang.patel@intel.com>
Date: Fri, 22 Sep 2017 14:59:41 -0500
Subject: [PATCH 10/42] tracing: Add support to detect and avoid duplicates
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:42 -0600
Subject: [PATCH 03/37] tracing: Add support to detect and avoid duplicates
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
A duplicate in the tracing_map hash table is when 2 different entries
have the same key and, as a result, the key_hash. This is possible due
@ -42,6 +42,7 @@ had the same key.
[1] http://lkml.kernel.org/r/cover.1498510759.git.tom.zanussi@linux.intel.com
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/tracing_map.c | 41 ++++++++++++++++++++++++++++++++++++-----

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:17 -0500
Subject: [PATCH 03/42] tracing: Exclude 'generic fields' from histograms
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
There are a small number of 'generic fields' (comm/COMM/cpu/CPU) that
are found by trace_find_event_field() but are only meant for

View File

@ -2,7 +2,7 @@ From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:41 +0200
Subject: [PATCH 04/36] hrtimer: Cleanup clock argument in
schedule_hrtimeout_range_clock()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
schedule_hrtimeout_range_clock() uses an integer for the clock id
instead of the predefined type "clockid_t". The ID of the clock is
@ -17,6 +17,7 @@ schedule_hrtimeout_range_clock().
No functional change.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 2 +-

View File

@ -1,7 +1,7 @@
From: Vedang Patel <vedang.patel@intel.com>
Date: Fri, 22 Sep 2017 14:59:42 -0500
Subject: [PATCH 11/42] tracing: Remove code which merges duplicates
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:43 -0600
Subject: [PATCH 04/37] tracing: Remove code which merges duplicates
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
We now have the logic to detect and remove duplicates in the
tracing_map hash table. The code which merges duplicates in the
@ -11,6 +11,7 @@ that any rare race condition which might cause duplicates does not go
unnoticed.
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 11 -----

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:18 -0500
Subject: [PATCH 04/42] tracing: Remove lookups from tracing_map hitcount
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Lookups inflate the hitcount, making it essentially useless. Only
inserts and updates should really affect the hitcount anyway, so

View File

@ -1,13 +1,14 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:42 +0200
Subject: [PATCH 05/36] hrtimer: Fix hrtimer function description
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The hrtimer_start[_range_ns]() starts a timer reliable on this CPU only
when HRTIMER_MODE_PINNED is set. Furthermore the HRTIMER_MODE_PINNED mode
is not considered, when a hrtimer is initialized.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 6 +++---

View File

@ -1,16 +1,13 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:43 -0500
Subject: [PATCH 12/42] ring-buffer: Add interface for setting absolute time
Date: Fri, 17 Nov 2017 14:32:44 -0600
Subject: [PATCH 05/37] ring-buffer: Add interface for setting absolute time
stamps
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Define a new function, tracing_set_time_stamp_abs(), which can be used
to enable or disable the use of absolute timestamps rather than time
deltas for a trace array.
This resets the buffer to prevent a mix of time deltas and absolute
timestamps.
Only the interface is added here; a subsequent patch will add the
underlying implementation.
@ -20,9 +17,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/ring_buffer.h | 2 ++
kernel/trace/ring_buffer.c | 11 +++++++++++
kernel/trace/trace.c | 40 +++++++++++++++++++++++++++++++++++++++-
kernel/trace/trace.c | 33 ++++++++++++++++++++++++++++++++-
kernel/trace/trace.h | 3 +++
4 files changed, 55 insertions(+), 1 deletion(-)
4 files changed, 48 insertions(+), 1 deletion(-)
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@ -73,7 +70,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
(EVENT_FILE_FL_SOFT_DISABLED | EVENT_FILE_FL_FILTERED)) &&
(entry = this_cpu_read(trace_buffered_event))) {
/* Try to use the per cpu buffer first */
@@ -6297,6 +6297,44 @@ static int tracing_clock_open(struct ino
@@ -6297,6 +6297,37 @@ static int tracing_clock_open(struct ino
return ret;
}
@ -99,16 +96,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ ring_buffer_set_time_stamp_abs(tr->trace_buffer.buffer, abs);
+
+ /*
+ * New timestamps may not be consistent with the previous setting.
+ * Reset the buffer so that it doesn't have incomparable timestamps.
+ */
+ tracing_reset_online_cpus(&tr->trace_buffer);
+
+#ifdef CONFIG_TRACER_MAX_TRACE
+ if (tr->max_buffer.buffer)
+ ring_buffer_set_time_stamp_abs(tr->max_buffer.buffer, abs);
+ tracing_reset_online_cpus(&tr->max_buffer);
+#endif
+ out:
+ mutex_unlock(&trace_types_lock);

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:19 -0500
Subject: [PATCH 05/42] tracing: Increase tracing map KEYS_MAX size
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The current default for the number of subkeys in a compound key is 2,
which is too restrictive. Increase it to a more realistic value of 3.

View File

@ -2,7 +2,7 @@ From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:43 +0200
Subject: [PATCH 06/36] hrtimer: Ensure POSIX compliance (relative
CLOCK_REALTIME hrtimers)
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
POSIX specification defines, that relative CLOCK_REALTIME timers are not
affected by clock modifications. Those timers have to use CLOCK_MONOTONIC
@ -17,8 +17,8 @@ Check whether the mode has the HRTIMER_MODE_REL bit set instead of
comparing with HRTIMER_MODE_ABS.
Fixes: 597d0275736d ("timers: Framework for identifying pinned timers")
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 7 ++++++-

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:44 -0500
Subject: [PATCH 13/42] ring-buffer: Redefine the unimplemented
RINGBUF_TIME_TIME_STAMP
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:45 -0600
Subject: [PATCH 06/37] ring-buffer: Redefine the unimplemented
RINGBUF_TYPE_TIME_STAMP
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
RINGBUF_TYPE_TIME_STAMP is defined but not used, and from what I can
gather was reserved for something like an absolute timestamp feature
@ -25,8 +25,8 @@ Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/ring_buffer.h | 12 ++---
kernel/trace/ring_buffer.c | 105 +++++++++++++++++++++++++++++++-------------
2 files changed, 83 insertions(+), 34 deletions(-)
kernel/trace/ring_buffer.c | 104 ++++++++++++++++++++++++++++++++------------
2 files changed, 83 insertions(+), 33 deletions(-)
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@ -144,13 +144,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/* Flag when events were overwritten */
#define RB_MISSED_EVENTS (1 << 31)
/* Missed count stored at end */
@@ -2220,13 +2246,16 @@ rb_move_tail(struct ring_buffer_per_cpu
}
@@ -2221,12 +2247,15 @@ rb_move_tail(struct ring_buffer_per_cpu
/* Slow path, do not inline */
-static noinline struct ring_buffer_event *
static noinline struct ring_buffer_event *
-rb_add_time_stamp(struct ring_buffer_event *event, u64 delta)
+static struct noinline ring_buffer_event *
+rb_add_time_stamp(struct ring_buffer_event *event, u64 delta, bool abs)
{
- event->type_len = RINGBUF_TYPE_TIME_EXTEND;
@ -186,18 +184,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
event = skip_time_extend(event);
/* array[0] holds the actual length for the discarded event */
@@ -2488,6 +2519,10 @@ rb_update_write_stamp(struct ring_buffer
{
u64 delta;
+ /* In TIME_STAMP mode, write_stamp is unused, nothing to do */
+ if (event->type_len == RINGBUF_TYPE_TIME_STAMP)
+ return;
+
/*
* The event first in the commit queue updates the
* time stamp.
@@ -2501,9 +2536,7 @@ rb_update_write_stamp(struct ring_buffer
@@ -2501,10 +2532,11 @@ rb_update_write_stamp(struct ring_buffer
cpu_buffer->write_stamp =
cpu_buffer->commit_page->page->time_stamp;
else if (event->type_len == RINGBUF_TYPE_TIME_EXTEND) {
@ -206,9 +193,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
- delta += event->time_delta;
+ delta = ring_buffer_event_time_stamp(event);
cpu_buffer->write_stamp += delta;
+ } else if (event->type_len == RINGBUF_TYPE_TIME_STAMP) {
+ delta = ring_buffer_event_time_stamp(event);
+ cpu_buffer->write_stamp = delta;
} else
cpu_buffer->write_stamp += event->time_delta;
@@ -2657,7 +2690,7 @@ static struct ring_buffer_event *
}
@@ -2657,7 +2689,7 @@ static struct ring_buffer_event *
* If this is the first commit on the page, then it has the same
* timestamp as the page itself.
*/
@ -217,7 +208,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
info->delta = 0;
/* See if we shot pass the end of this buffer page */
@@ -2735,8 +2768,11 @@ rb_reserve_next_event(struct ring_buffer
@@ -2735,8 +2767,11 @@ rb_reserve_next_event(struct ring_buffer
/* make sure this diff is calculated here */
barrier();
@ -231,7 +222,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
info.delta = diff;
if (unlikely(test_time_stamp(info.delta)))
rb_handle_timestamp(cpu_buffer, &info);
@@ -3418,14 +3454,12 @@ rb_update_read_stamp(struct ring_buffer_
@@ -3418,14 +3453,13 @@ rb_update_read_stamp(struct ring_buffer_
return;
case RINGBUF_TYPE_TIME_EXTEND:
@ -244,11 +235,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
case RINGBUF_TYPE_TIME_STAMP:
- /* FIXME: not implemented */
+ /* In TIME_STAMP mode, write_stamp is unused, nothing to do */
+ delta = ring_buffer_event_time_stamp(event);
+ cpu_buffer->read_stamp = delta;
return;
case RINGBUF_TYPE_DATA:
@@ -3449,14 +3483,12 @@ rb_update_iter_read_stamp(struct ring_bu
@@ -3449,14 +3483,13 @@ rb_update_iter_read_stamp(struct ring_bu
return;
case RINGBUF_TYPE_TIME_EXTEND:
@ -261,11 +253,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
case RINGBUF_TYPE_TIME_STAMP:
- /* FIXME: not implemented */
+ /* In TIME_STAMP mode, write_stamp is unused, nothing to do */
+ delta = ring_buffer_event_time_stamp(event);
+ iter->read_stamp = delta;
return;
case RINGBUF_TYPE_DATA:
@@ -3680,6 +3712,8 @@ rb_buffer_peek(struct ring_buffer_per_cp
@@ -3680,6 +3713,8 @@ rb_buffer_peek(struct ring_buffer_per_cp
struct buffer_page *reader;
int nr_loops = 0;
@ -274,7 +267,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
again:
/*
* We repeat when a time extend is encountered.
@@ -3716,12 +3750,17 @@ rb_buffer_peek(struct ring_buffer_per_cp
@@ -3716,12 +3751,17 @@ rb_buffer_peek(struct ring_buffer_per_cp
goto again;
case RINGBUF_TYPE_TIME_STAMP:
@ -294,7 +287,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*ts = cpu_buffer->read_stamp + event->time_delta;
ring_buffer_normalize_time_stamp(cpu_buffer->buffer,
cpu_buffer->cpu, ts);
@@ -3746,6 +3785,9 @@ rb_iter_peek(struct ring_buffer_iter *it
@@ -3746,6 +3786,9 @@ rb_iter_peek(struct ring_buffer_iter *it
struct ring_buffer_event *event;
int nr_loops = 0;
@ -304,7 +297,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
cpu_buffer = iter->cpu_buffer;
buffer = cpu_buffer->buffer;
@@ -3798,12 +3840,17 @@ rb_iter_peek(struct ring_buffer_iter *it
@@ -3798,12 +3841,17 @@ rb_iter_peek(struct ring_buffer_iter *it
goto again;
case RINGBUF_TYPE_TIME_STAMP:

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:20 -0500
Subject: [PATCH 06/42] tracing: Make traceprobe parsing code reusable
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
traceprobe_probes_write() and traceprobe_command() actually contain
nothing that ties them to kprobes - the code is generically useful for

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:44 +0200
Subject: [PATCH 07/36] hrtimer: Cleanup hrtimer_mode enum
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
It's not obvious that the HRTIMER_MODE variants are bit combinations
because all modes are hard coded constants.
@ -12,6 +12,7 @@ modes which combine bits.
While at it get rid of the ugly tail comments.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 16 +++++++++++-----

View File

@ -0,0 +1,134 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 17 Nov 2017 14:32:46 -0600
Subject: [PATCH 07/37] tracing: Add timestamp_mode trace file
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add a new option flag indicating whether or not the ring buffer is in
'absolute timestamp' mode.
Currently this is only set/unset by hist triggers that make use of a
$common_timestamp. As such, there's no reason to make this writeable
for users - its purpose is only to allow users to determine
unequivocally whether or not the ring buffer is in that mode (although
absolute timestamps can coexist with the normal delta timestamps, when
the ring buffer is in absolute mode, timestamps written while absolute
mode is in effect take up more space in the buffer, and are not as
efficient).
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/trace/ftrace.txt | 24 ++++++++++++++++++++
kernel/trace/trace.c | 47 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -539,6 +539,30 @@ After mounting tracefs you will have acc
See events.txt for more information.
+ timestamp_mode:
+
+ Certain tracers may change the timestamp mode used when
+ logging trace events into the event buffer. Events with
+ different modes can coexist within a buffer but the mode in
+ effect when an event is logged determines which timestamp mode
+ is used for that event. The default timestamp mode is
+ 'delta'.
+
+ Usual timestamp modes for tracing:
+
+ # cat timestamp_mode
+ [delta] absolute
+
+ The timestamp mode with the square brackets around it is the
+ one in effect.
+
+ delta: Default timestamp mode - timestamp is a delta against
+ a per-buffer timestamp.
+
+ absolute: The timestamp is a full timestamp, not a delta
+ against some other value. As such it takes up more
+ space and is less efficient.
+
hwlat_detector:
Directory for the Hardware Latency Detector.
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4531,6 +4531,9 @@ static const char readme_msg[] =
#ifdef CONFIG_X86_64
" x86-tsc: TSC cycle counter\n"
#endif
+ "\n timestamp_mode\t-view the mode used to timestamp events\n"
+ " delta: Delta difference against a buffer-wide timestamp\n"
+ " absolute: Absolute (standalone) timestamp\n"
"\n trace_marker\t\t- Writes into this file writes into the kernel buffer\n"
"\n trace_marker_raw\t\t- Writes into this file writes binary data into the kernel buffer\n"
" tracing_cpumask\t- Limit which CPUs to trace\n"
@@ -6298,6 +6301,40 @@ static int tracing_clock_open(struct ino
return ret;
}
+static int tracing_time_stamp_mode_show(struct seq_file *m, void *v)
+{
+ struct trace_array *tr = m->private;
+
+ mutex_lock(&trace_types_lock);
+
+ if (ring_buffer_time_stamp_abs(tr->trace_buffer.buffer))
+ seq_puts(m, "delta [absolute]\n");
+ else
+ seq_puts(m, "[delta] absolute\n");
+
+ mutex_unlock(&trace_types_lock);
+
+ return 0;
+}
+
+static int tracing_time_stamp_mode_open(struct inode *inode, struct file *file)
+{
+ struct trace_array *tr = inode->i_private;
+ int ret;
+
+ if (tracing_disabled)
+ return -ENODEV;
+
+ if (trace_array_get(tr))
+ return -ENODEV;
+
+ ret = single_open(file, tracing_time_stamp_mode_show, inode->i_private);
+ if (ret < 0)
+ trace_array_put(tr);
+
+ return ret;
+}
+
int tracing_set_time_stamp_abs(struct trace_array *tr, bool abs)
{
int ret = 0;
@@ -6576,6 +6613,13 @@ static const struct file_operations trac
.write = tracing_clock_write,
};
+static const struct file_operations trace_time_stamp_mode_fops = {
+ .open = tracing_time_stamp_mode_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = tracing_single_release_tr,
+};
+
#ifdef CONFIG_TRACER_SNAPSHOT
static const struct file_operations snapshot_fops = {
.open = tracing_snapshot_open,
@@ -7903,6 +7947,9 @@ init_tracer_tracefs(struct trace_array *
trace_create_file("tracing_on", 0644, d_tracer,
tr, &rb_simple_fops);
+ trace_create_file("timestamp_mode", 0444, d_tracer, tr,
+ &trace_time_stamp_mode_fops);
+
create_trace_options_dir(tr);
#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:21 -0500
Subject: [PATCH 07/42] tracing: Clean up hist_field_flags enum
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
As we add more flags, specifying explicit integers for the flag values
becomes more unwieldy and error-prone - switch them over to left-shift

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:22 -0500
Subject: [PATCH 08/42] tracing: Add hist_field_name() accessor
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
In preparation for hist_fields that won't be strictly based on
trace_event_fields, add a new hist_field_name() accessor to allow that

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:45 -0500
Subject: [PATCH 14/42] tracing: Give event triggers access to
Date: Fri, 17 Nov 2017 14:32:47 -0600
Subject: [PATCH 08/37] tracing: Give event triggers access to
ring_buffer_event
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The ring_buffer event can provide a timestamp that may be useful to
various triggers - pass it into the handlers for that purpose.

View File

@ -1,8 +1,8 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:45 +0200
Subject: [PATCH 08/36] tracing: hrtimer: Take all clock bases and modes into
Subject: [PATCH 08/36] tracing/hrtimer: Take all clock bases and modes into
account
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
So far only CLOCK_MONOTONIC and CLOCK_REALTIME were taken into account as
well as HRTIMER_MODE_ABS/REL in hrtimer_init tracepoint. The query for
@ -13,6 +13,7 @@ HRTIMER_MODE_PINNED is not evaluated in hrtimer_init() call. But for the
sake of completeness print all given modes.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/trace/events/timer.h | 20 ++++++++++++++++----

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:46 -0500
Subject: [PATCH 15/42] tracing: Add ring buffer event param to hist field
Date: Fri, 17 Nov 2017 14:32:48 -0600
Subject: [PATCH 09/37] tracing: Add ring buffer event param to hist field
functions
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Some events such as timestamps require access to a ring_buffer_event
struct; add a param so that hist field functions can access that.

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:58:23 -0500
Subject: [PATCH 09/42] tracing: Reimplement log2
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
log2 as currently implemented applies only to u64 trace_event_field
derived fields, and assumes that anything it's applied to is a u64

View File

@ -1,8 +1,8 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:46 +0200
Subject: [PATCH 09/36] tracing: hrtimer: Print hrtimer mode in hrtimer_start
Subject: [PATCH 09/36] tracing/hrtimer: Print hrtimer mode in hrtimer_start
tracepoint
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The hrtimer_start tracepoint lacks the mode information. The mode is
important because consecutive starts can switch from ABS to REL or from
@ -11,6 +11,7 @@ PINNED to non PINNED.
Add the mode information.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/trace/events/timer.h | 13 ++++++++-----

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:47 +0200
Subject: [PATCH 10/36] hrtimer: Switch for loop to _ffs() evaluation
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Looping over all clock bases to find active bits is suboptimal if not all
bases are active.
@ -12,6 +12,7 @@ Peter Zijlstra.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 31 +++++++++++++++++++++----------
@ -19,8 +20,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -457,20 +457,34 @@ static inline void hrtimer_update_next_t
#endif
@@ -448,6 +448,23 @@ static inline void debug_deactivate(stru
trace_hrtimer_cancel(timer);
}
+static struct hrtimer_clock_base *
@ -40,6 +41,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+#define for_each_active_base(base, cpu_base, active) \
+ while ((base = __next_base((cpu_base), &(active))))
+
#if defined(CONFIG_NO_HZ_COMMON) || defined(CONFIG_HIGH_RES_TIMERS)
static inline void hrtimer_update_next_timer(struct hrtimer_cpu_base *cpu_base,
struct hrtimer *timer)
@@ -459,18 +476,15 @@ static inline void hrtimer_update_next_t
static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
{
- struct hrtimer_clock_base *base = cpu_base->clock_base;

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:47 -0500
Subject: [PATCH 16/42] tracing: Break out hist trigger assignment parsing
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:49 -0600
Subject: [PATCH 10/37] tracing: Break out hist trigger assignment parsing
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
This will make it easier to add variables, and makes the parsing code
cleaner regardless.

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:48 +0200
Subject: [PATCH 11/36] hrtimer: Store running timer in hrtimer_clock_base
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The pointer to the currently running timer is stored in hrtimer_cpu_base
before the base lock is dropped and the callback is invoked.
@ -27,6 +27,7 @@ looking at the number of cache lines involved for the frequently used
clocks.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 20 +++++++++-----------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:48 -0500
Subject: [PATCH 17/42] tracing: Add hist trigger timestamp support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:50 -0600
Subject: [PATCH 11/37] tracing: Add hist trigger timestamp support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add support for a timestamp event field. This is actually a 'pseudo-'
event field in that it behaves like it's part of the event record, but
@ -12,12 +12,12 @@ To make use of the timestamp field, users can specify
doesn't make much sense on its own either as either a key or value,
but needs to be supported even so, since follow-on patches will add
support for making use of this field in time deltas. The '$' is used
as a prefix on the variable name to indicate that it's not an bonafide
as a prefix on the variable name to indicate that it's not a bona fide
event field - so you won't find it in the event description - but
rather it's a synthetic field that can be used like a real field).
Note that the use of this field requires the ring buffer be put into
TIME_EXTEND_ABS mode, which saves the complete timestamp for each
'absolute timestamp' mode, which saves the complete timestamp for each
event rather than an offset. This mode will be enabled if and only if
a histogram makes use of the "$common_timestamp" field.
@ -25,8 +25,8 @@ Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 90 +++++++++++++++++++++++++++++----------
1 file changed, 67 insertions(+), 23 deletions(-)
kernel/trace/trace_events_hist.c | 94 +++++++++++++++++++++++++++++----------
1 file changed, 71 insertions(+), 23 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -212,7 +212,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (trace_event_trigger_enable_disable(file, 1) < 0) {
list_del_rcu(&data->list);
update_cond_flag(file);
@@ -1572,6 +1611,11 @@ static void hist_unregister_trigger(char
@@ -1572,19 +1611,28 @@ static void hist_unregister_trigger(char
if (unregistered && test->ops->free)
test->ops->free(test->ops, test);
@ -224,3 +224,20 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static void hist_unreg_all(struct trace_event_file *file)
{
struct event_trigger_data *test, *n;
+ struct hist_trigger_data *hist_data;
list_for_each_entry_safe(test, n, &file->triggers, list) {
if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
+ hist_data = test->private_data;
list_del_rcu(&test->list);
trace_event_trigger_enable_disable(file, 0);
update_cond_flag(file);
if (test->ops->free)
test->ops->free(test->ops, test);
+ if (hist_data->enable_timestamps)
+ tracing_set_time_stamp_abs(file->tr, false);
}
}
}

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:50 +0200
Subject: [PATCH 12/36] hrtimer: Make room in struct hrtimer_cpu_base
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The upcoming softirq based hrtimers support requires an additional field in
the hrtimer_cpu_base struct, which would grow the struct size beyond a
@ -14,6 +14,7 @@ Make them unsigned short to create room for the new struct member. No
functional change.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 4 ++--

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:49 -0500
Subject: [PATCH 18/42] tracing: Add per-element variable support to
Date: Fri, 17 Nov 2017 14:32:51 -0600
Subject: [PATCH 12/37] tracing: Add per-element variable support to
tracing_map
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
In order to allow information to be passed between trace events, add
support for per-element variables to tracing_map. This provides a

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:51 +0200
Subject: [PATCH 13/36] hrtimer: Reduce conditional code (hres_active)
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The hrtimer_cpu_base struct has the CONFIG_HIGH_RES_TIMERS conditional
struct member hres_active. All related functions to this member are
@ -16,6 +16,7 @@ conditionals into common functions, which ensures dead code elimination.
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 20 ++++++++------------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:50 -0500
Subject: [PATCH 19/42] tracing: Add hist_data member to hist_field
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:52 -0600
Subject: [PATCH 13/37] tracing: Add hist_data member to hist_field
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Allow hist_data access via hist_field. Some users of hist_fields
require or will require more access to the associated hist_data.

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:52 +0200
Subject: [PATCH 14/36] hrtimer: Use accesor functions instead of direct access
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
__hrtimer_hres_active() is now available unconditionally. Replace the
direct access to hrtimer_cpu_base.hres_active.
@ -9,6 +9,7 @@ direct access to hrtimer_cpu_base.hres_active.
No functional change.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 4 ++--

View File

@ -1,9 +1,9 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:51 -0500
Subject: [PATCH 20/42] tracing: Add usecs modifier for hist trigger timestamps
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:53 -0600
Subject: [PATCH 14/37] tracing: Add usecs modifier for hist trigger timestamps
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Appending .usecs onto a common_timestamp field will cause the
Appending .usecs onto a $common_timestamp field will cause the
timestamp value to be in microseconds instead of the default
nanoseconds. A typical latency histogram using usecs would look like
this:
@ -17,11 +17,22 @@ timestamp conversion.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace.c | 8 ++++++++
kernel/trace/trace.h | 2 ++
kernel/trace/trace_events_hist.c | 28 ++++++++++++++++++++++------
3 files changed, 32 insertions(+), 6 deletions(-)
Documentation/trace/histogram.txt | 1 +
kernel/trace/trace.c | 13 +++++++++++--
kernel/trace/trace.h | 2 ++
kernel/trace/trace_events_hist.c | 28 ++++++++++++++++++++++------
4 files changed, 36 insertions(+), 8 deletions(-)
--- a/Documentation/trace/histogram.txt
+++ b/Documentation/trace/histogram.txt
@@ -74,6 +74,7 @@
.syscall display a syscall id as a system call name
.execname display a common_pid as a program name
.log2 display log2 value rather than raw number
+ .usecs display a $common_timestamp in microseconds
Note that in general the semantics of a given field aren't
interpreted when applying a modifier to it, but there are some
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1170,6 +1170,14 @@ static struct {
@ -39,6 +50,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* trace_parser_get_init - gets the buffer for trace parser
*/
@@ -4710,8 +4718,9 @@ static const char readme_msg[] =
"\t .sym display an address as a symbol\n"
"\t .sym-offset display an address as a symbol and offset\n"
"\t .execname display a common_pid as a program name\n"
- "\t .syscall display a syscall id as a syscall name\n\n"
- "\t .log2 display log2 value rather than raw number\n\n"
+ "\t .syscall display a syscall id as a syscall name\n"
+ "\t .log2 display log2 value rather than raw number\n"
+ "\t .usecs display a $common_timestamp in microseconds\n\n"
"\t The 'pause' parameter can be used to pause an existing hist\n"
"\t trigger or to start a hist trigger but not log any events\n"
"\t until told to do so. 'continue' can be used to start or\n"
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -289,6 +289,8 @@ extern void trace_array_put(struct trace

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:53 +0200
Subject: [PATCH 15/36] hrtimer: Make the remote enqueue check unconditional
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer_cpu_base.expires_next is used to cache the next event armed in the
timer hardware. The value is used to check whether an hrtimer can be
@ -22,6 +22,7 @@ hrtimer_cpu_base.expires_next yet. This will be changed with later patches
which further reduce the #ifdef zoo in this code.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 6 +++---

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:52 -0500
Subject: [PATCH 21/42] tracing: Add variable support to hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:54 -0600
Subject: [PATCH 15/37] tracing: Add variable support to hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add support for saving the value of a current event's event field by
assigning it to a variable that can be read by a subsequent event.
@ -12,23 +12,23 @@ to any event field.
Both keys and values can be saved and retrieved in this way:
# echo 'hist:keys=next_pid:vals=$ts0:ts0=common_timestamp ...
# echo 'hist:keys=next_pid:vals=$ts0:ts0=$common_timestamp ...
# echo 'hist:timer_pid=common_pid:key=$timer_pid ...'
If a variable isn't a key variable or prefixed with 'vals=', the
associated event field will be saved in a variable but won't be summed
as a value:
# echo 'hist:keys=next_pid:ts1=common_timestamp:...
# echo 'hist:keys=next_pid:ts1=$common_timestamp:...
Multiple variables can be assigned at the same time:
# echo 'hist:keys=pid:vals=$ts0,$b,field2:ts0=common_timestamp,b=field1 ...
# echo 'hist:keys=pid:vals=$ts0,$b,field2:ts0=$common_timestamp,b=field1 ...
Multiple (or single) variables can also be assigned at the same time
using separate assignments:
# echo 'hist:keys=pid:vals=$ts0:ts0=common_timestamp:b=field1:c=field2 ...
# echo 'hist:keys=pid:vals=$ts0:ts0=$common_timestamp:b=field1:c=field2 ...
Variables set as above can be used by being referenced from another
event, as described in a subsequent patch.
@ -37,8 +37,8 @@ Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 374 ++++++++++++++++++++++++++++++++++-----
1 file changed, 334 insertions(+), 40 deletions(-)
kernel/trace/trace_events_hist.c | 372 ++++++++++++++++++++++++++++++++++-----
1 file changed, 332 insertions(+), 40 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -64,12 +64,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static u64 hist_field_none(struct hist_field *field, void *event,
@@ -138,6 +146,14 @@ enum hist_field_flags {
@@ -138,6 +146,13 @@ enum hist_field_flags {
HIST_FIELD_FL_LOG2 = 1 << 9,
HIST_FIELD_FL_TIMESTAMP = 1 << 10,
HIST_FIELD_FL_TIMESTAMP_USECS = 1 << 11,
+ HIST_FIELD_FL_VAR = 1 << 12,
+ HIST_FIELD_FL_VAR_ONLY = 1 << 13,
+};
+
+struct var_defs {
@ -79,7 +78,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
struct hist_trigger_attrs {
@@ -150,13 +166,20 @@ struct hist_trigger_attrs {
@@ -150,13 +165,19 @@ struct hist_trigger_attrs {
bool clear;
bool ts_in_usecs;
unsigned int map_bits;
@ -97,11 +96,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
unsigned int n_keys;
unsigned int n_fields;
+ unsigned int n_vars;
+ unsigned int n_var_only;
unsigned int key_size;
struct tracing_map_sort_key sort_keys[TRACING_MAP_SORT_KEYS_MAX];
unsigned int n_sort_keys;
@@ -164,6 +187,7 @@ struct hist_trigger_data {
@@ -164,6 +185,7 @@ struct hist_trigger_data {
struct hist_trigger_attrs *attrs;
struct tracing_map *map;
bool enable_timestamps;
@ -109,7 +107,56 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static u64 hist_field_timestamp(struct hist_field *hist_field, void *event,
@@ -262,9 +286,14 @@ static int parse_map_size(char *str)
@@ -180,6 +202,48 @@ static u64 hist_field_timestamp(struct h
return ts;
}
+static struct hist_field *find_var_field(struct hist_trigger_data *hist_data,
+ const char *var_name)
+{
+ struct hist_field *hist_field, *found = NULL;
+ int i;
+
+ for_each_hist_field(i, hist_data) {
+ hist_field = hist_data->fields[i];
+ if (hist_field && hist_field->flags & HIST_FIELD_FL_VAR &&
+ strcmp(hist_field->var.name, var_name) == 0) {
+ found = hist_field;
+ break;
+ }
+ }
+
+ return found;
+}
+
+static struct hist_field *find_var(struct hist_trigger_data *hist_data,
+ struct trace_event_file *file,
+ const char *var_name)
+{
+ struct hist_trigger_data *test_data;
+ struct event_trigger_data *test;
+ struct hist_field *hist_field;
+
+ hist_field = find_var_field(hist_data, var_name);
+ if (hist_field)
+ return hist_field;
+
+ list_for_each_entry_rcu(test, &file->triggers, list) {
+ if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
+ test_data = test->private_data;
+ hist_field = find_var_field(test_data, var_name);
+ if (hist_field)
+ return hist_field;
+ }
+ }
+
+ return NULL;
+}
+
static const char *hist_field_name(struct hist_field *field,
unsigned int level)
{
@@ -262,9 +326,14 @@ static int parse_map_size(char *str)
static void destroy_hist_trigger_attrs(struct hist_trigger_attrs *attrs)
{
@ -124,7 +171,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(attrs->name);
kfree(attrs->sort_key_str);
kfree(attrs->keys_str);
@@ -311,8 +340,22 @@ static int parse_assignment(char *str, s
@@ -311,8 +380,22 @@ static int parse_assignment(char *str, s
goto out;
}
attrs->map_bits = map_bits;
@ -149,7 +196,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
out:
return ret;
}
@@ -428,12 +471,15 @@ static void destroy_hist_field(struct hi
@@ -428,12 +511,15 @@ static void destroy_hist_field(struct hi
for (i = 0; i < HIST_FIELD_OPERANDS_MAX; i++)
destroy_hist_field(hist_field->operands[i], level + 1);
@ -166,7 +213,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
{
struct hist_field *hist_field;
@@ -459,7 +505,7 @@ static struct hist_field *create_hist_fi
@@ -459,7 +545,7 @@ static struct hist_field *create_hist_fi
if (flags & HIST_FIELD_FL_LOG2) {
unsigned long fl = flags & ~HIST_FIELD_FL_LOG2;
hist_field->fn = hist_field_log2;
@ -175,7 +222,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
hist_field->size = hist_field->operands[0]->size;
goto out;
}
@@ -494,14 +540,23 @@ static struct hist_field *create_hist_fi
@@ -494,14 +580,23 @@ static struct hist_field *create_hist_fi
hist_field->field = field;
hist_field->flags = flags;
@ -200,7 +247,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (hist_data->fields[i]) {
destroy_hist_field(hist_data->fields[i], 0);
hist_data->fields[i] = NULL;
@@ -512,11 +567,12 @@ static void destroy_hist_fields(struct h
@@ -512,11 +607,12 @@ static void destroy_hist_fields(struct h
static int create_hitcount_val(struct hist_trigger_data *hist_data)
{
hist_data->fields[HITCOUNT_IDX] =
@ -214,7 +261,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX))
return -EINVAL;
@@ -524,19 +580,53 @@ static int create_hitcount_val(struct hi
@@ -524,19 +620,16 @@ static int create_hitcount_val(struct hi
return 0;
}
@ -222,43 +269,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
- unsigned int val_idx,
- struct trace_event_file *file,
- char *field_str)
+static struct hist_field *find_var_field(struct hist_trigger_data *hist_data,
+ const char *var_name)
+{
+ struct hist_field *hist_field, *found = NULL;
+ int i;
+
+ for_each_hist_field(i, hist_data) {
+ hist_field = hist_data->fields[i];
+ if (hist_field && hist_field->flags & HIST_FIELD_FL_VAR &&
+ strcmp(hist_field->var.name, var_name) == 0) {
+ found = hist_field;
+ break;
+ }
+ }
+
+ return found;
+}
+
+static struct hist_field *find_var(struct trace_event_file *file,
+ const char *var_name)
+{
+ struct hist_trigger_data *hist_data;
+ struct event_trigger_data *test;
+ struct hist_field *hist_field;
+
+ list_for_each_entry_rcu(test, &file->triggers, list) {
+ if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
+ hist_data = test->private_data;
+ hist_field = find_var_field(hist_data, var_name);
+ if (hist_field)
+ return hist_field;
+ }
+ }
+
+ return NULL;
+}
+
+static int __create_val_field(struct hist_trigger_data *hist_data,
+ unsigned int val_idx,
+ struct trace_event_file *file,
@ -276,7 +286,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
field_name = strsep(&field_str, ".");
if (field_str) {
if (strcmp(field_str, "hex") == 0)
@@ -558,25 +648,65 @@ static int create_val_field(struct hist_
@@ -558,25 +651,58 @@ static int create_val_field(struct hist_
}
}
@ -291,9 +301,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ ++hist_data->n_fields;
- if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX))
+ if (hist_data->fields[val_idx]->flags & HIST_FIELD_FL_VAR_ONLY)
+ hist_data->n_var_only++;
+
+ if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX + TRACING_MAP_VARS_MAX))
ret = -EINVAL;
out:
@ -320,18 +327,14 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ if (WARN_ON(val_idx >= TRACING_MAP_VALS_MAX + TRACING_MAP_VARS_MAX))
+ return -EINVAL;
+
+ if (find_var(file, var_name) && !hist_data->remove) {
+ if (find_var(hist_data, file, var_name) && !hist_data->remove) {
+ return -EINVAL;
+ }
+
+ flags |= HIST_FIELD_FL_VAR;
+ hist_data->n_vars++;
+ if (hist_data->n_vars > TRACING_MAP_VARS_MAX) {
+ if (WARN_ON(hist_data->n_vars > TRACING_MAP_VARS_MAX))
+ return -EINVAL;
+ }
+
+ flags |= HIST_FIELD_FL_VAR_ONLY;
+
+ return __create_val_field(hist_data, val_idx, file, var_name, expr_str, flags);
+}
@ -345,7 +348,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
int ret;
ret = create_hitcount_val(hist_data);
@@ -596,12 +726,15 @@ static int create_val_fields(struct hist
@@ -596,12 +722,15 @@ static int create_val_fields(struct hist
field_str = strsep(&fields_str, ",");
if (!field_str)
break;
@ -361,7 +364,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (fields_str && (strcmp(fields_str, "hitcount") != 0))
ret = -EINVAL;
out:
@@ -615,11 +748,12 @@ static int create_key_field(struct hist_
@@ -615,11 +744,12 @@ static int create_key_field(struct hist_
char *field_str)
{
struct ftrace_event_field *field = NULL;
@ -375,7 +378,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return -EINVAL;
flags |= HIST_FIELD_FL_KEY;
@@ -627,6 +761,7 @@ static int create_key_field(struct hist_
@@ -627,6 +757,7 @@ static int create_key_field(struct hist_
if (strcmp(field_str, "stacktrace") == 0) {
flags |= HIST_FIELD_FL_STACKTRACE;
key_size = sizeof(unsigned long) * HIST_STACKTRACE_DEPTH;
@ -383,7 +386,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
} else {
char *field_name = strsep(&field_str, ".");
@@ -672,7 +807,7 @@ static int create_key_field(struct hist_
@@ -672,7 +803,7 @@ static int create_key_field(struct hist_
}
}
@ -392,7 +395,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (!hist_data->fields[key_idx]) {
ret = -ENOMEM;
goto out;
@@ -688,6 +823,7 @@ static int create_key_field(struct hist_
@@ -688,6 +819,7 @@ static int create_key_field(struct hist_
}
hist_data->n_keys++;
@ -400,7 +403,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (WARN_ON(hist_data->n_keys > TRACING_MAP_KEYS_MAX))
return -EINVAL;
@@ -731,21 +867,108 @@ static int create_key_fields(struct hist
@@ -731,21 +863,111 @@ static int create_key_fields(struct hist
return ret;
}
@ -455,6 +458,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ goto free;
+ }
+
+ if (n_vars == TRACING_MAP_VARS_MAX) {
+ ret = -EINVAL;
+ goto free;
+ }
+
+ s = kstrdup(var_name, GFP_KERNEL);
+ if (!s) {
+ ret = -ENOMEM;
@ -464,15 +472,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ s = kstrdup(field_str, GFP_KERNEL);
+ if (!s) {
+ kfree(hist_data->attrs->var_defs.name[n_vars]);
+ ret = -ENOMEM;
+ goto free;
+ }
+ hist_data->attrs->var_defs.expr[n_vars++] = s;
+
+ hist_data->attrs->var_defs.n_vars = n_vars;
+
+ if (n_vars == TRACING_MAP_VARS_MAX)
+ goto free;
+ }
+ }
+
@ -511,7 +517,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return ret;
}
@@ -768,7 +991,7 @@ static int create_sort_keys(struct hist_
@@ -768,7 +990,7 @@ static int create_sort_keys(struct hist_
char *fields_str = hist_data->attrs->sort_key_str;
struct tracing_map_sort_key *sort_key;
int descending, ret = 0;
@ -520,7 +526,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
hist_data->n_sort_keys = 1; /* we always have at least one, hitcount */
@@ -816,12 +1039,19 @@ static int create_sort_keys(struct hist_
@@ -816,12 +1038,19 @@ static int create_sort_keys(struct hist_
continue;
}
@ -529,7 +535,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ unsigned int idx;
+
hist_field = hist_data->fields[j];
+ if (hist_field->flags & HIST_FIELD_FL_VAR_ONLY)
+ if (hist_field->flags & HIST_FIELD_FL_VAR)
+ continue;
+
+ idx = k++;
@ -542,7 +548,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
descending = is_descending(field_str);
if (descending < 0) {
ret = descending;
@@ -836,6 +1066,7 @@ static int create_sort_keys(struct hist_
@@ -836,6 +1065,7 @@ static int create_sort_keys(struct hist_
break;
}
}
@ -550,7 +556,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
hist_data->n_sort_keys = i;
out:
return ret;
@@ -876,12 +1107,19 @@ static int create_tracing_map_fields(str
@@ -876,12 +1106,19 @@ static int create_tracing_map_fields(str
idx = tracing_map_add_key_field(map,
hist_field->offset,
cmp_fn);
@ -572,7 +578,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
return 0;
@@ -905,7 +1143,8 @@ static bool need_tracing_map_ops(struct
@@ -905,7 +1142,8 @@ static bool need_tracing_map_ops(struct
static struct hist_trigger_data *
create_hist_data(unsigned int map_bits,
struct hist_trigger_attrs *attrs,
@ -582,7 +588,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
{
const struct tracing_map_ops *map_ops = NULL;
struct hist_trigger_data *hist_data;
@@ -916,6 +1155,7 @@ create_hist_data(unsigned int map_bits,
@@ -916,6 +1154,7 @@ create_hist_data(unsigned int map_bits,
return ERR_PTR(-ENOMEM);
hist_data->attrs = attrs;
@ -590,7 +596,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = create_hist_fields(hist_data, file);
if (ret)
@@ -962,14 +1202,29 @@ static void hist_trigger_elt_update(stru
@@ -962,14 +1201,28 @@ static void hist_trigger_elt_update(stru
struct ring_buffer_event *rbe)
{
struct hist_field *hist_field;
@ -605,8 +611,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ if (hist_field->flags & HIST_FIELD_FL_VAR) {
+ var_idx = hist_field->var.idx;
+ tracing_map_set_var(elt, var_idx, hist_val);
+ if (hist_field->flags & HIST_FIELD_FL_VAR_ONLY)
+ continue;
+ continue;
+ }
tracing_map_update_sum(elt, i, hist_val);
}
@ -622,7 +627,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static inline void add_to_key(char *compound_key, void *key,
@@ -1144,6 +1399,9 @@ hist_trigger_entry_print(struct seq_file
@@ -1144,6 +1397,9 @@ hist_trigger_entry_print(struct seq_file
for (i = 1; i < hist_data->n_vals; i++) {
field_name = hist_field_name(hist_data->fields[i], 0);
@ -632,7 +637,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (hist_data->fields[i]->flags & HIST_FIELD_FL_HEX) {
seq_printf(m, " %s: %10llx", field_name,
tracing_map_read_sum(elt, i));
@@ -1267,6 +1525,9 @@ static void hist_field_print(struct seq_
@@ -1267,6 +1523,9 @@ static void hist_field_print(struct seq_
{
const char *field_name = hist_field_name(hist_field, 0);
@ -642,17 +647,17 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP)
seq_puts(m, "$common_timestamp");
else if (field_name)
@@ -1285,7 +1546,8 @@ static int event_hist_trigger_print(stru
@@ -1285,7 +1544,8 @@ static int event_hist_trigger_print(stru
struct event_trigger_data *data)
{
struct hist_trigger_data *hist_data = data->private_data;
- struct hist_field *key_field;
+ bool have_var_only = false;
+ struct hist_field *field;
+ bool have_var = false;
unsigned int i;
seq_puts(m, "hist:");
@@ -1296,25 +1558,47 @@ static int event_hist_trigger_print(stru
@@ -1296,25 +1556,47 @@ static int event_hist_trigger_print(stru
seq_puts(m, "keys=");
for_each_hist_key_field(i, hist_data) {
@ -674,8 +679,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
for_each_hist_val_field(i, hist_data) {
+ field = hist_data->fields[i];
+ if (field->flags & HIST_FIELD_FL_VAR_ONLY) {
+ have_var_only = true;
+ if (field->flags & HIST_FIELD_FL_VAR) {
+ have_var = true;
+ continue;
+ }
+
@ -688,7 +693,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ }
+ }
+
+ if (have_var_only) {
+ if (have_var) {
+ unsigned int n = 0;
+
+ seq_puts(m, ":");
@ -696,7 +701,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ for_each_hist_val_field(i, hist_data) {
+ field = hist_data->fields[i];
+
+ if (field->flags & HIST_FIELD_FL_VAR_ONLY) {
+ if (field->flags & HIST_FIELD_FL_VAR) {
+ if (n++)
+ seq_puts(m, ",");
+ hist_field_print(m, field);
@ -704,32 +709,32 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
}
@@ -1322,7 +1606,10 @@ static int event_hist_trigger_print(stru
@@ -1322,7 +1604,10 @@ static int event_hist_trigger_print(stru
for (i = 0; i < hist_data->n_sort_keys; i++) {
struct tracing_map_sort_key *sort_key;
- unsigned int idx;
+ unsigned int idx, first_key_idx;
+
+ /* skip VAR_ONLY vals */
+ first_key_idx = hist_data->n_vals - hist_data->n_var_only;
+ /* skip VAR vals */
+ first_key_idx = hist_data->n_vals - hist_data->n_vars;
sort_key = &hist_data->sort_keys[i];
idx = sort_key->field_idx;
@@ -1335,8 +1622,11 @@ static int event_hist_trigger_print(stru
@@ -1335,8 +1620,11 @@ static int event_hist_trigger_print(stru
if (idx == HITCOUNT_IDX)
seq_puts(m, "hitcount");
- else
+ else {
+ if (idx >= first_key_idx)
+ idx += hist_data->n_var_only;
+ idx += hist_data->n_vars;
hist_field_print(m, hist_data->fields[idx]);
+ }
if (sort_key->descending)
seq_puts(m, ".descending");
@@ -1633,7 +1923,7 @@ static void hist_unregister_trigger(char
@@ -1633,7 +1921,7 @@ static void hist_unregister_trigger(char
test->ops->free(test->ops, test);
if (hist_data->enable_timestamps) {
@ -738,7 +743,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
tracing_set_time_stamp_abs(file->tr, false);
}
}
@@ -1662,12 +1952,16 @@ static int event_hist_trigger_func(struc
@@ -1666,12 +1954,16 @@ static int event_hist_trigger_func(struc
struct hist_trigger_attrs *attrs;
struct event_trigger_ops *trigger_ops;
struct hist_trigger_data *hist_data;
@ -755,7 +760,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/* separate the trigger from the filter (k:v [if filter]) */
trigger = strsep(&param, " \t");
if (!trigger)
@@ -1680,7 +1974,7 @@ static int event_hist_trigger_func(struc
@@ -1684,7 +1976,7 @@ static int event_hist_trigger_func(struc
if (attrs->map_bits)
hist_trigger_bits = attrs->map_bits;
@ -764,7 +769,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (IS_ERR(hist_data)) {
destroy_hist_trigger_attrs(attrs);
return PTR_ERR(hist_data);
@@ -1709,7 +2003,7 @@ static int event_hist_trigger_func(struc
@@ -1713,7 +2005,7 @@ static int event_hist_trigger_func(struc
goto out_free;
}

View File

@ -2,7 +2,7 @@ From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:54 +0200
Subject: [PATCH 16/36] hrtimer: Make hrtimer_cpu_base.next_timer handling
unconditional
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer_cpu_base.next_timer stores the pointer to the next expiring timer
in a cpu base.
@ -24,6 +24,7 @@ marginal as it's just a store on an already dirtied cacheline.
No functional change.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 4 ++--
@ -64,8 +65,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -442,14 +442,6 @@ static inline void debug_deactivate(stru
}
@@ -459,21 +459,13 @@ static struct hrtimer_clock_base *
while ((base = __next_base((cpu_base), &(active))))
#if defined(CONFIG_NO_HZ_COMMON) || defined(CONFIG_HIGH_RES_TIMERS)
-static inline void hrtimer_update_next_timer(struct hrtimer_cpu_base *cpu_base,
@ -76,10 +77,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-#endif
-}
-
static struct hrtimer_clock_base *
__next_base(struct hrtimer_cpu_base *cpu_base, unsigned int *active)
static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
{
@@ -473,7 +465,7 @@ static ktime_t __hrtimer_get_next_event(
struct hrtimer_clock_base *base;
unsigned int active = cpu_base->active_bases;
ktime_t expires, expires_next = KTIME_MAX;

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:53 -0500
Subject: [PATCH 22/42] tracing: Account for variables in named trigger
Date: Fri, 17 Nov 2017 14:32:55 -0600
Subject: [PATCH 16/37] tracing: Account for variables in named trigger
compatibility
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Named triggers must also have the same set of variables in order to be
considered compatible - update the trigger match test to account for
@ -19,7 +19,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1614,7 +1614,7 @@ static int event_hist_trigger_print(stru
@@ -1612,7 +1612,7 @@ static int event_hist_trigger_print(stru
sort_key = &hist_data->sort_keys[i];
idx = sort_key->field_idx;
@ -28,7 +28,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return -EINVAL;
if (i > 0)
@@ -1802,6 +1802,11 @@ static bool hist_trigger_match(struct ev
@@ -1800,6 +1800,11 @@ static bool hist_trigger_match(struct ev
return false;
if (key_field->is_signed != key_field_test->is_signed)
return false;

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:55 +0200
Subject: [PATCH 17/36] hrtimer: Make hrtimer_reprogramm() unconditional
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer_reprogram() needs to be available unconditionally for softirq based
hrtimers. Move the function and all required struct members out of the
@ -13,6 +13,7 @@ increases the text size for the CONFIG_HIGH_RES_TIMERS=n case, but avoids
replication of that code for the upcoming softirq based hrtimers support.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 6 +-

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:54 -0500
Subject: [PATCH 23/42] tracing: Move get_hist_field_flags()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:56 -0600
Subject: [PATCH 17/37] tracing: Move get_hist_field_flags()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Move get_hist_field_flags() to make it more easily accessible for new
code (and keep the move separate from new functionality).
@ -14,7 +14,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -457,6 +457,28 @@ static const struct tracing_map_ops hist
@@ -497,6 +497,28 @@ static const struct tracing_map_ops hist
.elt_init = hist_trigger_elt_comm_init,
};
@ -43,7 +43,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void destroy_hist_field(struct hist_field *hist_field,
unsigned int level)
{
@@ -1499,28 +1521,6 @@ const struct file_operations event_hist_
@@ -1497,28 +1519,6 @@ const struct file_operations event_hist_
.release = single_release,
};

View File

@ -1,22 +1,24 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:56 +0200
Subject: [PATCH 18/36] hrtimer: Reduce conditional code and make
hrtimer_force_reprogramm() unconditional
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Subject: [PATCH 18/36] hrtimer: Make hrtimer_force_reprogramm()
unconditionally available
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer_force_reprogram() needs to be available unconditionally for softirq
based hrtimers. Move the function and all required struct members out of
the CONFIG_HIGH_RES_TIMERS #ifdef.
There is no functional change because hrtimer_force_reprogram() is
only invoked when hrtimer_cpu_base.hres_active is true and
CONFIG_HIGH_RES_TIMERS=y. Making it unconditional increases the text
size for the CONFIG_HIGH_RES_TIMERS=n case slightly, but avoids
replication of that code for the upcoming softirq based hrtimers
support. Most of the code gets eliminated in the
CONFIG_HIGH_RES_TIMERS=n case by the compiler.
There is no functional change because hrtimer_force_reprogram() is only
invoked when hrtimer_cpu_base.hres_active is true and
CONFIG_HIGH_RES_TIMERS=y.
Making it unconditional increases the text size for the
CONFIG_HIGH_RES_TIMERS=n case slightly, but avoids replication of that code
for the upcoming softirq based hrtimers support. Most of the code gets
eliminated in the CONFIG_HIGH_RES_TIMERS=n case by the compiler.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 58 ++++++++++++++++++++++++--------------------------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:55 -0500
Subject: [PATCH 24/42] tracing: Add simple expression support to hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:57 -0600
Subject: [PATCH 18/37] tracing: Add simple expression support to hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add support for simple addition, subtraction, and unary expressions
(-(expr) and expr, where expr = b-a, a+b, a+b+c) to hist triggers, in
@ -17,8 +17,8 @@ parsing.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 514 +++++++++++++++++++++++++++++++++------
1 file changed, 440 insertions(+), 74 deletions(-)
kernel/trace/trace_events_hist.c | 513 +++++++++++++++++++++++++++++++++------
1 file changed, 440 insertions(+), 73 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -87,15 +87,15 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
#define DEFINE_HIST_FIELD_FN(type) \
static u64 hist_field_##type(struct hist_field *hist_field, \
void *event, \
@@ -148,6 +192,7 @@ enum hist_field_flags {
@@ -147,6 +191,7 @@ enum hist_field_flags {
HIST_FIELD_FL_TIMESTAMP = 1 << 10,
HIST_FIELD_FL_TIMESTAMP_USECS = 1 << 11,
HIST_FIELD_FL_VAR = 1 << 12,
HIST_FIELD_FL_VAR_ONLY = 1 << 13,
+ HIST_FIELD_FL_EXPR = 1 << 14,
+ HIST_FIELD_FL_EXPR = 1 << 13,
};
struct var_defs {
@@ -218,6 +263,8 @@ static const char *hist_field_name(struc
@@ -258,6 +303,8 @@ static const char *hist_field_name(struc
field_name = hist_field_name(field->operands[0], ++level);
else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
field_name = "$common_timestamp";
@ -104,7 +104,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (field_name == NULL)
field_name = "";
@@ -479,6 +526,93 @@ static const char *get_hist_field_flags(
@@ -519,6 +566,93 @@ static const char *get_hist_field_flags(
return flags_str;
}
@ -198,7 +198,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void destroy_hist_field(struct hist_field *hist_field,
unsigned int level)
{
@@ -494,6 +628,7 @@ static void destroy_hist_field(struct hi
@@ -534,6 +668,7 @@ static void destroy_hist_field(struct hi
destroy_hist_field(hist_field->operands[i], level + 1);
kfree(hist_field->var.name);
@ -206,7 +206,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(hist_field);
}
@@ -514,6 +649,9 @@ static struct hist_field *create_hist_fi
@@ -554,6 +689,9 @@ static struct hist_field *create_hist_fi
hist_field->hist_data = hist_data;
@ -216,19 +216,28 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (flags & HIST_FIELD_FL_HITCOUNT) {
hist_field->fn = hist_field_counter;
goto out;
@@ -586,6 +724,289 @@ static void destroy_hist_fields(struct h
@@ -626,59 +764,323 @@ static void destroy_hist_fields(struct h
}
}
-static int create_hitcount_val(struct hist_trigger_data *hist_data)
+static char *field_name_from_var(struct hist_trigger_data *hist_data,
+ char *var_name)
+{
{
- hist_data->fields[HITCOUNT_IDX] =
- create_hist_field(hist_data, NULL, HIST_FIELD_FL_HITCOUNT, NULL);
- if (!hist_data->fields[HITCOUNT_IDX])
- return -ENOMEM;
+ char *name, *field;
+ unsigned int i;
+
- hist_data->n_vals++;
- hist_data->n_fields++;
+ for (i = 0; i < hist_data->attrs->var_defs.n_vars; i++) {
+ name = hist_data->attrs->var_defs.name[i];
+
- if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX))
- return -EINVAL;
+ if (strcmp(var_name, name) == 0) {
+ field = hist_data->attrs->var_defs.expr[i];
+ if (contains_operator(field))
@ -236,10 +245,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return field;
+ }
+ }
+
- return 0;
+ return NULL;
+}
+
}
-static int __create_val_field(struct hist_trigger_data *hist_data,
- unsigned int val_idx,
- struct trace_event_file *file,
- char *var_name, char *field_str,
- unsigned long flags)
+static char *local_field_var_ref(struct hist_trigger_data *hist_data,
+ char *var_name)
+{
@ -251,10 +266,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+static struct ftrace_event_field *
+parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
+ char *field_str, unsigned long *flags)
+{
+ struct ftrace_event_field *field = NULL;
{
struct ftrace_event_field *field = NULL;
- char *field_name;
- int ret = 0;
+ char *field_name, *modifier, *str;
+
- field_name = strsep(&field_str, ".");
- if (field_str) {
- if (strcmp(field_str, "hex") == 0)
- flags |= HIST_FIELD_FL_HEX;
+ modifier = str = kstrdup(field_str, GFP_KERNEL);
+ if (!modifier)
+ return ERR_PTR(-ENOMEM);
@ -276,24 +297,27 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ *flags |= HIST_FIELD_FL_LOG2;
+ else if (strcmp(modifier, "usecs") == 0)
+ *flags |= HIST_FIELD_FL_TIMESTAMP_USECS;
+ else {
else {
- ret = -EINVAL;
+ field = ERR_PTR(-EINVAL);
+ goto out;
+ }
+ }
+
+ if (strcmp(field_name, "$common_timestamp") == 0) {
goto out;
}
}
if (strcmp(field_name, "$common_timestamp") == 0) {
- flags |= HIST_FIELD_FL_TIMESTAMP;
+ *flags |= HIST_FIELD_FL_TIMESTAMP;
+ hist_data->enable_timestamps = true;
hist_data->enable_timestamps = true;
+ if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS)
+ hist_data->attrs->ts_in_usecs = true;
+ } else {
+ field = trace_find_event_field(file->event_call, field_name);
+ if (!field || !field->size) {
} else {
field = trace_find_event_field(file->event_call, field_name);
if (!field || !field->size) {
- ret = -EINVAL;
+ field = ERR_PTR(-EINVAL);
+ goto out;
+ }
+ }
goto out;
}
}
+ out:
+ kfree(str);
+
@ -318,13 +342,15 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ ret = PTR_ERR(field);
+ goto out;
+ }
+
- hist_data->fields[val_idx] = create_hist_field(hist_data, field, flags, var_name);
- if (!hist_data->fields[val_idx]) {
+ hist_field = create_hist_field(hist_data, field, *flags, var_name);
+ if (!hist_field) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
ret = -ENOMEM;
goto out;
}
+ return hist_field;
+ out:
+ return ERR_PTR(ret);
@ -397,6 +423,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ return expr;
+ free:
+ destroy_hist_field(expr, 0);
+ return ERR_PTR(ret);
+}
+
@ -503,59 +530,43 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return ERR_PTR(ret);
+}
+
static int create_hitcount_val(struct hist_trigger_data *hist_data)
{
hist_data->fields[HITCOUNT_IDX] =
@@ -645,41 +1066,21 @@ static int __create_val_field(struct his
char *var_name, char *field_str,
unsigned long flags)
{
- struct ftrace_event_field *field = NULL;
- char *field_name;
+static int create_hitcount_val(struct hist_trigger_data *hist_data)
+{
+ hist_data->fields[HITCOUNT_IDX] =
+ create_hist_field(hist_data, NULL, HIST_FIELD_FL_HITCOUNT, NULL);
+ if (!hist_data->fields[HITCOUNT_IDX])
+ return -ENOMEM;
+
+ hist_data->n_vals++;
+ hist_data->n_fields++;
+
+ if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX))
+ return -EINVAL;
+
+ return 0;
+}
+
+static int __create_val_field(struct hist_trigger_data *hist_data,
+ unsigned int val_idx,
+ struct trace_event_file *file,
+ char *var_name, char *field_str,
+ unsigned long flags)
+{
+ struct hist_field *hist_field;
int ret = 0;
- field_name = strsep(&field_str, ".");
- if (field_str) {
- if (strcmp(field_str, "hex") == 0)
- flags |= HIST_FIELD_FL_HEX;
- else {
- ret = -EINVAL;
- goto out;
- }
- }
-
- if (strcmp(field_name, "$common_timestamp") == 0) {
- flags |= HIST_FIELD_FL_TIMESTAMP;
- hist_data->enable_timestamps = true;
- } else {
- field = trace_find_event_field(file->event_call, field_name);
- if (!field || !field->size) {
- ret = -EINVAL;
- goto out;
- }
- }
-
- hist_data->fields[val_idx] = create_hist_field(hist_data, field, flags, var_name);
- if (!hist_data->fields[val_idx]) {
- ret = -ENOMEM;
+ int ret = 0;
+
+ hist_field = parse_expr(hist_data, file, field_str, flags, var_name, 0);
+ if (IS_ERR(hist_field)) {
+ ret = PTR_ERR(hist_field);
goto out;
}
+ goto out;
+ }
+
+ hist_data->fields[val_idx] = hist_field;
+
++hist_data->n_vals;
++hist_data->n_fields;
- if (hist_data->fields[val_idx]->flags & HIST_FIELD_FL_VAR_ONLY)
+ if (hist_field->flags & HIST_FIELD_FL_VAR_ONLY)
hist_data->n_var_only++;
if (WARN_ON(hist_data->n_vals > TRACING_MAP_VALS_MAX + TRACING_MAP_VARS_MAX))
@@ -769,8 +1170,8 @@ static int create_key_field(struct hist_
@@ -765,8 +1167,8 @@ static int create_key_field(struct hist_
struct trace_event_file *file,
char *field_str)
{
@ -565,7 +576,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
unsigned long flags = 0;
unsigned int key_size;
int ret = 0;
@@ -785,60 +1186,24 @@ static int create_key_field(struct hist_
@@ -781,60 +1183,24 @@ static int create_key_field(struct hist_
key_size = sizeof(unsigned long) * HIST_STACKTRACE_DEPTH;
hist_field = create_hist_field(hist_data, NULL, flags, NULL);
} else {
@ -635,7 +646,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (hist_data->key_size > HIST_KEY_SIZE_MAX) {
ret = -EINVAL;
goto out;
@@ -1421,7 +1786,8 @@ hist_trigger_entry_print(struct seq_file
@@ -1419,7 +1785,8 @@ hist_trigger_entry_print(struct seq_file
for (i = 1; i < hist_data->n_vals; i++) {
field_name = hist_field_name(hist_data->fields[i], 0);

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:57 +0200
Subject: [PATCH 19/36] hrtimer: Unify handling of hrtimer remove
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
When the first hrtimer on the current CPU is removed,
hrtimer_force_reprogram() is invoked but only when
@ -35,6 +35,7 @@ except the effective reprogramming part, which gets eliminated by the
compiler in the CONFIG_HIGH_RES_TIMERS=n case.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 10 ++++------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:56 -0500
Subject: [PATCH 25/42] tracing: Generalize per-element hist trigger data
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:32:58 -0600
Subject: [PATCH 19/37] tracing: Generalize per-element hist trigger data
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Up until now, hist triggers only needed per-element support for saving
'comm' data, which was saved directly as a private data pointer.
@ -13,13 +13,13 @@ new hist_elt_data struct for the purpose, and switch the current
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 71 ++++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 33 deletions(-)
kernel/trace/trace_events_hist.c | 76 ++++++++++++++++++++++-----------------
1 file changed, 43 insertions(+), 33 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -249,6 +249,10 @@ static u64 hist_field_timestamp(struct h
return ts;
@@ -289,6 +289,10 @@ static struct hist_field *find_var(struc
return NULL;
}
+struct hist_elt_data {
@ -29,7 +29,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static const char *hist_field_name(struct hist_field *field,
unsigned int level)
{
@@ -463,45 +467,61 @@ static inline void save_comm(char *comm,
@@ -503,45 +507,61 @@ static inline void save_comm(char *comm,
memcpy(comm, task->comm, TASK_COMM_LEN);
}
@ -138,13 +138,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
hist_data->map = tracing_map_create(map_bits, hist_data->key_size,
map_ops, hist_data);
@@ -1742,7 +1746,8 @@ hist_trigger_entry_print(struct seq_file
@@ -1741,7 +1745,13 @@ hist_trigger_entry_print(struct seq_file
seq_printf(m, "%s: [%llx] %-55s", field_name,
uval, str);
} else if (key_field->flags & HIST_FIELD_FL_EXECNAME) {
- char *comm = elt->private_data;
+ struct hist_elt_data *elt_data = elt->private_data;
+ char *comm = elt_data->comm;
+ char *comm;
+
+ if (WARN_ON_ONCE(!elt_data))
+ return;
+
+ comm = elt_data->comm;
uval = *(u64 *)(key + key_field->offset);
seq_printf(m, "%s: %-16s[%10llu]", field_name,

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:58 +0200
Subject: [PATCH 20/36] hrtimer: Unify handling of remote enqueue
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer_reprogram() is conditionally invoked from hrtimer_start_range_ns()
when hrtimer_cpu_base.hres_active is true.
@ -43,13 +43,17 @@ To unify this the following changes are required:
3) Remove the remote wakeup special case for the !high_res && nohz_active
case.
Confine the timers_nohz_active static key to timer.c which is the only user
now.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 18 ++++++------------
kernel/time/tick-internal.h | 11 -----------
kernel/time/timer.c | 15 ++++++++++++++-
3 files changed, 20 insertions(+), 24 deletions(-)
kernel/time/tick-internal.h | 6 ------
kernel/time/timer.c | 9 ++++++++-
3 files changed, 14 insertions(+), 19 deletions(-)
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@ -100,28 +104,22 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -151,12 +151,6 @@ static inline void tick_nohz_init(void)
@@ -151,18 +151,12 @@ static inline void tick_nohz_init(void)
#ifdef CONFIG_NO_HZ_COMMON
extern unsigned long tick_nohz_active;
extern void timers_update_nohz(void);
-extern struct static_key_false timers_nohz_active;
-
-static inline bool is_timers_nohz_active(void)
-{
- return static_branch_unlikely(&timers_nohz_active);
-}
#ifdef CONFIG_SMP
# ifdef CONFIG_SMP
extern struct static_key_false timers_migration_enabled;
@@ -164,11 +158,6 @@ extern struct static_key_false timers_mi
#else
# endif
#else /* CONFIG_NO_HZ_COMMON */
static inline void timers_update_nohz(void) { }
#define tick_nohz_active (0)
-
-static inline bool is_timers_nohz_active(void)
-{
- return false;
-}
-static inline bool is_timers_nohz_active(void) { return false; }
#endif
DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);
@ -136,7 +134,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static DEFINE_MUTEX(timer_keys_mutex);
static void timer_update_keys(struct work_struct *work);
@@ -260,6 +260,19 @@ int timer_migration_handler(struct ctl_t
@@ -260,6 +260,13 @@ int timer_migration_handler(struct ctl_t
mutex_unlock(&timer_keys_mutex);
return ret;
}
@ -145,14 +143,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+{
+ return static_branch_unlikely(&timers_nohz_active);
+}
+
+#else
+
+static inline bool is_timers_nohz_active(void)
+{
+ return false;
+}
+
+static inline bool is_timers_nohz_active(void) { return false; }
#endif /* NO_HZ_COMMON */
static unsigned long round_jiffies_common(unsigned long j, int cpu,

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:57 -0500
Subject: [PATCH 26/42] tracing: Pass tracing_map_elt to hist_field accessor
Date: Fri, 17 Nov 2017 14:32:59 -0600
Subject: [PATCH 20/37] tracing: Pass tracing_map_elt to hist_field accessor
functions
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Some accessor functions, such as for variable references, require
access to a corrsponding tracing_map_elt.
@ -169,7 +169,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
{ \
type *addr = (type *)(event + hist_field->field->offset); \
\
@@ -235,8 +256,10 @@ struct hist_trigger_data {
@@ -233,8 +254,10 @@ struct hist_trigger_data {
bool remove;
};
@ -191,7 +191,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (hist_field->flags & HIST_FIELD_FL_VAR) {
var_idx = hist_field->var.idx;
tracing_map_set_var(elt, var_idx, hist_val);
@@ -1611,7 +1634,7 @@ static void hist_trigger_elt_update(stru
@@ -1610,7 +1633,7 @@ static void hist_trigger_elt_update(stru
for_each_hist_key_field(i, hist_data) {
hist_field = hist_data->fields[i];
if (hist_field->flags & HIST_FIELD_FL_VAR) {
@ -200,7 +200,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
var_idx = hist_field->var.idx;
tracing_map_set_var(elt, var_idx, hist_val);
}
@@ -1649,9 +1672,9 @@ static void event_hist_trigger(struct ev
@@ -1648,9 +1671,9 @@ static void event_hist_trigger(struct ev
bool use_compound_key = (hist_data->n_keys > 1);
unsigned long entries[HIST_STACKTRACE_DEPTH];
char compound_key[HIST_KEY_SIZE_MAX];
@ -211,7 +211,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
u64 field_contents;
void *key = NULL;
unsigned int i;
@@ -1672,7 +1695,7 @@ static void event_hist_trigger(struct ev
@@ -1671,7 +1694,7 @@ static void event_hist_trigger(struct ev
key = entries;
} else {

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:39:59 +0200
Subject: [PATCH 21/36] hrtimer: Make remote enqueue decision less restrictive
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The current decision whether a timer can be queued on a remote CPU checks
for timer->expiry <= remote_cpu_base.expires_next.
@ -14,6 +14,7 @@ So its safe to allow enqueuing timers with the same expiry time as the
first expiring timer on a remote CPU base.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 2 +-

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:58 -0500
Subject: [PATCH 27/42] tracing: Add hist_field 'type' field
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:00 -0600
Subject: [PATCH 21/37] tracing: Add hist_field 'type' field
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Future support for synthetic events requires hist_field 'type'
information, so add a field for that.
@ -25,7 +25,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
struct hist_field *operands[HIST_FIELD_OPERANDS_MAX];
struct hist_trigger_data *hist_data;
struct hist_var var;
@@ -672,6 +673,7 @@ static void destroy_hist_field(struct hi
@@ -712,6 +713,7 @@ static void destroy_hist_field(struct hi
kfree(hist_field->var.name);
kfree(hist_field->name);
@ -33,7 +33,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(hist_field);
}
@@ -697,6 +699,10 @@ static struct hist_field *create_hist_fi
@@ -737,6 +739,10 @@ static struct hist_field *create_hist_fi
if (flags & HIST_FIELD_FL_HITCOUNT) {
hist_field->fn = hist_field_counter;
@ -44,7 +44,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
goto out;
}
@@ -710,12 +716,18 @@ static struct hist_field *create_hist_fi
@@ -750,12 +756,18 @@ static struct hist_field *create_hist_fi
hist_field->fn = hist_field_log2;
hist_field->operands[0] = create_hist_field(hist_data, field, fl, NULL);
hist_field->size = hist_field->operands[0]->size;
@ -63,7 +63,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
goto out;
}
@@ -725,6 +737,11 @@ static struct hist_field *create_hist_fi
@@ -765,6 +777,11 @@ static struct hist_field *create_hist_fi
if (is_string_field(field)) {
flags |= HIST_FIELD_FL_STRING;
@ -75,7 +75,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (field->filter_type == FILTER_STATIC_STRING)
hist_field->fn = hist_field_string;
else if (field->filter_type == FILTER_DYN_STRING)
@@ -732,6 +749,12 @@ static struct hist_field *create_hist_fi
@@ -772,6 +789,12 @@ static struct hist_field *create_hist_fi
else
hist_field->fn = hist_field_pstring;
} else {
@ -88,7 +88,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
hist_field->fn = select_value_fn(field->size,
field->is_signed);
if (!hist_field->fn) {
@@ -941,6 +964,11 @@ static struct hist_field *parse_unary(st
@@ -981,6 +1004,11 @@ static struct hist_field *parse_unary(st
expr->operands[0] = operand1;
expr->operator = FIELD_OP_UNARY_MINUS;
expr->name = expr_str(expr, 0);
@ -100,7 +100,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return expr;
free:
@@ -1029,6 +1057,11 @@ static struct hist_field *parse_expr(str
@@ -1070,6 +1098,11 @@ static struct hist_field *parse_expr(str
expr->operands[1] = operand2;
expr->operator = field_op;
expr->name = expr_str(expr, 0);

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:00 +0200
Subject: [PATCH 22/36] hrtimer: Remove base argument from hrtimer_reprogram()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer_reprogram() must have access to the hrtimer_clock_base of the new
first expiring timer to access hrtimer_clock_base.offset for adjusting the
@ -19,6 +19,7 @@ Instead of handing in timer and timer->base as an argument remove the base
argument from hrtimer_reprogram() and retrieve the clock base internally.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 6 +++---

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 14:59:59 -0500
Subject: [PATCH 28/42] tracing: Add variable reference handling to hist
Date: Fri, 17 Nov 2017 14:33:01 -0600
Subject: [PATCH 22/37] tracing: Add variable reference handling to hist
triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add the necessary infrastructure to allow the variables defined on one
event to be referenced in another. This allows variables set by a
@ -11,8 +11,8 @@ variable values saved by that previous event and the event fields of
the current event. For example, here's how a latency can be
calculated and saved into yet another variable named 'wakeup_lat':
# echo 'hist:keys=pid,prio:ts0=common_timestamp ...
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ...
# echo 'hist:keys=pid,prio:ts0=$common_timestamp ...
# echo 'hist:keys=next_pid:wakeup_lat=$common_timestamp-$ts0 ...
In the first event, the event's timetamp is saved into the variable
ts0. In the next line, ts0 is subtracted from the second event's
@ -27,13 +27,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace.c | 2
kernel/trace/trace.h | 3
kernel/trace/trace_events_hist.c | 613 ++++++++++++++++++++++++++++++++----
kernel/trace/trace_events_hist.c | 632 ++++++++++++++++++++++++++++++++++--
kernel/trace/trace_events_trigger.c | 6
4 files changed, 568 insertions(+), 56 deletions(-)
4 files changed, 623 insertions(+), 20 deletions(-)
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7766,6 +7766,7 @@ static int instance_mkdir(const char *na
@@ -7804,6 +7804,7 @@ static int instance_mkdir(const char *na
INIT_LIST_HEAD(&tr->systems);
INIT_LIST_HEAD(&tr->events);
@ -41,7 +41,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (allocate_trace_buffers(tr, trace_buf_size) < 0)
goto out_free_tr;
@@ -8513,6 +8514,7 @@ ssize_t trace_parse_run_command(struct f
@@ -8554,6 +8555,7 @@ ssize_t trace_parse_run_command(struct f
INIT_LIST_HEAD(&global_trace.systems);
INIT_LIST_HEAD(&global_trace.events);
@ -70,9 +70,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
extern int register_trigger_hist_enable_disable_cmds(void);
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -60,6 +60,9 @@ struct hist_field {
@@ -59,7 +59,12 @@ struct hist_field {
struct hist_trigger_data *hist_data;
struct hist_var var;
enum field_op_id operator;
+ char *system;
+ char *event_name;
char *name;
+ unsigned int var_idx;
+ unsigned int var_ref_idx;
@ -80,15 +83,15 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static u64 hist_field_none(struct hist_field *field,
@@ -215,6 +218,7 @@ enum hist_field_flags {
@@ -214,6 +219,7 @@ enum hist_field_flags {
HIST_FIELD_FL_TIMESTAMP_USECS = 1 << 11,
HIST_FIELD_FL_VAR = 1 << 12,
HIST_FIELD_FL_VAR_ONLY = 1 << 13,
HIST_FIELD_FL_EXPR = 1 << 14,
+ HIST_FIELD_FL_VAR_REF = 1 << 15,
HIST_FIELD_FL_EXPR = 1 << 13,
+ HIST_FIELD_FL_VAR_REF = 1 << 14,
};
struct var_defs {
@@ -255,6 +259,8 @@ struct hist_trigger_data {
@@ -253,6 +259,8 @@ struct hist_trigger_data {
struct tracing_map *map;
bool enable_timestamps;
bool remove;
@ -97,7 +100,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static u64 hist_field_timestamp(struct hist_field *hist_field,
@@ -273,10 +279,344 @@ static u64 hist_field_timestamp(struct h
@@ -271,6 +279,216 @@ static u64 hist_field_timestamp(struct h
return ts;
}
@ -106,9 +109,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ struct hist_trigger_data *hist_data;
+};
+
+static struct hist_field *check_var_ref(struct hist_field *hist_field,
+ struct hist_trigger_data *var_data,
+ unsigned int var_idx)
+static struct hist_field *
+check_field_for_var_ref(struct hist_field *hist_field,
+ struct hist_trigger_data *var_data,
+ unsigned int var_idx)
+{
+ struct hist_field *found = NULL;
+
@ -122,27 +126,52 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return found;
+}
+
+static struct hist_field *
+check_field_for_var_refs(struct hist_trigger_data *hist_data,
+ struct hist_field *hist_field,
+ struct hist_trigger_data *var_data,
+ unsigned int var_idx,
+ unsigned int level)
+{
+ struct hist_field *found = NULL;
+ unsigned int i;
+
+ if (level > 2)
+ return found;
+
+ if (!hist_field)
+ return found;
+
+ found = check_field_for_var_ref(hist_field, var_data, var_idx);
+ if (found)
+ return found;
+
+ for (i = 0; i < HIST_FIELD_OPERANDS_MAX; i++) {
+ struct hist_field *operand;
+
+ operand = hist_field->operands[i];
+ found = check_field_for_var_refs(hist_data, operand, var_data,
+ var_idx, level + 1);
+ if (found)
+ return found;
+ }
+
+ return found;
+}
+
+static struct hist_field *find_var_ref(struct hist_trigger_data *hist_data,
+ struct hist_trigger_data *var_data,
+ unsigned int var_idx)
+{
+ struct hist_field *hist_field, *found = NULL;
+ unsigned int i, j;
+ unsigned int i;
+
+ for_each_hist_field(i, hist_data) {
+ hist_field = hist_data->fields[i];
+ found = check_var_ref(hist_field, var_data, var_idx);
+ found = check_field_for_var_refs(hist_data, hist_field,
+ var_data, var_idx, 0);
+ if (found)
+ return found;
+
+ for (j = 0; j < HIST_FIELD_OPERANDS_MAX; j++) {
+ struct hist_field *operand;
+
+ operand = hist_field->operands[j];
+ found = check_var_ref(operand, var_data, var_idx);
+ if (found)
+ return found;
+ }
+ }
+
+ return found;
@ -155,6 +184,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ struct hist_field *found = NULL;
+ struct hist_var_data *var_data;
+
+ found = find_var_ref(hist_data, hist_data, var_idx);
+ if (found)
+ return found;
+
+ list_for_each_entry(var_data, &tr->hist_vars, list) {
+ found = find_var_ref(var_data->hist_data, hist_data, var_idx);
+ if (found)
@ -198,27 +231,41 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return found;
+}
+
+static bool field_has_hist_vars(struct hist_field *hist_field,
+ unsigned int level)
+{
+ int i;
+
+ if (level > 2)
+ return false;
+
+ if (!hist_field)
+ return false;
+
+ if (hist_field->flags & HIST_FIELD_FL_VAR ||
+ hist_field->flags & HIST_FIELD_FL_VAR_REF)
+ return true;
+
+ for (i = 0; i < HIST_FIELD_OPERANDS_MAX; i++) {
+ struct hist_field *operand;
+
+ operand = hist_field->operands[i];
+ if (field_has_hist_vars(operand, level + 1))
+ return true;
+ }
+
+ return false;
+}
+
+static bool has_hist_vars(struct hist_trigger_data *hist_data)
+{
+ struct hist_field *hist_field;
+ int i, j;
+ int i;
+
+ for_each_hist_field(i, hist_data) {
+ hist_field = hist_data->fields[i];
+ if (hist_field &&
+ (hist_field->flags & HIST_FIELD_FL_VAR ||
+ hist_field->flags & HIST_FIELD_FL_VAR_REF))
+ if (field_has_hist_vars(hist_field, 0))
+ return true;
+
+ for (j = 0; j < HIST_FIELD_OPERANDS_MAX; j++) {
+ struct hist_field *operand;
+
+ operand = hist_field->operands[j];
+ if (operand &&
+ (operand->flags & HIST_FIELD_FL_VAR ||
+ operand->flags & HIST_FIELD_FL_VAR_REF))
+ return true;
+ }
+ }
+
+ return false;
@ -267,52 +314,22 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ trace_array_put(tr);
+}
+
+static struct hist_field *find_var_field(struct hist_trigger_data *hist_data,
+ const char *var_name)
+{
+ struct hist_field *hist_field, *found = NULL;
+ int i;
+
+ for_each_hist_field(i, hist_data) {
+ hist_field = hist_data->fields[i];
+ if (hist_field && hist_field->flags & HIST_FIELD_FL_VAR &&
+ strcmp(hist_field->var.name, var_name) == 0) {
+ found = hist_field;
+ break;
+ }
+ }
+
+ return found;
+}
+
+static struct hist_field *find_var(struct trace_event_file *file,
+ const char *var_name)
+{
+ struct hist_trigger_data *hist_data;
+ struct event_trigger_data *test;
+ struct hist_field *hist_field;
+
+ list_for_each_entry_rcu(test, &file->triggers, list) {
+ if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
+ hist_data = test->private_data;
+ hist_field = find_var_field(hist_data, var_name);
+ if (hist_field)
+ return hist_field;
+ }
+ }
+
+ return NULL;
+}
+
static struct hist_field *find_var_field(struct hist_trigger_data *hist_data,
const char *var_name)
{
@@ -313,10 +531,148 @@ static struct hist_field *find_var(struc
return NULL;
}
+static struct trace_event_file *find_var_file(struct trace_array *tr,
+ const char *system,
+ const char *event_name,
+ const char *var_name)
+ char *system,
+ char *event_name,
+ char *var_name)
+{
+ struct hist_trigger_data *var_hist_data;
+ struct hist_var_data *var_data;
+ struct trace_event_call *call;
+ struct trace_event_file *file;
+ struct trace_event_file *file, *found = NULL;
+ const char *name;
+
+ list_for_each_entry(var_data, &tr->hist_vars, list) {
@ -322,8 +339,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ name = trace_event_name(call);
+
+ if (!system || !event_name) {
+ if (find_var(file, var_name))
+ return file;
+ if (find_var(var_hist_data, file, var_name)) {
+ if (found) {
+ return NULL;
+ }
+
+ found = file;
+ }
+ continue;
+ }
+
@ -332,10 +354,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ if (strcmp(system, call->class->system) != 0)
+ continue;
+
+ return file;
+ found = file;
+ break;
+ }
+
+ return NULL;
+ return found;
+}
+
+static struct hist_field *find_file_var(struct trace_event_file *file,
@ -357,11 +380,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return NULL;
+}
+
+static struct hist_field *find_event_var(struct trace_array *tr,
+ const char *system,
+ const char *event_name,
+ const char *var_name)
+static struct hist_field *find_event_var(struct hist_trigger_data *hist_data,
+ char *system,
+ char *event_name,
+ char *var_name)
+{
+ struct trace_array *tr = hist_data->event_file->tr;
+ struct hist_field *hist_field = NULL;
+ struct trace_event_file *file;
+
@ -442,17 +466,30 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static const char *hist_field_name(struct hist_field *field,
unsigned int level)
{
@@ -291,7 +631,8 @@ static const char *hist_field_name(struc
@@ -331,8 +687,20 @@ static const char *hist_field_name(struc
field_name = hist_field_name(field->operands[0], ++level);
else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
field_name = "$common_timestamp";
- else if (field->flags & HIST_FIELD_FL_EXPR)
- field_name = field->name;
+ else if (field->flags & HIST_FIELD_FL_EXPR ||
+ field->flags & HIST_FIELD_FL_VAR_REF)
field_name = field->name;
+ field->flags & HIST_FIELD_FL_VAR_REF) {
+ if (field->system) {
+ static char full_name[MAX_FILTER_STR_VAL];
+
+ strcat(full_name, field->system);
+ strcat(full_name, ".");
+ strcat(full_name, field->event_name);
+ strcat(full_name, ".");
+ strcat(full_name, field->name);
+ field_name = full_name;
+ } else
+ field_name = field->name;
+ }
if (field_name == NULL)
@@ -596,6 +937,8 @@ static char *expr_str(struct hist_field
field_name = "";
@@ -636,6 +1004,8 @@ static char *expr_str(struct hist_field
return expr;
}
@ -461,7 +498,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
strcat(expr, hist_field_name(field->operands[0], 0));
if (field->operands[0]->flags) {
const char *flags_str = get_hist_field_flags(field->operands[0]);
@@ -618,6 +961,8 @@ static char *expr_str(struct hist_field
@@ -658,6 +1028,8 @@ static char *expr_str(struct hist_field
return NULL;
}
@ -470,7 +507,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
strcat(expr, hist_field_name(field->operands[1], 0));
if (field->operands[1]->flags) {
const char *flags_str = get_hist_field_flags(field->operands[1]);
@@ -697,6 +1042,11 @@ static struct hist_field *create_hist_fi
@@ -737,6 +1109,11 @@ static struct hist_field *create_hist_fi
if (flags & HIST_FIELD_FL_EXPR)
goto out; /* caller will populate */
@ -482,39 +519,65 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (flags & HIST_FIELD_FL_HITCOUNT) {
hist_field->fn = hist_field_counter;
hist_field->size = sizeof(u64);
@@ -790,6 +1140,51 @@ static void destroy_hist_fields(struct h
@@ -830,6 +1207,77 @@ static void destroy_hist_fields(struct h
}
}
+static int init_var_ref(struct hist_field *ref_field,
+ struct hist_field *var_field)
+ struct hist_field *var_field,
+ char *system, char *event_name)
+{
+ int err = 0;
+
+ ref_field->var.idx = var_field->var.idx;
+ ref_field->var.hist_data = var_field->hist_data;
+ ref_field->size = var_field->size;
+ ref_field->is_signed = var_field->is_signed;
+
+ if (system) {
+ ref_field->system = kstrdup(system, GFP_KERNEL);
+ if (!ref_field->system)
+ return -ENOMEM;
+ }
+
+ if (event_name) {
+ ref_field->event_name = kstrdup(event_name, GFP_KERNEL);
+ if (!ref_field->event_name) {
+ err = -ENOMEM;
+ goto free;
+ }
+ }
+
+ ref_field->name = kstrdup(var_field->var.name, GFP_KERNEL);
+ if (!ref_field->name)
+ return -ENOMEM;
+ if (!ref_field->name) {
+ err = -ENOMEM;
+ goto free;
+ }
+
+ ref_field->type = kstrdup(var_field->type, GFP_KERNEL);
+ if (!ref_field->type) {
+ kfree(ref_field->name);
+ return -ENOMEM;
+ err = -ENOMEM;
+ goto free;
+ }
+ out:
+ return err;
+ free:
+ kfree(ref_field->system);
+ kfree(ref_field->event_name);
+ kfree(ref_field->name);
+
+ return 0;
+ goto out;
+}
+
+static struct hist_field *create_var_ref(struct hist_field *var_field)
+static struct hist_field *create_var_ref(struct hist_field *var_field,
+ char *system, char *event_name)
+{
+ unsigned long flags = HIST_FIELD_FL_VAR_REF;
+ struct hist_field *ref_field;
+
+ ref_field = create_hist_field(var_field->hist_data, NULL, flags, NULL);
+ if (ref_field) {
+ if (init_var_ref(ref_field, var_field)) {
+ if (init_var_ref(ref_field, var_field, system, event_name)) {
+ destroy_hist_field(ref_field, 0);
+ return NULL;
+ }
@ -534,7 +597,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static char *field_name_from_var(struct hist_trigger_data *hist_data,
char *var_name)
{
@@ -801,7 +1196,7 @@ static char *field_name_from_var(struct
@@ -841,7 +1289,7 @@ static char *field_name_from_var(struct
if (strcmp(var_name, name) == 0) {
field = hist_data->attrs->var_defs.expr[i];
@ -543,7 +606,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
continue;
return field;
}
@@ -813,11 +1208,32 @@ static char *field_name_from_var(struct
@@ -853,11 +1301,32 @@ static char *field_name_from_var(struct
static char *local_field_var_ref(struct hist_trigger_data *hist_data,
char *var_name)
{
@ -555,7 +618,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return field_name_from_var(hist_data, var_name);
}
+static struct hist_field *parse_var_ref(struct trace_array *tr,
+static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data,
+ char *system, char *event_name,
+ char *var_name)
+{
@ -566,9 +629,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ var_name++;
+
+ var_field = find_event_var(tr, system, event_name, var_name);
+ var_field = find_event_var(hist_data, system, event_name, var_name);
+ if (var_field)
+ ref_field = create_var_ref(var_field);
+ ref_field = create_var_ref(var_field, system, event_name);
+
+ return ref_field;
+}
@ -576,13 +639,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static struct ftrace_event_field *
parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
char *field_str, unsigned long *flags)
@@ -874,13 +1290,39 @@ struct hist_field *parse_atom(struct his
@@ -914,13 +1383,38 @@ struct hist_field *parse_atom(struct his
struct trace_event_file *file, char *str,
unsigned long *flags, char *var_name)
{
- char *s;
+ char *s, *ref_system = NULL, *ref_event = NULL, *ref_var = str;
+ struct trace_array *tr = hist_data->event_file->tr;
struct ftrace_event_field *field = NULL;
struct hist_field *hist_field = NULL;
int ret = 0;
@ -609,7 +671,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ s = local_field_var_ref(hist_data, ref_var);
+ if (!s) {
+ hist_field = parse_var_ref(tr, ref_system, ref_event, ref_var);
+ hist_field = parse_var_ref(hist_data, ref_system, ref_event, ref_var);
+ if (hist_field) {
+ hist_data->var_refs[hist_data->n_var_refs] = hist_field;
+ hist_field->var_ref_idx = hist_data->n_var_refs++;
@ -619,7 +681,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
str = s;
field = parse_field(hist_data, file, str, flags);
@@ -1053,6 +1495,9 @@ static struct hist_field *parse_expr(str
@@ -1094,6 +1588,9 @@ static struct hist_field *parse_expr(str
goto free;
}
@ -629,51 +691,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
expr->operands[0] = operand1;
expr->operands[1] = operand2;
expr->operator = field_op;
@@ -1099,43 +1544,6 @@ static int create_hitcount_val(struct hi
return 0;
}
-static struct hist_field *find_var_field(struct hist_trigger_data *hist_data,
- const char *var_name)
-{
- struct hist_field *hist_field, *found = NULL;
- int i;
-
- for_each_hist_field(i, hist_data) {
- hist_field = hist_data->fields[i];
- if (hist_field && hist_field->flags & HIST_FIELD_FL_VAR &&
- strcmp(hist_field->var.name, var_name) == 0) {
- found = hist_field;
- break;
- }
- }
-
- return found;
-}
-
-static struct hist_field *find_var(struct trace_event_file *file,
- const char *var_name)
-{
- struct hist_trigger_data *hist_data;
- struct event_trigger_data *test;
- struct hist_field *hist_field;
-
- list_for_each_entry_rcu(test, &file->triggers, list) {
- if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
- hist_data = test->private_data;
- hist_field = find_var_field(hist_data, var_name);
- if (hist_field)
- return hist_field;
- }
- }
-
- return NULL;
-}
-
static int __create_val_field(struct hist_trigger_data *hist_data,
unsigned int val_idx,
struct trace_event_file *file,
@@ -1269,6 +1677,12 @@ static int create_key_field(struct hist_
@@ -1266,6 +1763,12 @@ static int create_key_field(struct hist_
goto out;
}
@ -686,7 +704,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
key_size = hist_field->size;
}
@@ -1604,6 +2018,7 @@ create_hist_data(unsigned int map_bits,
@@ -1604,6 +2107,7 @@ create_hist_data(unsigned int map_bits,
hist_data->attrs = attrs;
hist_data->remove = remove;
@ -694,7 +712,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = create_hist_fields(hist_data, file);
if (ret)
@@ -1626,12 +2041,6 @@ create_hist_data(unsigned int map_bits,
@@ -1626,12 +2130,6 @@ create_hist_data(unsigned int map_bits,
ret = create_tracing_map_fields(hist_data);
if (ret)
goto free;
@ -707,7 +725,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
out:
return hist_data;
free:
@@ -1646,12 +2055,17 @@ create_hist_data(unsigned int map_bits,
@@ -1646,12 +2144,17 @@ create_hist_data(unsigned int map_bits,
static void hist_trigger_elt_update(struct hist_trigger_data *hist_data,
struct tracing_map_elt *elt, void *rec,
@ -726,7 +744,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
for_each_hist_val_field(i, hist_data) {
hist_field = hist_data->fields[i];
hist_val = hist_field->fn(hist_field, elt, rbe, rec);
@@ -1704,6 +2118,7 @@ static void event_hist_trigger(struct ev
@@ -1703,6 +2206,7 @@ static void event_hist_trigger(struct ev
struct hist_trigger_data *hist_data = data->private_data;
bool use_compound_key = (hist_data->n_keys > 1);
unsigned long entries[HIST_STACKTRACE_DEPTH];
@ -734,7 +752,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
char compound_key[HIST_KEY_SIZE_MAX];
struct tracing_map_elt *elt = NULL;
struct stack_trace stacktrace;
@@ -1743,9 +2158,15 @@ static void event_hist_trigger(struct ev
@@ -1742,9 +2246,15 @@ static void event_hist_trigger(struct ev
if (use_compound_key)
key = compound_key;
@ -752,17 +770,20 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static void hist_trigger_stacktrace_print(struct seq_file *m,
@@ -1848,7 +2269,8 @@ hist_trigger_entry_print(struct seq_file
field_name = hist_field_name(hist_data->fields[i], 0);
@@ -1961,8 +2471,11 @@ static void hist_field_print(struct seq_
if (hist_data->fields[i]->flags & HIST_FIELD_FL_VAR ||
- hist_data->fields[i]->flags & HIST_FIELD_FL_EXPR)
+ hist_data->fields[i]->flags & HIST_FIELD_FL_EXPR ||
+ hist_data->fields[i]->flags & HIST_FIELD_FL_VAR_REF)
continue;
if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP)
seq_puts(m, "$common_timestamp");
- else if (field_name)
+ else if (field_name) {
+ if (hist_field->flags & HIST_FIELD_FL_VAR_REF)
+ seq_putc(m, '$');
seq_printf(m, "%s", field_name);
+ }
if (hist_data->fields[i]->flags & HIST_FIELD_FL_HEX) {
@@ -2098,7 +2520,11 @@ static void event_hist_trigger_free(stru
if (hist_field->flags) {
const char *flags_str = get_hist_field_flags(hist_field);
@@ -2102,7 +2615,11 @@ static void event_hist_trigger_free(stru
if (!data->ref) {
if (data->name)
del_named_trigger(data);
@ -774,7 +795,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
destroy_hist_data(hist_data);
}
}
@@ -2311,23 +2737,55 @@ static int hist_register_trigger(char *g
@@ -2315,23 +2832,55 @@ static int hist_register_trigger(char *g
goto out;
}
@ -794,7 +815,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+{
+ int ret = 0;
+
+ list_add_rcu(&data->list, &file->triggers);
+ list_add_tail_rcu(&data->list, &file->triggers);
+
+ update_cond_flag(file);
@ -834,7 +855,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void hist_unregister_trigger(char *glob, struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file)
@@ -2360,10 +2818,29 @@ static void hist_unregister_trigger(char
@@ -2364,11 +2913,30 @@ static void hist_unregister_trigger(char
}
}
@ -857,14 +878,15 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void hist_unreg_all(struct trace_event_file *file)
{
struct event_trigger_data *test, *n;
struct hist_trigger_data *hist_data;
+ if (hist_file_check_refs(file))
+ return;
+
list_for_each_entry_safe(test, n, &file->triggers, list) {
if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
list_del_rcu(&test->list);
@@ -2436,6 +2913,11 @@ static int event_hist_trigger_func(struc
hist_data = test->private_data;
@@ -2444,6 +3012,11 @@ static int event_hist_trigger_func(struc
}
if (remove) {
@ -876,7 +898,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
ret = 0;
goto out_free;
@@ -2453,14 +2935,33 @@ static int event_hist_trigger_func(struc
@@ -2461,14 +3034,33 @@ static int event_hist_trigger_func(struc
goto out_free;
} else if (ret < 0)
goto out_free;

View File

@ -1,12 +1,13 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:01 +0200
Subject: [PATCH 23/36] hrtimer: Split hrtimer_start_range_ns()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Preparatory patch for softirq based hrtimers to avoid code duplication. No
functional change.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 44 ++++++++++++++++++++++++--------------------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:00 -0500
Subject: [PATCH 29/42] tracing: Add hist trigger action hook
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:02 -0600
Subject: [PATCH 23/37] tracing: Add hist trigger action hook
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add a hook for executing extra actions whenever a histogram entry is
added or updated.
@ -17,8 +17,8 @@ implemented on top of it in later patches.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 91 +++++++++++++++++++++++++++++++++++++--
1 file changed, 88 insertions(+), 3 deletions(-)
kernel/trace/trace_events_hist.c | 108 +++++++++++++++++++++++++++++++++++++--
1 file changed, 105 insertions(+), 3 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -30,7 +30,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
enum field_op_id {
FIELD_OP_NONE,
@@ -241,6 +242,9 @@ struct hist_trigger_attrs {
@@ -242,6 +243,9 @@ struct hist_trigger_attrs {
char *assignment_str[TRACING_MAP_VARS_MAX];
unsigned int n_assignments;
@ -62,7 +62,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static u64 hist_field_timestamp(struct hist_field *hist_field,
@@ -710,6 +729,9 @@ static void destroy_hist_trigger_attrs(s
@@ -777,6 +796,9 @@ static void destroy_hist_trigger_attrs(s
for (i = 0; i < attrs->n_assignments; i++)
kfree(attrs->assignment_str[i]);
@ -72,7 +72,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(attrs->name);
kfree(attrs->sort_key_str);
kfree(attrs->keys_str);
@@ -717,6 +739,16 @@ static void destroy_hist_trigger_attrs(s
@@ -784,6 +806,16 @@ static void destroy_hist_trigger_attrs(s
kfree(attrs);
}
@ -89,7 +89,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static int parse_assignment(char *str, struct hist_trigger_attrs *attrs)
{
int ret = 0;
@@ -800,8 +832,9 @@ static struct hist_trigger_attrs *parse_
@@ -867,8 +899,9 @@ static struct hist_trigger_attrs *parse_
else if (strcmp(str, "clear") == 0)
attrs->clear = true;
else {
@ -101,7 +101,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
}
@@ -1949,11 +1982,42 @@ static int create_sort_keys(struct hist_
@@ -2038,11 +2071,55 @@ static int create_sort_keys(struct hist_
return ret;
}
@ -116,8 +116,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ }
+}
+
+static int create_actions(struct hist_trigger_data *hist_data,
+ struct trace_event_file *file)
+static int parse_actions(struct hist_trigger_data *hist_data)
+{
+ unsigned int i;
+ int ret = 0;
@ -129,6 +128,20 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ return ret;
+}
+
+static int create_actions(struct hist_trigger_data *hist_data,
+ struct trace_event_file *file)
+{
+ struct action_data *data;
+ unsigned int i;
+ int ret = 0;
+
+ for (i = 0; i < hist_data->attrs->n_actions; i++) {
+ data = hist_data->actions[i];
+ }
+
+ return ret;
+}
+
static void destroy_hist_data(struct hist_trigger_data *hist_data)
{
@ -144,7 +157,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(hist_data);
}
@@ -2112,6 +2176,20 @@ static inline void add_to_key(char *comp
@@ -2109,6 +2186,10 @@ create_hist_data(unsigned int map_bits,
hist_data->remove = remove;
hist_data->event_file = file;
+ ret = parse_actions(hist_data);
+ if (ret)
+ goto free;
+
ret = create_hist_fields(hist_data, file);
if (ret)
goto free;
@@ -2200,6 +2281,20 @@ static inline void add_to_key(char *comp
memcpy(compound_key + key_field->offset, key, size);
}
@ -165,7 +189,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void event_hist_trigger(struct event_trigger_data *data, void *rec,
struct ring_buffer_event *rbe)
{
@@ -2167,6 +2245,9 @@ static void event_hist_trigger(struct ev
@@ -2255,6 +2350,9 @@ static void event_hist_trigger(struct ev
return;
hist_trigger_elt_update(hist_data, elt, rec, rbe, var_ref_vals);
@ -175,7 +199,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static void hist_trigger_stacktrace_print(struct seq_file *m,
@@ -2942,6 +3023,10 @@ static int event_hist_trigger_func(struc
@@ -3041,6 +3139,10 @@ static int event_hist_trigger_func(struc
if (has_hist_vars(hist_data))
save_hist_vars(hist_data);
@ -186,7 +210,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = tracing_map_init(hist_data->map);
if (ret)
goto out_unreg;
@@ -2963,8 +3048,8 @@ static int event_hist_trigger_func(struc
@@ -3062,8 +3164,8 @@ static int event_hist_trigger_func(struc
remove_hist_vars(hist_data);
kfree(trigger_data);

View File

@ -1,12 +1,13 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:02 +0200
Subject: [PATCH 24/36] hrtimer: Split __hrtimer_get_next_event()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Preparatory patch for softirq based hrtimers to avoid code duplication. No
functional change.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 20 ++++++++++++++++----
@ -15,9 +16,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -459,13 +459,13 @@ static struct hrtimer_clock_base *
#define for_each_active_base(base, cpu_base, active) \
while ((base = __next_base((cpu_base), &(active))))
#if defined(CONFIG_NO_HZ_COMMON) || defined(CONFIG_HIGH_RES_TIMERS)
-static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
+static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base,
+ unsigned int active,

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:01 -0500
Subject: [PATCH 30/42] tracing: Add support for 'synthetic' events
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:03 -0600
Subject: [PATCH 24/37] tracing: Add support for 'synthetic' events
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Synthetic events are user-defined events generated from hist trigger
variables saved from one or more other events.
@ -46,10 +46,12 @@ How this can be automatically hooked up via a hist trigger 'action' is
discussed in a subsequent patch.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
[fix noderef.cocci warnings, sizeof pointer for kcalloc of event->fields]
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 865 +++++++++++++++++++++++++++++++++++++++
1 file changed, 865 insertions(+)
kernel/trace/trace_events_hist.c | 908 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 906 insertions(+), 2 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -97,7 +99,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
struct action_data;
typedef void (*action_fn_t) (struct hist_trigger_data *hist_data,
@@ -282,6 +308,800 @@ struct action_data {
@@ -282,6 +308,803 @@ struct action_data {
unsigned int var_ref_idx;
};
@ -265,7 +267,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ fmt = "%lu";
+ else if (strcmp(type, "pid_t") == 0)
+ fmt = "%d";
+ else if (strstr(type, "[") == 0)
+ else if (strchr(type, '[') != NULL)
+ fmt = "%s";
+
+ return fmt;
@ -549,7 +551,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return NULL;
+}
+
+/* This function releases synth_event_mutex */
+static int register_synth_event(struct synth_event *event)
+{
+ struct trace_event_call *call = &event->call;
@ -584,14 +585,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ call->data = event;
+ call->tp = event->tp;
+
+ /*
+ * trace_add_event_call() grabs event_mutex, but that can
+ * deadlock with a hist trigger cmd already holding it that
+ * can grab synth_event_mutex
+ */
+ mutex_unlock(&synth_event_mutex);
+ ret = trace_add_event_call(call);
+ mutex_lock(&synth_event_mutex);
+ if (ret) {
+ pr_warn("Failed to register synthetic event: %s\n",
+ trace_event_name(call));
@ -600,9 +594,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ ret = set_synth_event_print_fmt(call);
+ if (ret < 0) {
+ mutex_unlock(&synth_event_mutex);
+ trace_remove_event_call(call);
+ mutex_lock(&synth_event_mutex);
+ goto err;
+ }
+ out:
@ -612,42 +604,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ goto out;
+}
+
+/* This function releases synth_event_mutex */
+static int unregister_synth_event(struct synth_event *event)
+{
+ struct trace_event_call *call = &event->call;
+ int ret;
+
+ mutex_unlock(&synth_event_mutex);
+ ret = trace_remove_event_call(call);
+ mutex_lock(&synth_event_mutex);
+
+ return ret;
+}
+
+static int remove_synth_event(struct synth_event *event)
+{
+ int ret = unregister_synth_event(event);
+
+ if (!ret)
+ list_del(&event->list);
+
+ return ret;
+}
+
+static int add_synth_event(struct synth_event *event)
+{
+ int ret;
+
+ ret = register_synth_event(event);
+ if (ret)
+ return ret;
+
+ list_add(&event->list, &synth_event_list);
+
+ return 0;
+}
+
+static void free_synth_event(struct synth_event *event)
+{
+ unsigned int i;
@ -685,7 +651,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ goto out;
+ }
+
+ event->fields = kcalloc(n_fields, sizeof(event->fields), GFP_KERNEL);
+ event->fields = kcalloc(n_fields, sizeof(*event->fields), GFP_KERNEL);
+ if (!event->fields) {
+ free_synth_event(event);
+ event = ERR_PTR(-ENOMEM);
@ -700,7 +666,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return event;
+}
+
+/* This function releases synth_event_mutex */
+static int create_synth_event(int argc, char **argv)
+{
+ struct synth_field *field, *fields[SYNTH_FIELDS_MAX];
@ -732,20 +697,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ if (event) {
+ if (delete_event) {
+ if (event->ref) {
+ event = NULL;
+ ret = -EBUSY;
+ goto out;
+ }
+ ret = remove_synth_event(event);
+ if (!ret)
+ free_synth_event(event);
+ list_del(&event->list);
+ goto out;
+ }
+ event = NULL;
+ ret = -EEXIST;
+ goto out;
+ } else if (delete_event) {
+ ret = -EINVAL;
+ } else if (delete_event)
+ goto out;
+ }
+
+ if (argc < 2) {
+ ret = -EINVAL;
@ -780,43 +743,85 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ event = NULL;
+ goto err;
+ }
+
+ add_synth_event(event);
+ out:
+ mutex_unlock(&synth_event_mutex);
+
+ if (event) {
+ if (delete_event) {
+ ret = unregister_synth_event(event);
+ if (!ret)
+ free_synth_event(event);
+ else {
+ mutex_lock(&synth_event_mutex);
+ if (!find_synth_event(event->name))
+ list_add(&event->list, &synth_event_list);
+ mutex_unlock(&synth_event_mutex);
+ }
+ } else {
+ ret = register_synth_event(event);
+ if (!ret) {
+ mutex_lock(&synth_event_mutex);
+ if (!find_synth_event(event->name))
+ list_add(&event->list, &synth_event_list);
+ mutex_unlock(&synth_event_mutex);
+ } else
+ free_synth_event(event);
+ }
+ }
+
+ return ret;
+ err:
+ mutex_unlock(&synth_event_mutex);
+
+ for (i = 0; i < n_fields; i++)
+ free_synth_field(fields[i]);
+ free_synth_event(event);
+
+ goto out;
+ return ret;
+}
+
+/* This function releases synth_event_mutex */
+static int release_all_synth_events(void)
+{
+ struct list_head release_events;
+ struct synth_event *event, *e;
+ int ret = 0;
+ int ret = 0, err = 0;
+
+ INIT_LIST_HEAD(&release_events);
+
+ mutex_lock(&synth_event_mutex);
+
+ list_for_each_entry(event, &synth_event_list, list) {
+ if (event->ref) {
+ ret = -EBUSY;
+ goto out;
+ mutex_unlock(&synth_event_mutex);
+ return -EBUSY;
+ }
+ }
+
+ list_for_each_entry_safe(event, e, &synth_event_list, list) {
+ ret = remove_synth_event(event);
+ if (!ret)
+ free_synth_event(event);
+ list_del(&event->list);
+ list_add(&event->list, &release_events);
+ }
+ out:
+
+ mutex_unlock(&synth_event_mutex);
+
+ list_for_each_entry_safe(event, e, &release_events, list) {
+ list_del(&event->list);
+
+ ret = unregister_synth_event(event);
+ if (ret == 0)
+ free_synth_event(event);
+ else {
+ err = ret;
+ mutex_lock(&synth_event_mutex);
+ if (!find_synth_event(event->name))
+ list_add(&event->list, &synth_event_list);
+ mutex_unlock(&synth_event_mutex);
+ }
+ }
+
+ if (err)
+ ret = err;
+
+ return ret;
+}
+
@ -898,7 +903,60 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static u64 hist_field_timestamp(struct hist_field *hist_field,
struct tracing_map_elt *elt,
struct ring_buffer_event *rbe,
@@ -2942,6 +3762,8 @@ static int event_hist_trigger_func(struc
@@ -2956,6 +3779,28 @@ static int hist_trigger_enable(struct ev
return ret;
}
+static bool have_hist_trigger_match(struct event_trigger_data *data,
+ struct trace_event_file *file)
+{
+ struct hist_trigger_data *hist_data = data->private_data;
+ struct event_trigger_data *test, *named_data = NULL;
+ bool match = false;
+
+ if (hist_data->attrs->name)
+ named_data = find_named_trigger(hist_data->attrs->name);
+
+ list_for_each_entry_rcu(test, &file->triggers, list) {
+ if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
+ if (hist_trigger_match(data, test, named_data, false)) {
+ match = true;
+ break;
+ }
+ }
+ }
+
+ return match;
+}
+
static bool hist_trigger_check_refs(struct event_trigger_data *data,
struct trace_event_file *file)
{
@@ -3031,6 +3876,8 @@ static void hist_unreg_all(struct trace_
{
struct event_trigger_data *test, *n;
struct hist_trigger_data *hist_data;
+ struct synth_event *se;
+ const char *se_name;
if (hist_file_check_refs(file))
return;
@@ -3040,6 +3887,14 @@ static void hist_unreg_all(struct trace_
hist_data = test->private_data;
list_del_rcu(&test->list);
trace_event_trigger_enable_disable(file, 0);
+
+ mutex_lock(&synth_event_mutex);
+ se_name = trace_event_name(file->event_call);
+ se = find_synth_event(se_name);
+ if (se)
+ se->ref--;
+ mutex_unlock(&synth_event_mutex);
+
update_cond_flag(file);
if (test->ops->free)
test->ops->free(test->ops, test);
@@ -3058,6 +3913,8 @@ static int event_hist_trigger_func(struc
struct hist_trigger_attrs *attrs;
struct event_trigger_ops *trigger_ops;
struct hist_trigger_data *hist_data;
@ -907,7 +965,30 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
bool remove = false;
char *trigger;
int ret = 0;
@@ -3000,6 +3822,14 @@ static int event_hist_trigger_func(struc
@@ -3088,10 +3945,11 @@ static int event_hist_trigger_func(struc
trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
- ret = -ENOMEM;
trigger_data = kzalloc(sizeof(*trigger_data), GFP_KERNEL);
- if (!trigger_data)
+ if (!trigger_data) {
+ ret = -ENOMEM;
goto out_free;
+ }
trigger_data->count = -1;
trigger_data->ops = trigger_ops;
@@ -3110,12 +3968,23 @@ static int event_hist_trigger_func(struc
}
if (remove) {
+ if (!have_hist_trigger_match(trigger_data, file))
+ goto out_free;
+
if (hist_trigger_check_refs(trigger_data, file)) {
ret = -EBUSY;
goto out_free;
}
cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
@ -922,9 +1003,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = 0;
goto out_free;
}
@@ -3017,6 +3847,13 @@ static int event_hist_trigger_func(struc
} else if (ret < 0)
goto out_free;
@@ -3151,6 +4020,13 @@ static int event_hist_trigger_func(struc
if (ret)
goto out_unreg;
+ mutex_lock(&synth_event_mutex);
+ se_name = trace_event_name(file->event_call);
@ -933,10 +1014,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ se->ref++;
+ mutex_unlock(&synth_event_mutex);
+
if (get_named_trigger_data(trigger_data))
goto enable;
@@ -3207,3 +4044,31 @@ static __init void unregister_trigger_hi
/* Just return zero, not the number of registered triggers */
ret = 0;
out:
@@ -3323,3 +4199,31 @@ static __init void unregister_trigger_hi
return ret;
}

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:03 +0200
Subject: [PATCH 25/36] hrtimer: Use irqsave/irqrestore around __run_hrtimer()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
__run_hrtimer() is called with the hrtimer_cpu_base.lock held and
interrupts disabled. Before invoking the timer callback the base lock is
@ -18,6 +18,7 @@ interrupt enabled state when called from softirq context.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 31 ++++++++++++++++++-------------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:02 -0500
Subject: [PATCH 31/42] tracing: Add support for 'field variables'
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:04 -0600
Subject: [PATCH 25/37] tracing: Add support for 'field variables'
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Users should be able to directly specify event fields in hist trigger
'actions' rather than being forced to explicitly create a variable for
@ -25,7 +25,7 @@ sched_switch, and prio is a normal field on sched_waking.
Since the mechanism works on variables, those two normal fields just
have 'invisible' variables created internally for them. In the case of
'prio', which is on another event, we actually need to create an
additional hist trigger and define the invisible event on that, since
additional hist trigger and define the invisible variable on that, since
once a hist trigger is defined, variables can't be added to it later.
echo 'wakeup_latency u64 lat; pid_t pid; int prio' >>
@ -41,12 +41,12 @@ echo 'hist:keys=next_pid:wakeup_lat=$common_timestamp.usecs-$ts0:
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 450 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 449 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c | 536 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 535 insertions(+), 1 deletion(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -254,6 +254,16 @@ struct hist_trigger_attrs {
@@ -255,6 +255,16 @@ struct hist_trigger_attrs {
struct var_defs var_defs;
};
@ -78,7 +78,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
struct synth_field {
@@ -1394,6 +1412,7 @@ static struct hist_field *find_event_var
@@ -1387,6 +1405,8 @@ static struct trace_event_file *find_var
list_for_each_entry(var_data, &tr->hist_vars, list) {
var_hist_data = var_data->hist_data;
file = var_hist_data->event_file;
+ if (file == found)
+ continue;
call = file->event_call;
name = trace_event_name(call);
@@ -1453,6 +1473,7 @@ static struct hist_field *find_event_var
struct hist_elt_data {
char *comm;
u64 *var_ref_vals;
@ -86,7 +95,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static u64 hist_field_var_ref(struct hist_field *hist_field,
@@ -1687,6 +1706,11 @@ static inline void save_comm(char *comm,
@@ -1757,6 +1778,11 @@ static inline void save_comm(char *comm,
static void hist_elt_data_free(struct hist_elt_data *elt_data)
{
@ -98,7 +107,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(elt_data->comm);
kfree(elt_data);
}
@@ -1704,7 +1728,7 @@ static int hist_trigger_elt_data_alloc(s
@@ -1774,7 +1800,7 @@ static int hist_trigger_elt_data_alloc(s
unsigned int size = TASK_COMM_LEN + 1;
struct hist_elt_data *elt_data;
struct hist_field *key_field;
@ -107,7 +116,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
elt_data = kzalloc(sizeof(*elt_data), GFP_KERNEL);
if (!elt_data)
@@ -1723,6 +1747,18 @@ static int hist_trigger_elt_data_alloc(s
@@ -1793,6 +1819,18 @@ static int hist_trigger_elt_data_alloc(s
}
}
@ -126,7 +135,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
elt->private_data = elt_data;
return 0;
@@ -2381,6 +2417,387 @@ static struct hist_field *parse_expr(str
@@ -2477,6 +2515,471 @@ static struct hist_field *parse_expr(str
return ERR_PTR(ret);
}
@ -165,7 +174,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ for (n = 0; n < n_keys; n++) {
+ hist_field = hist_data->fields[i + n];
+ target_hist_field = hist_data->fields[j + n];
+ target_hist_field = target_hist_data->fields[j + n];
+
+ if (strcmp(hist_field->type, target_hist_field->type) != 0)
+ return false;
@ -213,8 +222,54 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+}
+
+static struct hist_field *
+find_synthetic_field_var(struct hist_trigger_data *target_hist_data,
+ char *system, char *event_name, char *field_name)
+{
+ struct hist_field *event_var;
+ char *synthetic_name;
+
+ synthetic_name = kzalloc(MAX_FILTER_STR_VAL, GFP_KERNEL);
+ if (!synthetic_name)
+ return ERR_PTR(-ENOMEM);
+
+ strcpy(synthetic_name, "synthetic_");
+ strcat(synthetic_name, field_name);
+
+ event_var = find_event_var(target_hist_data, system, event_name, synthetic_name);
+
+ kfree(synthetic_name);
+
+ return event_var;
+}
+
+/**
+ * create_field_var_hist - Automatically create a histogram and var for a field
+ * @target_hist_data: The target hist trigger
+ * @subsys_name: Optional subsystem name
+ * @event_name: Optional event name
+ * @field_name: The name of the field (and the resulting variable)
+ *
+ * Hist trigger actions fetch data from variables, not directly from
+ * events. However, for convenience, users are allowed to directly
+ * specify an event field in an action, which will be automatically
+ * converted into a variable on their behalf.
+
+ * If a user specifies a field on an event that isn't the event the
+ * histogram currently being defined (the target event histogram), the
+ * only way that can be accomplished is if a new hist trigger is
+ * created and the field variable defined on that.
+ *
+ * This function creates a new histogram compatible with the target
+ * event (meaning a histogram with the same key as the target
+ * histogram), and creates a variable for the specified field, but
+ * with 'synthetic_' prepended to the variable name in order to avoid
+ * collision with normal field variables.
+ *
+ * Return: The variable created for the field.
+ */
+struct hist_field *
+create_field_var_hist(struct hist_trigger_data *target_hist_data,
+ char *system, char *event_name, char *field_name)
+ char *subsys_name, char *event_name, char *field_name)
+{
+ struct trace_array *tr = target_hist_data->event_file->tr;
+ struct hist_field *event_var = ERR_PTR(-EINVAL);
@ -230,17 +285,29 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ if (target_hist_data->n_field_var_hists >= SYNTH_FIELDS_MAX)
+ return ERR_PTR(-EINVAL);
+
+ file = event_file(tr, system, event_name);
+ file = event_file(tr, subsys_name, event_name);
+
+ if (IS_ERR(file)) {
+ ret = PTR_ERR(file);
+ return ERR_PTR(ret);
+ }
+
+ /*
+ * Look for a histogram compatible with target. We'll use the
+ * found histogram specification to create a new matching
+ * histogram with our variable on it. target_hist_data is not
+ * yet a registered histogram so we can't use that.
+ */
+ hist_data = find_compatible_hist(target_hist_data, file);
+ if (!hist_data)
+ return ERR_PTR(-EINVAL);
+
+ /* See if a synthetic field variable has already been created */
+ event_var = find_synthetic_field_var(target_hist_data, subsys_name,
+ event_name, field_name);
+ if (event_var && !IS_ERR(event_var))
+ return event_var;
+
+ var_hist = kzalloc(sizeof(*var_hist), GFP_KERNEL);
+ if (!var_hist)
+ return ERR_PTR(-ENOMEM);
@ -251,6 +318,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return ERR_PTR(-ENOMEM);
+ }
+
+ /* Use the same keys as the compatible histogram */
+ strcat(cmd, "keys=");
+
+ for_each_hist_key_field(i, hist_data) {
@ -261,11 +329,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ first = false;
+ }
+
+ /* Create the synthetic field variable specification */
+ strcat(cmd, ":synthetic_");
+ strcat(cmd, field_name);
+ strcat(cmd, "=");
+ strcat(cmd, field_name);
+
+ /* Use the same filter as the compatible histogram */
+ saved_filter = find_trigger_filter(hist_data, file);
+ if (saved_filter) {
+ strcat(cmd, " if ");
@ -279,8 +349,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return ERR_PTR(-ENOMEM);
+ }
+
+ /* Save the compatible histogram information */
+ var_hist->hist_data = hist_data;
+
+ /* Create the new histogram with our variable */
+ ret = event_hist_trigger_func(&trigger_hist_cmd, file,
+ "", "hist", cmd);
+ if (ret) {
@ -290,11 +362,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return ERR_PTR(ret);
+ }
+
+ strcpy(cmd, "synthetic_");
+ strcat(cmd, field_name);
+ kfree(cmd);
+
+ event_var = find_event_var(tr, system, event_name, cmd);
+ if (!event_var) {
+ /* If we can't find the variable, something went wrong */
+ event_var = find_synthetic_field_var(target_hist_data, subsys_name,
+ event_name, field_name);
+ if (!event_var || IS_ERR(event_var)) {
+ kfree(cmd);
+ kfree(var_hist->cmd);
+ kfree(var_hist);
@ -308,14 +381,14 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return event_var;
+}
+
+static struct hist_field *
+struct hist_field *
+find_target_event_var(struct hist_trigger_data *hist_data,
+ char *system, char *event_name, char *var_name)
+ char *subsys_name, char *event_name, char *var_name)
+{
+ struct trace_event_file *file = hist_data->event_file;
+ struct hist_field *hist_field = NULL;
+
+ if (system) {
+ if (subsys_name) {
+ struct trace_event_call *call;
+
+ if (!event_name)
@ -323,7 +396,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ call = file->event_call;
+
+ if (strcmp(system, call->class->system) != 0)
+ if (strcmp(subsys_name, call->class->system) != 0)
+ return NULL;
+
+ if (strcmp(event_name, trace_event_name(call)) != 0)
@ -381,7 +454,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ struct hist_field *var;
+ int idx;
+
+ if (find_var(file, name) && !hist_data->remove) {
+ if (find_var(hist_data, file, name) && !hist_data->remove) {
+ var = ERR_PTR(-EINVAL);
+ goto out;
+ }
@ -459,13 +532,33 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ goto out;
+}
+
+static struct field_var *
+create_target_field_var(struct hist_trigger_data *hist_data,
+ char *system, char *event_name, char *var_name)
+{
+ struct trace_event_file *file = hist_data->event_file;
+/**
+ * create_target_field_var - Automatically create a variable for a field
+ * @target_hist_data: The target hist trigger
+ * @subsys_name: Optional subsystem name
+ * @event_name: Optional event name
+ * @var_name: The name of the field (and the resulting variable)
+ *
+ * Hist trigger actions fetch data from variables, not directly from
+ * events. However, for convenience, users are allowed to directly
+ * specify an event field in an action, which will be automatically
+ * converted into a variable on their behalf.
+
+ if (system) {
+ * This function creates a field variable with the name var_name on
+ * the hist trigger currently being defined on the target event. If
+ * subsys_name and event_name are specified, this function simply
+ * verifies that they do in fact match the target event subsystem and
+ * event name.
+ *
+ * Return: The variable created for the field.
+ */
+struct field_var *
+create_target_field_var(struct hist_trigger_data *target_hist_data,
+ char *subsys_name, char *event_name, char *var_name)
+{
+ struct trace_event_file *file = target_hist_data->event_file;
+
+ if (subsys_name) {
+ struct trace_event_call *call;
+
+ if (!event_name)
@ -473,14 +566,14 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ call = file->event_call;
+
+ if (strcmp(system, call->class->system) != 0)
+ if (strcmp(subsys_name, call->class->system) != 0)
+ return NULL;
+
+ if (strcmp(event_name, trace_event_name(call)) != 0)
+ return NULL;
+ }
+
+ return create_field_var(hist_data, file, var_name);
+ return create_field_var(target_hist_data, file, var_name);
+}
+
+static void destroy_field_var(struct field_var *field_var)
@ -502,8 +595,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ destroy_field_var(hist_data->field_vars[i]);
+}
+
+static void save_field_var(struct hist_trigger_data *hist_data,
+ struct field_var *field_var)
+void save_field_var(struct hist_trigger_data *hist_data,
+ struct field_var *field_var)
+{
+ hist_data->field_vars[hist_data->n_field_vars++] = field_var;
+
@ -514,7 +607,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static int create_hitcount_val(struct hist_trigger_data *hist_data)
{
hist_data->fields[HITCOUNT_IDX] =
@@ -2827,6 +3244,16 @@ static int create_actions(struct hist_tr
@@ -2932,6 +3435,16 @@ static int create_actions(struct hist_tr
return ret;
}
@ -531,7 +624,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void destroy_hist_data(struct hist_trigger_data *hist_data)
{
if (!hist_data)
@@ -2837,6 +3264,8 @@ static void destroy_hist_data(struct his
@@ -2942,6 +3455,8 @@ static void destroy_hist_data(struct his
tracing_map_destroy(hist_data->map);
destroy_actions(hist_data);
@ -540,7 +633,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(hist_data);
}
@@ -2970,6 +3399,8 @@ static void hist_trigger_elt_update(stru
@@ -3078,6 +3593,8 @@ static void hist_trigger_elt_update(stru
tracing_map_set_var(elt, var_idx, hist_val);
}
}
@ -549,7 +642,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static inline void add_to_key(char *compound_key, void *key,
@@ -3687,6 +4118,21 @@ static bool hist_trigger_check_refs(stru
@@ -3824,6 +4341,21 @@ static bool hist_trigger_check_refs(stru
return false;
}
@ -571,7 +664,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void hist_unregister_trigger(char *glob, struct event_trigger_ops *ops,
struct event_trigger_data *data,
struct trace_event_file *file)
@@ -3702,6 +4148,7 @@ static void hist_unregister_trigger(char
@@ -3839,6 +4371,7 @@ static void hist_unregister_trigger(char
if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
if (!hist_trigger_match(data, test, named_data, false))
continue;
@ -579,11 +672,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
unregistered = true;
list_del_rcu(&test->list);
trace_event_trigger_enable_disable(file, 0);
@@ -3744,6 +4191,7 @@ static void hist_unreg_all(struct trace_
@@ -3885,6 +4418,7 @@ static void hist_unreg_all(struct trace_
list_for_each_entry_safe(test, n, &file->triggers, list) {
if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) {
+ unregister_field_var_hists(test->private_data);
hist_data = test->private_data;
+ unregister_field_var_hists(hist_data);
list_del_rcu(&test->list);
trace_event_trigger_enable_disable(file, 0);
update_cond_flag(file);

View File

@ -2,7 +2,7 @@ From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:04 +0200
Subject: [PATCH 26/36] hrtimer: Add clock bases and hrtimer mode for soft irq
context
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer callback functions are always executed in hard interrupt
context. Users of hrtimer which need their timer function to be executed
@ -18,6 +18,7 @@ HRTIMER_MODE_SOFT and the matching combinations with the ABS/REL/PINNED
bits and update the decoding of hrtimer_mode in tracepoints.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 14 ++++++++++++++

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:03 -0500
Subject: [PATCH 32/42] tracing: Add 'onmatch' hist trigger action support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:05 -0600
Subject: [PATCH 26/37] tracing: Add 'onmatch' hist trigger action support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add an 'onmatch(matching.event).<synthetic_event_name>(param list)'
hist trigger action which is invoked with the set of variables or
@ -43,8 +43,8 @@ Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 406 +++++++++++++++++++++++++++++++++++++--
1 file changed, 394 insertions(+), 12 deletions(-)
kernel/trace/trace_events_hist.c | 472 +++++++++++++++++++++++++++++++++++++--
1 file changed, 459 insertions(+), 13 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -68,7 +68,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
static LIST_HEAD(synth_event_list);
@@ -925,6 +936,21 @@ static struct synth_event *alloc_synth_e
@@ -889,6 +900,21 @@ static struct synth_event *alloc_synth_e
return event;
}
@ -87,22 +87,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ struct hist_trigger_data *hist_data;
+};
+
/* This function releases synth_event_mutex */
static int create_synth_event(int argc, char **argv)
{
@@ -967,10 +993,8 @@ static int create_synth_event(int argc,
}
ret = -EEXIST;
goto out;
- } else if (delete_event) {
- ret = -EINVAL;
+ } else if (delete_event)
goto out;
- }
if (argc < 2) {
ret = -EINVAL;
@@ -1136,11 +1160,6 @@ static u64 hist_field_timestamp(struct h
struct synth_field *field, *fields[SYNTH_FIELDS_MAX];
@@ -1139,11 +1165,6 @@ static u64 hist_field_timestamp(struct h
return ts;
}
@ -111,10 +99,63 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
- struct hist_trigger_data *hist_data;
-};
-
static struct hist_field *check_var_ref(struct hist_field *hist_field,
struct hist_trigger_data *var_data,
unsigned int var_idx)
@@ -1580,11 +1599,21 @@ static void destroy_hist_trigger_attrs(s
static struct hist_field *
check_field_for_var_ref(struct hist_field *hist_field,
struct hist_trigger_data *var_data,
@@ -1452,6 +1473,37 @@ static struct hist_field *find_file_var(
return NULL;
}
+static struct hist_field *
+find_match_var(struct hist_trigger_data *hist_data, char *var_name)
+{
+ struct trace_array *tr = hist_data->event_file->tr;
+ struct hist_field *hist_field, *found = NULL;
+ struct trace_event_file *file;
+ unsigned int i;
+
+ for (i = 0; i < hist_data->n_actions; i++) {
+ struct action_data *data = hist_data->actions[i];
+
+ if (data->fn == action_trace) {
+ char *system = data->onmatch.match_event_system;
+ char *event_name = data->onmatch.match_event;
+
+ file = find_var_file(tr, system, event_name, var_name);
+ if (!file)
+ continue;
+ hist_field = find_file_var(file, var_name);
+ if (hist_field) {
+ if (found) {
+ return ERR_PTR(-EINVAL);
+ }
+
+ found = hist_field;
+ }
+ }
+ }
+ return found;
+}
+
static struct hist_field *find_event_var(struct hist_trigger_data *hist_data,
char *system,
char *event_name,
@@ -1461,6 +1513,14 @@ static struct hist_field *find_event_var
struct hist_field *hist_field = NULL;
struct trace_event_file *file;
+ if (!system || !event_name) {
+ hist_field = find_match_var(hist_data, var_name);
+ if (IS_ERR(hist_field))
+ return NULL;
+ if (hist_field)
+ return hist_field;
+ }
+
file = find_var_file(tr, system, event_name, var_name);
if (!file)
return NULL;
@@ -1652,11 +1712,21 @@ static void destroy_hist_trigger_attrs(s
static int parse_action(char *str, struct hist_trigger_attrs *attrs)
{
@ -137,17 +178,35 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return ret;
}
@@ -2452,7 +2481,7 @@ static bool compatible_keys(struct hist_
@@ -2643,7 +2713,7 @@ find_synthetic_field_var(struct hist_tri
*
* Return: The variable created for the field.
*/
-struct hist_field *
+static struct hist_field *
create_field_var_hist(struct hist_trigger_data *target_hist_data,
char *subsys_name, char *event_name, char *field_name)
{
@@ -2757,7 +2827,7 @@ create_field_var_hist(struct hist_trigge
return event_var;
}
for (n = 0; n < n_keys; n++) {
hist_field = hist_data->fields[i + n];
- target_hist_field = hist_data->fields[j + n];
+ target_hist_field = target_hist_data->fields[j + n];
if (strcmp(hist_field->type, target_hist_field->type) != 0)
return false;
@@ -2770,6 +2799,27 @@ create_target_field_var(struct hist_trig
return create_field_var(hist_data, file, var_name);
-struct hist_field *
+static struct hist_field *
find_target_event_var(struct hist_trigger_data *hist_data,
char *subsys_name, char *event_name, char *var_name)
{
@@ -2928,7 +2998,7 @@ static struct field_var *create_field_va
*
* Return: The variable created for the field.
*/
-struct field_var *
+static struct field_var *
create_target_field_var(struct hist_trigger_data *target_hist_data,
char *subsys_name, char *event_name, char *var_name)
{
@@ -2952,6 +3022,27 @@ create_target_field_var(struct hist_trig
return create_field_var(target_hist_data, file, var_name);
}
+static void onmatch_destroy(struct action_data *data)
@ -174,7 +233,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void destroy_field_var(struct field_var *field_var)
{
if (!field_var)
@@ -2798,6 +2848,283 @@ static void save_field_var(struct hist_t
@@ -2971,8 +3062,8 @@ static void destroy_field_vars(struct hi
destroy_field_var(hist_data->field_vars[i]);
}
-void save_field_var(struct hist_trigger_data *hist_data,
- struct field_var *field_var)
+static void save_field_var(struct hist_trigger_data *hist_data,
+ struct field_var *field_var)
{
hist_data->field_vars[hist_data->n_field_vars++] = field_var;
@@ -2980,6 +3071,298 @@ void save_field_var(struct hist_trigger_
hist_data->n_field_var_str++;
}
@ -250,7 +320,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+onmatch_find_var(struct hist_trigger_data *hist_data, struct action_data *data,
+ char *system, char *event, char *var)
+{
+ struct trace_array *tr = hist_data->event_file->tr;
+ struct hist_field *hist_field;
+
+ var++; /* skip '$' */
@ -262,7 +331,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ event = data->onmatch.match_event;
+ }
+
+ hist_field = find_event_var(tr, system, event, var);
+ hist_field = find_event_var(hist_data, system, event, var);
+ }
+
+ return hist_field;
@ -276,19 +345,36 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ struct hist_field *hist_field = NULL;
+ struct field_var *field_var;
+
+ /*
+ * First try to create a field var on the target event (the
+ * currently being defined). This will create a variable for
+ * unqualified fields on the target event, or if qualified,
+ * target fields that have qualified names matching the target.
+ */
+ field_var = create_target_field_var(hist_data, system, event, var);
+ if (IS_ERR(field_var))
+ goto out;
+
+ if (field_var) {
+ if (field_var && !IS_ERR(field_var)) {
+ save_field_var(hist_data, field_var);
+ hist_field = field_var->var;
+ } else {
+ field_var = NULL;
+ /*
+ * If no explicit system.event is specfied, default to
+ * looking for fields on the onmatch(system.event.xxx)
+ * event.
+ */
+ if (!system) {
+ system = data->onmatch.match_event_system;
+ event = data->onmatch.match_event;
+ }
+
+ /*
+ * At this point, we're looking at a field on another
+ * event. Because we can't modify a hist trigger on
+ * another event to add a variable for a field, we need
+ * to create a new trigger on that event and create the
+ * variable at the same time.
+ */
+ hist_field = create_field_var_hist(hist_data, system, event, var);
+ if (IS_ERR(hist_field))
+ goto free;
@ -360,7 +446,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ }
+
+ if (check_synth_field(event, hist_field, field_pos) == 0) {
+ var_ref = create_var_ref(hist_field);
+ var_ref = create_var_ref(hist_field, system, event_name);
+ if (!var_ref) {
+ kfree(p);
+ ret = -ENOMEM;
@ -386,7 +472,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ data->fn = action_trace;
+ data->onmatch.synth_event = event;
+ data->onmatch.var_ref_idx = var_ref_idx;
+ hist_data->actions[hist_data->n_actions++] = data;
+ event->ref++;
+ out:
+ return ret;
@ -458,7 +543,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static int create_hitcount_val(struct hist_trigger_data *hist_data)
{
hist_data->fields[HITCOUNT_IDX] =
@@ -3226,24 +3553,76 @@ static void destroy_actions(struct hist_
@@ -3404,18 +3787,39 @@ static void destroy_actions(struct hist_
for (i = 0; i < hist_data->n_actions; i++) {
struct action_data *data = hist_data->actions[i];
@ -470,8 +555,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
}
static int create_actions(struct hist_trigger_data *hist_data,
struct trace_event_file *file)
static int parse_actions(struct hist_trigger_data *hist_data)
{
+ struct trace_array *tr = hist_data->event_file->tr;
+ struct action_data *data;
@ -486,14 +570,29 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ char *action_str = str + strlen("onmatch(");
+
+ data = onmatch_parse(tr, action_str);
+ if (IS_ERR(data))
+ return PTR_ERR(data);
+
+ ret = onmatch_create(hist_data, file, data);
+ if (ret) {
+ onmatch_destroy(data);
+ return ret;
+ if (IS_ERR(data)) {
+ ret = PTR_ERR(data);
+ break;
+ }
+ data->fn = action_trace;
+ } else {
+ ret = -EINVAL;
+ break;
+ }
+
+ hist_data->actions[hist_data->n_actions++] = data;
}
return ret;
@@ -3430,11 +3834,50 @@ static int create_actions(struct hist_tr
for (i = 0; i < hist_data->attrs->n_actions; i++) {
data = hist_data->actions[i];
+
+ if (data->fn == action_trace) {
+ ret = onmatch_create(hist_data, file, data);
+ if (ret)
+ return ret;
+ }
}
@ -536,7 +635,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void destroy_field_var_hists(struct hist_trigger_data *hist_data)
{
unsigned int i;
@@ -3266,6 +3645,7 @@ static void destroy_hist_data(struct his
@@ -3457,6 +3900,7 @@ static void destroy_hist_data(struct his
destroy_actions(hist_data);
destroy_field_vars(hist_data);
destroy_field_var_hists(hist_data);
@ -544,7 +643,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(hist_data);
}
@@ -3814,6 +4194,8 @@ static int event_hist_trigger_print(stru
@@ -4015,6 +4459,8 @@ static int event_hist_trigger_print(stru
}
seq_printf(m, ":size=%u", (1 << hist_data->map->map_bits));

View File

@ -2,7 +2,7 @@ From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:05 +0200
Subject: [PATCH 27/36] hrtimer: Prepare handling of hard and softirq based
hrtimers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The softirq based hrtimer can utilize most of the existing hrtimers
functions, but need to operate on a different data set.
@ -12,6 +12,7 @@ can be selected. Fixup the existing callers and hand in the ACTIVE_HARD
mask.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 38 +++++++++++++++++++++++++++++---------

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:04 -0500
Subject: [PATCH 33/42] tracing: Add 'onmax' hist trigger action support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:06 -0600
Subject: [PATCH 27/37] tracing: Add 'onmax' hist trigger action support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add an 'onmax(var).save(field,...)' hist trigger action which is
invoked whenever an event exceeds the current maximum.
@ -55,8 +55,8 @@ fields:
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 332 ++++++++++++++++++++++++++++++++++-----
1 file changed, 297 insertions(+), 35 deletions(-)
kernel/trace/trace_events_hist.c | 331 ++++++++++++++++++++++++++++++++++-----
1 file changed, 296 insertions(+), 35 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@ -86,7 +86,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
};
@@ -1604,7 +1616,8 @@ static int parse_action(char *str, struc
@@ -1717,7 +1729,8 @@ static int parse_action(char *str, struc
if (attrs->n_actions >= HIST_ACTIONS_MAX)
return ret;
@ -96,7 +96,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
attrs->action_str[attrs->n_actions] = kstrdup(str, GFP_KERNEL);
if (!attrs->action_str[attrs->n_actions]) {
ret = -ENOMEM;
@@ -1776,7 +1789,7 @@ static int hist_trigger_elt_data_alloc(s
@@ -1889,7 +1902,7 @@ static int hist_trigger_elt_data_alloc(s
}
}
@ -105,7 +105,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
size = STR_VAR_LEN_MAX;
@@ -2690,6 +2703,15 @@ static void update_field_vars(struct his
@@ -2893,6 +2906,15 @@ static void update_field_vars(struct his
hist_data->n_field_vars, 0);
}
@ -121,8 +121,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static struct hist_field *create_var(struct hist_trigger_data *hist_data,
struct trace_event_file *file,
char *name, int size, const char *type)
@@ -2799,6 +2821,229 @@ create_target_field_var(struct hist_trig
return create_field_var(hist_data, file, var_name);
@@ -3022,6 +3044,227 @@ create_target_field_var(struct hist_trig
return create_field_var(target_hist_data, file, var_name);
}
+static void onmax_print(struct seq_file *m,
@ -217,7 +217,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ if (!ref_field)
+ return -ENOMEM;
+
+ if (init_var_ref(ref_field, var_field)) {
+ if (init_var_ref(ref_field, var_field, NULL, NULL)) {
+ destroy_hist_field(ref_field, 0);
+ ret = -ENOMEM;
+ goto out;
@ -255,8 +255,6 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ kfree(param);
+ }
+
+ hist_data->actions[hist_data->n_actions++] = data;
+ out:
+ return ret;
+}
@ -351,7 +349,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void onmatch_destroy(struct action_data *data)
{
unsigned int i;
@@ -2883,39 +3128,6 @@ static int check_synth_field(struct synt
@@ -3106,39 +3349,6 @@ static int check_synth_field(struct synt
return 0;
}
@ -391,7 +389,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static struct hist_field *
onmatch_find_var(struct hist_trigger_data *hist_data, struct action_data *data,
char *system, char *event, char *var)
@@ -3555,6 +3767,8 @@ static void destroy_actions(struct hist_
@@ -3789,6 +3999,8 @@ static void destroy_actions(struct hist_
if (data->fn == action_trace)
onmatch_destroy(data);
@ -400,22 +398,30 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
else
kfree(data);
}
@@ -3584,12 +3798,56 @@ static int create_actions(struct hist_tr
onmatch_destroy(data);
return ret;
@@ -3814,6 +4026,15 @@ static int parse_actions(struct hist_tri
break;
}
data->fn = action_trace;
+ } else if (strncmp(str, "onmax(", strlen("onmax(")) == 0) {
+ char *action_str = str + strlen("onmax(");
+
+ data = onmax_parse(action_str);
+ if (IS_ERR(data))
+ return PTR_ERR(data);
+
+ ret = onmax_create(hist_data, data);
+ if (ret) {
+ onmax_destroy(data);
+ return ret;
+ if (IS_ERR(data)) {
+ ret = PTR_ERR(data);
+ break;
+ }
+ data->fn = onmax_save;
} else {
ret = -EINVAL;
break;
@@ -3839,12 +4060,48 @@ static int create_actions(struct hist_tr
ret = onmatch_create(hist_data, file, data);
if (ret)
return ret;
+ } else if (data->fn == onmax_save) {
+ ret = onmax_create(hist_data, data);
+ if (ret)
+ return ret;
}
}
@ -457,7 +463,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void print_onmatch_spec(struct seq_file *m,
struct hist_trigger_data *hist_data,
struct action_data *data)
@@ -3620,6 +3878,8 @@ static void print_actions_spec(struct se
@@ -3875,6 +4132,8 @@ static void print_actions_spec(struct se
if (data->fn == action_trace)
print_onmatch_spec(m, hist_data, data);
@ -466,7 +472,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
}
@@ -3994,6 +4254,8 @@ hist_trigger_entry_print(struct seq_file
@@ -4256,6 +4515,8 @@ hist_trigger_entry_print(struct seq_file
}
}

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:06 +0200
Subject: [PATCH 28/36] hrtimer: Implement support for softirq based hrtimers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
hrtimer callbacks are always invoked in hard interrupt context. Several
users in tree require soft interrupt context for their callbacks and
@ -32,15 +32,24 @@ processing the regular processing is resumed.
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/hrtimer.h | 20 +++-
include/linux/hrtimer.h | 21 +++--
kernel/time/hrtimer.c | 201 ++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 185 insertions(+), 36 deletions(-)
2 files changed, 186 insertions(+), 36 deletions(-)
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -113,6 +113,7 @@ struct hrtimer {
@@ -103,6 +103,7 @@ enum hrtimer_restart {
* @base: pointer to the timer base (per cpu and per clock)
* @state: state information (See bit values above)
* @is_rel: Set if the timer was armed relative
+ * @is_soft: Set if hrtimer will be expired in soft interrupt context.
*
* The hrtimer structure must be initialized by hrtimer_init()
*/
@@ -113,6 +114,7 @@ struct hrtimer {
struct hrtimer_clock_base *base;
u8 state;
u8 is_rel;
@ -48,7 +57,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
};
/**
@@ -178,13 +179,18 @@ enum hrtimer_base_type {
@@ -178,13 +180,18 @@ enum hrtimer_base_type {
* @hres_active: State of high resolution mode
* @in_hrtirq: hrtimer_interrupt() is currently executing
* @hang_detected: The last hrtimer interrupt detected a hang
@ -68,7 +77,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
* @clock_base: array of clock bases for this cpu
*
* Note: next_timer is just an optimization for __remove_hrtimer().
@@ -196,9 +202,10 @@ struct hrtimer_cpu_base {
@@ -196,9 +203,10 @@ struct hrtimer_cpu_base {
unsigned int cpu;
unsigned int active_bases;
unsigned int clock_was_set_seq;
@ -82,7 +91,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
#ifdef CONFIG_HIGH_RES_TIMERS
unsigned int nr_events;
unsigned short nr_retries;
@@ -207,6 +214,8 @@ struct hrtimer_cpu_base {
@@ -207,6 +215,8 @@ struct hrtimer_cpu_base {
#endif
ktime_t expires_next;
struct hrtimer *next_timer;
@ -91,7 +100,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
} ____cacheline_aligned;
@@ -379,7 +388,8 @@ extern void hrtimer_start_range_ns(struc
@@ -379,7 +389,8 @@ extern void hrtimer_start_range_ns(struc
* @timer: the timer to be added
* @tim: expiry time
* @mode: timer mode: absolute (HRTIMER_MODE_ABS) or
@ -158,14 +167,14 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
trace_hrtimer_start(timer, mode);
}
@@ -470,7 +486,6 @@ static inline void debug_deactivate(stru
trace_hrtimer_cancel(timer);
}
@@ -487,7 +503,6 @@ static struct hrtimer_clock_base *
#define for_each_active_base(base, cpu_base, active) \
while ((base = __next_base((cpu_base), &(active))))
-#if defined(CONFIG_NO_HZ_COMMON) || defined(CONFIG_HIGH_RES_TIMERS)
static struct hrtimer_clock_base *
__next_base(struct hrtimer_cpu_base *cpu_base, unsigned int *active)
{
static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base,
unsigned int active,
ktime_t expires_next)
@@ -504,7 +519,10 @@ static ktime_t __hrtimer_next_event_base
expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
if (expires < expires_next) {

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:05 -0500
Subject: [PATCH 34/42] tracing: Allow whitespace to surround hist trigger
Date: Fri, 17 Nov 2017 14:33:07 -0600
Subject: [PATCH 28/37] tracing: Allow whitespace to surround hist trigger
filter
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The existing code only allows for one space before and after the 'if'
specifying the filter for a hist trigger. Add code to make that more
@ -14,12 +14,12 @@ in param lists.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
kernel/trace/trace_events_hist.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -4857,7 +4857,7 @@ static int event_hist_trigger_func(struc
@@ -5157,7 +5157,7 @@ static int event_hist_trigger_func(struc
struct synth_event *se;
const char *se_name;
bool remove = false;
@ -28,7 +28,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
int ret = 0;
if (!param)
@@ -4866,10 +4866,23 @@ static int event_hist_trigger_func(struc
@@ -5166,10 +5166,37 @@ static int event_hist_trigger_func(struc
if (glob[0] == '!')
remove = true;
@ -40,27 +40,33 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ * separate the trigger from the filter (k:v [if filter])
+ * allowing for whitespace in the trigger
+ */
+ trigger = param;
+ p = strstr(param, " if");
+ if (!p)
+ p = strstr(param, "\tif");
+ if (p) {
+ if (p == trigger)
+ p = trigger = param;
+ do {
+ p = strstr(p, "if");
+ if (!p)
+ break;
+ if (p == param)
+ return -EINVAL;
+ param = p + 1;
+ param = strstrip(param);
+ *p = '\0';
+ trigger = strstrip(trigger);
+ } else
+ if (*(p - 1) != ' ' && *(p - 1) != '\t') {
+ p++;
+ continue;
+ }
+ if (p >= param + strlen(param) - strlen("if") - 1)
+ return -EINVAL;
+ if (*(p + strlen("if")) != ' ' && *(p + strlen("if")) != '\t') {
+ p++;
+ continue;
+ }
+ break;
+ } while (p);
+
+ if (!p)
+ param = NULL;
+ else {
+ *(p - 1) = '\0';
+ param = strstrip(p);
+ trigger = strstrip(trigger);
+ }
attrs = parse_hist_trigger_attrs(trigger);
if (IS_ERR(attrs))
@@ -4927,6 +4940,7 @@ static int event_hist_trigger_func(struc
}
ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
+
/*
* The above returns on success the # of triggers registered,
* but if it didn't register any it returns zero. Consider no

View File

@ -1,7 +1,7 @@
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:07 +0200
Subject: [PATCH 29/36] hrtimer: Implement SOFT/HARD clock base selection
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
All prerequisites to handle hrtimers for expiry in either hard or soft
interrupt context are in place.
@ -10,6 +10,7 @@ Add the missing bit in hrtimer_init() which associates the timer to the
hard or the soft irq clock base.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/time/hrtimer.c | 15 +++++++++++----

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:06 -0500
Subject: [PATCH 35/42] tracing: Add cpu field for hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:08 -0600
Subject: [PATCH 29/37] tracing: Add cpu field for hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
A common key to use in a histogram is the cpuid - add a new cpu
'synthetic' field for that purpose. This field is named cpu rather
@ -12,13 +12,13 @@ another name for the same thing.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/trace/events.txt | 18 ++++++++++++++++++
kernel/trace/trace_events_hist.c | 28 +++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 1 deletion(-)
Documentation/trace/histogram.txt | 17 +++++++++++++++++
kernel/trace/trace_events_hist.c | 28 +++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 1 deletion(-)
--- a/Documentation/trace/events.txt
+++ b/Documentation/trace/events.txt
@@ -668,6 +668,24 @@ triggers (you have to use '!' for each o
--- a/Documentation/trace/histogram.txt
+++ b/Documentation/trace/histogram.txt
@@ -172,6 +172,23 @@
The examples below provide a more concrete illustration of the
concepts and typical usage patterns discussed above.
@ -39,21 +39,20 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ modified by .usecs to have timestamps
+ interpreted as microseconds.
+ cpu int - the cpu on which the event occurred.
+
6.2 'hist' trigger examples
---------------------------
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -226,6 +226,7 @@ enum hist_field_flags {
HIST_FIELD_FL_VAR_ONLY = 1 << 13,
HIST_FIELD_FL_EXPR = 1 << 14,
HIST_FIELD_FL_VAR_REF = 1 << 15,
+ HIST_FIELD_FL_CPU = 1 << 16,
@@ -227,6 +227,7 @@ enum hist_field_flags {
HIST_FIELD_FL_VAR = 1 << 12,
HIST_FIELD_FL_EXPR = 1 << 13,
HIST_FIELD_FL_VAR_REF = 1 << 14,
+ HIST_FIELD_FL_CPU = 1 << 15,
};
struct var_defs {
@@ -1172,6 +1173,16 @@ static u64 hist_field_timestamp(struct h
@@ -1177,6 +1178,16 @@ static u64 hist_field_timestamp(struct h
return ts;
}
@ -67,19 +66,19 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ return cpu;
+}
+
static struct hist_field *check_var_ref(struct hist_field *hist_field,
struct hist_trigger_data *var_data,
unsigned int var_idx)
@@ -1520,6 +1531,8 @@ static const char *hist_field_name(struc
static struct hist_field *
check_field_for_var_ref(struct hist_field *hist_field,
struct hist_trigger_data *var_data,
@@ -1622,6 +1633,8 @@ static const char *hist_field_name(struc
field_name = hist_field_name(field->operands[0], ++level);
else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
field_name = "$common_timestamp";
+ else if (field->flags & HIST_FIELD_FL_CPU)
+ field_name = "cpu";
else if (field->flags & HIST_FIELD_FL_EXPR ||
field->flags & HIST_FIELD_FL_VAR_REF)
field_name = field->name;
@@ -2012,6 +2025,15 @@ static struct hist_field *create_hist_fi
field->flags & HIST_FIELD_FL_VAR_REF) {
if (field->system) {
@@ -2125,6 +2138,15 @@ static struct hist_field *create_hist_fi
goto out;
}
@ -95,7 +94,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (WARN_ON_ONCE(!field))
goto out;
@@ -2204,7 +2226,9 @@ parse_field(struct hist_trigger_data *hi
@@ -2343,7 +2365,9 @@ parse_field(struct hist_trigger_data *hi
hist_data->enable_timestamps = true;
if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS)
hist_data->attrs->ts_in_usecs = true;
@ -106,12 +105,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
field = trace_find_event_field(file->event_call, field_name);
if (!field || !field->size) {
field = ERR_PTR(-EINVAL);
@@ -4353,6 +4377,8 @@ static void hist_field_print(struct seq_
@@ -4614,6 +4638,8 @@ static void hist_field_print(struct seq_
if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP)
seq_puts(m, "$common_timestamp");
+ else if (hist_field->flags & HIST_FIELD_FL_CPU)
+ seq_puts(m, "cpu");
else if (field_name)
seq_printf(m, "%s", field_name);
else if (field_name) {
if (hist_field->flags & HIST_FIELD_FL_VAR_REF)
seq_putc(m, '$');

View File

@ -1,14 +1,15 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:08 +0200
Date: Thu, 23 Nov 2017 16:39:11 +0100
Subject: [PATCH 30/36] can/bcm: Replace hrtimer_tasklet with softirq based
hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
callback in softirq context and remove the hrtimer_tasklet.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org

View File

@ -1,11 +1,11 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:07 -0500
Subject: [PATCH 36/42] tracing: Add hist trigger support for variable
Date: Fri, 17 Nov 2017 14:33:09 -0600
Subject: [PATCH 30/37] tracing: Add hist trigger support for variable
reference aliases
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add support for alias=$somevar where alias can be used as
onmatch($alias).
onmatch.xxx($alias).
Aliases are a way of creating a new name for an existing variable, for
flexibly in making naming more clear in certain cases. For example in
@ -24,20 +24,20 @@ uses that in the call instead:
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/trace/trace_events_hist.c | 61 +++++++++++++++++++++++++++++++++++++--
1 file changed, 58 insertions(+), 3 deletions(-)
kernel/trace/trace_events_hist.c | 58 ++++++++++++++++++++++++++++++++++++---
1 file changed, 55 insertions(+), 3 deletions(-)
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -227,6 +227,7 @@ enum hist_field_flags {
HIST_FIELD_FL_EXPR = 1 << 14,
HIST_FIELD_FL_VAR_REF = 1 << 15,
HIST_FIELD_FL_CPU = 1 << 16,
+ HIST_FIELD_FL_ALIAS = 1 << 17,
@@ -228,6 +228,7 @@ enum hist_field_flags {
HIST_FIELD_FL_EXPR = 1 << 13,
HIST_FIELD_FL_VAR_REF = 1 << 14,
HIST_FIELD_FL_CPU = 1 << 15,
+ HIST_FIELD_FL_ALIAS = 1 << 16,
};
struct var_defs {
@@ -1527,7 +1528,8 @@ static const char *hist_field_name(struc
@@ -1629,7 +1630,8 @@ static const char *hist_field_name(struc
if (field->field)
field_name = field->field->name;
@ -47,7 +47,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
field_name = hist_field_name(field->operands[0], ++level);
else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
field_name = "$common_timestamp";
@@ -1983,7 +1985,7 @@ static struct hist_field *create_hist_fi
@@ -2096,7 +2098,7 @@ static struct hist_field *create_hist_fi
hist_field->hist_data = hist_data;
@ -56,7 +56,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
goto out; /* caller will populate */
if (flags & HIST_FIELD_FL_VAR_REF) {
@@ -2241,6 +2243,29 @@ parse_field(struct hist_trigger_data *hi
@@ -2380,6 +2382,28 @@ parse_field(struct hist_trigger_data *hi
return field;
}
@ -65,8 +65,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ char *var_name)
+{
+ struct hist_field *alias = NULL;
+ unsigned long flags = HIST_FIELD_FL_ALIAS | HIST_FIELD_FL_VAR |
+ HIST_FIELD_FL_VAR_ONLY;
+ unsigned long flags = HIST_FIELD_FL_ALIAS | HIST_FIELD_FL_VAR;
+
+ alias = create_hist_field(hist_data, NULL, flags, var_name);
+ if (!alias)
@ -75,7 +74,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ alias->fn = var_ref->fn;
+ alias->operands[0] = var_ref;
+
+ if (init_var_ref(alias, var_ref)) {
+ if (init_var_ref(alias, var_ref, var_ref->system, var_ref->event_name)) {
+ destroy_hist_field(alias, 0);
+ return NULL;
+ }
@ -86,7 +85,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
struct hist_field *parse_atom(struct hist_trigger_data *hist_data,
struct trace_event_file *file, char *str,
unsigned long *flags, char *var_name)
@@ -2275,6 +2300,13 @@ struct hist_field *parse_atom(struct his
@@ -2413,6 +2437,13 @@ struct hist_field *parse_atom(struct his
if (hist_field) {
hist_data->var_refs[hist_data->n_var_refs] = hist_field;
hist_field->var_ref_idx = hist_data->n_var_refs++;
@ -100,7 +99,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return hist_field;
}
} else
@@ -2378,6 +2410,26 @@ static int check_expr_operands(struct hi
@@ -2517,6 +2548,26 @@ static int check_expr_operands(struct hi
unsigned long operand1_flags = operand1->flags;
unsigned long operand2_flags = operand2->flags;
@ -127,16 +126,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if ((operand1_flags & HIST_FIELD_FL_TIMESTAMP_USECS) !=
(operand2_flags & HIST_FIELD_FL_TIMESTAMP_USECS))
return -EINVAL;
@@ -4379,8 +4431,11 @@ static void hist_field_print(struct seq_
seq_puts(m, "$common_timestamp");
@@ -4641,7 +4692,8 @@ static void hist_field_print(struct seq_
else if (hist_field->flags & HIST_FIELD_FL_CPU)
seq_puts(m, "cpu");
- else if (field_name)
+ else if (field_name) {
+ if (hist_field->flags & HIST_FIELD_FL_ALIAS)
+ seq_putc(m, '$');
else if (field_name) {
- if (hist_field->flags & HIST_FIELD_FL_VAR_REF)
+ if (hist_field->flags & HIST_FIELD_FL_VAR_REF ||
+ hist_field->flags & HIST_FIELD_FL_ALIAS)
seq_putc(m, '$');
seq_printf(m, "%s", field_name);
+ }
if (hist_field->flags) {
const char *flags_str = get_hist_field_flags(hist_field);
}

View File

@ -1,17 +1,17 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:09 +0200
Date: Thu, 23 Nov 2017 16:39:12 +0100
Subject: [PATCH 31/36] mac80211_hwsim: Replace hrtimer tasklet with softirq
hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
callback in softirq context and remove the hrtimer_tasklet.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/net/wireless/mac80211_hwsim.c | 44 +++++++++++++++-------------------

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:08 -0500
Subject: [PATCH 37/42] tracing: Add 'last error' error facility for hist
Date: Fri, 17 Nov 2017 14:33:10 -0600
Subject: [PATCH 31/37] tracing: Add 'last error' error facility for hist
triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
With the addition of variables and actions, it's become necessary to
provide more detailed error information to users about syntax errors.
@ -26,13 +26,13 @@ Also add specific error messages for variable and action errors.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/trace/events.txt | 19 ++++
kernel/trace/trace_events_hist.c | 162 +++++++++++++++++++++++++++++++++++----
2 files changed, 168 insertions(+), 13 deletions(-)
Documentation/trace/histogram.txt | 20 ++++
kernel/trace/trace_events_hist.c | 167 +++++++++++++++++++++++++++++++++++---
2 files changed, 174 insertions(+), 13 deletions(-)
--- a/Documentation/trace/events.txt
+++ b/Documentation/trace/events.txt
@@ -686,6 +686,25 @@ triggers (you have to use '!' for each o
--- a/Documentation/trace/histogram.txt
+++ b/Documentation/trace/histogram.txt
@@ -190,6 +190,26 @@
interpreted as microseconds.
cpu int - the cpu on which the event occurred.
@ -55,9 +55,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+ # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist
+ ERROR: Couldn't yyy: zzz
+ Last command: xxx
+
6.2 'hist' trigger examples
---------------------------
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -351,6 +351,65 @@ struct action_data {
@ -126,7 +127,31 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static LIST_HEAD(synth_event_list);
static DEFINE_MUTEX(synth_event_mutex);
@@ -2132,9 +2191,18 @@ static struct hist_field *create_var_ref
@@ -1458,6 +1517,7 @@ static struct trace_event_file *find_var
if (!system || !event_name) {
if (find_var(var_hist_data, file, var_name)) {
if (found) {
+ hist_err_event("Variable name not unique, need to use fully qualified name (subsys.event.var) for variable: ", system, event_name, var_name);
return NULL;
}
@@ -1518,6 +1578,7 @@ find_match_var(struct hist_trigger_data
hist_field = find_file_var(file, var_name);
if (hist_field) {
if (found) {
+ hist_err_event("Variable name not unique, need to use fully qualified name (subsys.event.var) for variable: ", system, event_name, var_name);
return ERR_PTR(-EINVAL);
}
@@ -1801,6 +1862,7 @@ static int parse_assignment(char *str, s
char *assignment;
if (attrs->n_assignments == TRACING_MAP_VARS_MAX) {
+ hist_err("Too many variables defined: ", str);
ret = -EINVAL;
goto out;
}
@@ -2271,9 +2333,18 @@ static struct hist_field *create_var_ref
return ref_field;
}
@ -146,9 +171,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return false;
return true;
@@ -2186,6 +2254,10 @@ static struct hist_field *parse_var_ref(
@@ -2325,6 +2396,10 @@ static struct hist_field *parse_var_ref(
if (var_field)
ref_field = create_var_ref(var_field);
ref_field = create_var_ref(var_field, system, event_name);
+ if (!ref_field)
+ hist_err_event("Couldn't find variable: $",
@ -157,7 +182,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return ref_field;
}
@@ -2431,8 +2503,10 @@ static int check_expr_operands(struct hi
@@ -2569,8 +2644,10 @@ static int check_expr_operands(struct hi
}
if ((operand1_flags & HIST_FIELD_FL_TIMESTAMP_USECS) !=
@ -169,55 +194,57 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return 0;
}
@@ -2632,19 +2706,27 @@ create_field_var_hist(struct hist_trigge
@@ -2816,12 +2893,17 @@ create_field_var_hist(struct hist_trigge
char *cmd;
int ret;
- if (target_hist_data->n_field_var_hists >= SYNTH_FIELDS_MAX)
+ if (target_hist_data->n_field_var_hists >= SYNTH_FIELDS_MAX) {
+ hist_err_event("onmatch: Too many field variables defined: ",
+ system, event_name, field_name);
+ subsys_name, event_name, field_name);
return ERR_PTR(-EINVAL);
+ }
file = event_file(tr, system, event_name);
file = event_file(tr, subsys_name, event_name);
if (IS_ERR(file)) {
+ hist_err_event("onmatch: Event file not found: ",
+ system, event_name, field_name);
+ subsys_name, event_name, field_name);
ret = PTR_ERR(file);
return ERR_PTR(ret);
}
@@ -2833,8 +2915,11 @@ create_field_var_hist(struct hist_trigge
* yet a registered histogram so we can't use that.
*/
hist_data = find_compatible_hist(target_hist_data, file);
- if (!hist_data)
+ if (!hist_data) {
+ hist_err_event("onmatch: Matching event histogram not found: ",
+ system, event_name, field_name);
+ subsys_name, event_name, field_name);
return ERR_PTR(-EINVAL);
+ }
var_hist = kzalloc(sizeof(*var_hist), GFP_KERNEL);
if (!var_hist)
@@ -2692,6 +2774,8 @@ create_field_var_hist(struct hist_trigge
/* See if a synthetic field variable has already been created */
event_var = find_synthetic_field_var(target_hist_data, subsys_name,
@@ -2893,6 +2978,8 @@ create_field_var_hist(struct hist_trigge
kfree(cmd);
kfree(var_hist->cmd);
kfree(var_hist);
+ hist_err_event("onmatch: Couldn't create histogram for field: ",
+ system, event_name, field_name);
+ subsys_name, event_name, field_name);
return ERR_PTR(ret);
}
@@ -2703,6 +2787,8 @@ create_field_var_hist(struct hist_trigge
@@ -2905,6 +2992,8 @@ create_field_var_hist(struct hist_trigge
kfree(cmd);
kfree(var_hist->cmd);
kfree(var_hist);
+ hist_err_event("onmatch: Couldn't find synthetic variable: ",
+ system, event_name, field_name);
+ subsys_name, event_name, field_name);
return ERR_PTR(-EINVAL);
}
@@ -2839,18 +2925,21 @@ static struct field_var *create_field_va
@@ -3041,18 +3130,21 @@ static struct field_var *create_field_va
int ret = 0;
if (hist_data->n_field_vars >= SYNTH_FIELDS_MAX) {
@ -239,7 +266,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(val);
ret = PTR_ERR(var);
goto err;
@@ -2975,14 +3064,18 @@ static int onmax_create(struct hist_trig
@@ -3197,14 +3289,18 @@ static int onmax_create(struct hist_trig
int ret = 0;
onmax_var_str = data->onmax.var_str;
@ -260,7 +287,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
flags = HIST_FIELD_FL_VAR_REF;
ref_field = create_hist_field(hist_data, NULL, flags, NULL);
@@ -3002,6 +3095,7 @@ static int onmax_create(struct hist_trig
@@ -3224,6 +3320,7 @@ static int onmax_create(struct hist_trig
data->onmax.max_var_ref_idx = var_ref_idx;
max_var = create_var(hist_data, file, "max", sizeof(u64), "u64");
if (IS_ERR(max_var)) {
@ -268,7 +295,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = PTR_ERR(max_var);
goto out;
}
@@ -3016,6 +3110,7 @@ static int onmax_create(struct hist_trig
@@ -3238,6 +3335,7 @@ static int onmax_create(struct hist_trig
field_var = create_target_field_var(hist_data, NULL, NULL, param);
if (IS_ERR(field_var)) {
@ -276,7 +303,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = PTR_ERR(field_var);
kfree(param);
goto out;
@@ -3050,6 +3145,7 @@ static int parse_action_params(char *par
@@ -3270,6 +3368,7 @@ static int parse_action_params(char *par
param = strstrip(param);
if (strlen(param) < 2) {
@ -284,8 +311,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = -EINVAL;
goto out;
}
@@ -3223,6 +3319,9 @@ onmatch_find_var(struct hist_trigger_dat
hist_field = find_event_var(tr, system, event, var);
@@ -3442,6 +3541,9 @@ onmatch_find_var(struct hist_trigger_dat
hist_field = find_event_var(hist_data, system, event, var);
}
+ if (!hist_field)
@ -294,7 +321,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return hist_field;
}
@@ -3273,6 +3372,7 @@ static int onmatch_create(struct hist_tr
@@ -3509,6 +3611,7 @@ static int onmatch_create(struct hist_tr
mutex_lock(&synth_event_mutex);
event = find_synth_event(data->onmatch.synth_event_name);
if (!event) {
@ -302,7 +329,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
mutex_unlock(&synth_event_mutex);
return -EINVAL;
}
@@ -3331,12 +3431,15 @@ static int onmatch_create(struct hist_tr
@@ -3567,12 +3670,15 @@ static int onmatch_create(struct hist_tr
continue;
}
@ -318,7 +345,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = -EINVAL;
goto out;
}
@@ -3362,15 +3465,22 @@ static struct action_data *onmatch_parse
@@ -3597,15 +3703,22 @@ static struct action_data *onmatch_parse
return ERR_PTR(-ENOMEM);
match_event = strsep(&str, ")");
@ -344,7 +371,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
data->onmatch.match_event = kstrdup(match_event, GFP_KERNEL);
if (!data->onmatch.match_event) {
@@ -3385,12 +3495,16 @@ static struct action_data *onmatch_parse
@@ -3620,12 +3733,16 @@ static struct action_data *onmatch_parse
}
strsep(&str, ".");
@ -363,7 +390,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
data->onmatch.synth_event_name = kstrdup(synth_event_name, GFP_KERNEL);
if (!data->onmatch.synth_event_name) {
@@ -3399,8 +3513,10 @@ static struct action_data *onmatch_parse
@@ -3634,8 +3751,10 @@ static struct action_data *onmatch_parse
}
params = strsep(&str, ")");
@ -375,22 +402,25 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = parse_action_params(params, data);
if (ret)
@@ -3480,12 +3596,14 @@ static int create_var_field(struct hist_
return -EINVAL;
@@ -3710,7 +3829,9 @@ static int create_var_field(struct hist_
if (find_var(file, var_name) && !hist_data->remove) {
if (WARN_ON(val_idx >= TRACING_MAP_VALS_MAX + TRACING_MAP_VARS_MAX))
return -EINVAL;
+
if (find_var(hist_data, file, var_name) && !hist_data->remove) {
+ hist_err("Variable already defined: ", var_name);
return -EINVAL;
}
flags |= HIST_FIELD_FL_VAR;
hist_data->n_vars++;
if (hist_data->n_vars > TRACING_MAP_VARS_MAX) {
+ hist_err("Too many variables defined: ", var_name);
return -EINVAL;
}
@@ -3791,6 +3912,7 @@ static int create_key_field(struct hist_
}
@@ -3676,6 +3794,7 @@ static int parse_var_defs(struct hist_tr
if (hist_field->flags & HIST_FIELD_FL_VAR_REF) {
+ hist_err("Using variable references as keys not supported: ", field_str);
destroy_hist_field(hist_field, 0);
ret = -EINVAL;
goto out;
@@ -3904,11 +4026,13 @@ static int parse_var_defs(struct hist_tr
var_name = strsep(&field_str, "=");
if (!var_name || !field_str) {
@ -398,7 +428,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = -EINVAL;
goto free;
}
@@ -4402,6 +4521,11 @@ static int hist_show(struct seq_file *m,
if (n_vars == TRACING_MAP_VARS_MAX) {
+ hist_err("Too many variables defined: ", var_name);
ret = -EINVAL;
goto free;
}
@@ -4662,6 +4786,11 @@ static int hist_show(struct seq_file *m,
hist_trigger_show(m, data, n++);
}
@ -410,7 +446,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
out_unlock:
mutex_unlock(&event_mutex);
@@ -4748,6 +4872,7 @@ static int hist_register_trigger(char *g
@@ -5009,6 +5138,7 @@ static int hist_register_trigger(char *g
if (named_data) {
if (!hist_trigger_match(data, named_data, named_data,
true)) {
@ -418,7 +454,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = -EINVAL;
goto out;
}
@@ -4767,13 +4892,16 @@ static int hist_register_trigger(char *g
@@ -5028,13 +5158,16 @@ static int hist_register_trigger(char *g
test->paused = false;
else if (hist_data->attrs->clear)
hist_clear(test);
@ -436,7 +472,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ret = -ENOENT;
goto out;
}
@@ -4941,6 +5069,11 @@ static int event_hist_trigger_func(struc
@@ -5238,6 +5371,11 @@ static int event_hist_trigger_func(struc
char *trigger, *p;
int ret = 0;
@ -448,7 +484,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (!param)
return -EINVAL;
@@ -5062,6 +5195,9 @@ static int event_hist_trigger_func(struc
@@ -5376,6 +5514,9 @@ static int event_hist_trigger_func(struc
/* Just return zero, not the number of registered triggers */
ret = 0;
out:

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:09 -0500
Subject: [PATCH 38/42] tracing: Add inter-event hist trigger Documentation
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:11 -0600
Subject: [PATCH 32/37] tracing: Add inter-event hist trigger Documentation
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Add background and details on inter-event hist triggers, including
hist variables, synthetic events, and actions.
@ -10,25 +10,18 @@ Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/trace/events.txt | 385 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 385 insertions(+)
Documentation/trace/histogram.txt | 382 ++++++++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
--- a/Documentation/trace/events.txt
+++ b/Documentation/trace/events.txt
@@ -571,6 +571,7 @@ triggers (you have to use '!' for each o
.sym-offset display an address as a symbol and offset
.syscall display a syscall id as a system call name
.execname display a common_pid as a program name
+ .usecs display a $common_timestamp in microseconds
Note that in general the semantics of a given field aren't
interpreted when applying a modifier to it, but there are some
@@ -2101,3 +2102,387 @@ triggers (you have to use '!' for each o
--- a/Documentation/trace/histogram.txt
+++ b/Documentation/trace/histogram.txt
@@ -1605,3 +1605,385 @@
Hits: 489
Entries: 7
Dropped: 0
+
+6.3 Inter-event hist triggers
+
+2.2 Inter-event hist triggers
+-----------------------------
+
+Inter-event hist triggers are hist triggers that combine values from
@ -39,13 +32,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+The most important example of an inter-event quantity that can be used
+in this manner is latency, which is simply a difference in timestamps
+between two events (although trace events don't have an externally
+visible timestamp field, the inter-event hist trigger support adds a
+pseudo-field to all events named '$common_timestamp' which can be used
+as if it were an actual event field). Although latency is the most
+important inter-event quantity, note that because the support is
+completely general across the trace event subsystem, any event field
+can be used in an inter-event quantity.
+between two events. Although latency is the most important
+inter-event quantity, note that because the support is completely
+general across the trace event subsystem, any event field can be used
+in an inter-event quantity.
+
+An example of a histogram that combines data from other histograms
+into a useful chain would be a 'wakeupswitch latency' histogram that
@ -100,7 +90,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+These features are decribed in more detail in the following sections.
+
+6.3.1 Histogram Variables
+2.2.1 Histogram Variables
+-------------------------
+
+Variables are simply named locations used for saving and retrieving
@ -187,7 +177,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+
+ # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ... >> event3/trigger
+
+6.3.2 Synthetic Events
+2.2.2 Synthetic Events
+----------------------
+
+Synthetic events are user-defined events generated from hist trigger
@ -243,7 +233,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Like any other event, once a histogram is enabled for the event, the
+output can be displayed by reading the event's 'hist' file.
+
+6.3.3 Hist trigger 'actions'
+2.2.3 Hist trigger 'actions'
+----------------------------
+
+A hist trigger 'action' is a function that's executed whenever a

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:10 +0200
Date: Thu, 23 Nov 2017 16:39:13 +0100
Subject: [PATCH 32/36] xfrm: Replace hrtimer tasklet with softirq hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
callback in softirq context and remove the hrtimer_tasklet.
@ -9,9 +9,9 @@ callback in softirq context and remove the hrtimer_tasklet.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: netdev@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/net/xfrm.h | 2 +-

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:11 +0200
Date: Thu, 23 Nov 2017 16:39:14 +0100
Subject: [PATCH 33/36] softirq: Remove tasklet_hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
There are no more tasklet_hrtimer users of this interface.
Remove it.

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:10 -0500
Subject: [PATCH 39/42] tracing: Make tracing_set_clock() non-static
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:12 -0600
Subject: [PATCH 33/37] tracing: Make tracing_set_clock() non-static
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Allow tracing code outside of trace.c to access tracing_set_clock().
@ -19,7 +19,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6226,7 +6226,7 @@ static int tracing_clock_show(struct seq
@@ -6230,7 +6230,7 @@ static int tracing_clock_show(struct seq
return 0;
}

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:12 +0200
Date: Thu, 23 Nov 2017 16:39:15 +0100
Subject: [PATCH 34/36] ALSA/dummy: Replace tasklet with softirq hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The tasklet is used to defer the execution of snd_pcm_period_elapsed() to
the softirq context. Using the HRTIMER_MODE_SOFT mode invokes the timer
@ -9,12 +9,13 @@ callback in softirq context as well which renders the tasklet useless.
[o-takashi: avoid stall due to a call of hrtimer_cancel() on a callback
of hrtimer]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org
Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Link: http://lkml.kernel.org/r/20170905161820.jtysvxtfleunbbmf@breakpoint.cc
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---

View File

@ -1,7 +1,7 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:11 -0500
Subject: [PATCH 40/42] tracing: Add a clock attribute for hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Date: Fri, 17 Nov 2017 14:33:13 -0600
Subject: [PATCH 34/37] tracing: Add a clock attribute for hist triggers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The default clock if timestamps are used in a histogram is "global".
If timestamps aren't used, the clock is irrelevant.
@ -13,16 +13,17 @@ Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Rajvi Jingar <rajvi.jingar@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Documentation/trace/events.txt | 9 +++++++++
kernel/trace/trace_events_hist.c | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 45 insertions(+), 2 deletions(-)
Documentation/trace/histogram.txt | 11 ++++++++++-
kernel/trace/trace_events_hist.c | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 3 deletions(-)
--- a/Documentation/trace/events.txt
+++ b/Documentation/trace/events.txt
@@ -2173,6 +2173,15 @@ specification. In support of this overa
--- a/Documentation/trace/histogram.txt
+++ b/Documentation/trace/histogram.txt
@@ -1674,7 +1674,16 @@ specification. In support of this overa
default it is in units of nanoseconds; appending '.usecs' to a
common_timestamp field changes the units to microseconds.
-These features are decribed in more detail in the following sections.
+A note on inter-event timestamps: If $common_timestamp is used in a
+histogram, the trace buffer is automatically switched over to using
+absolute timestamps and the "global" trace clock, in order to avoid
@ -32,12 +33,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+where XXX is any of the clocks listed in the tracing/trace_clock
+pseudo-file.
+
These features are decribed in more detail in the following sections.
+These features are described in more detail in the following sections.
6.3.1 Histogram Variables
2.2.1 Histogram Variables
-------------------------
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -241,6 +241,7 @@ struct hist_trigger_attrs {
@@ -242,6 +242,7 @@ struct hist_trigger_attrs {
char *vals_str;
char *sort_key_str;
char *name;
@ -45,7 +47,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
bool pause;
bool cont;
bool clear;
@@ -1680,6 +1681,7 @@ static void destroy_hist_trigger_attrs(s
@@ -1795,6 +1796,7 @@ static void destroy_hist_trigger_attrs(s
kfree(attrs->sort_key_str);
kfree(attrs->keys_str);
kfree(attrs->vals_str);
@ -53,7 +55,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
kfree(attrs);
}
@@ -1735,6 +1737,19 @@ static int parse_assignment(char *str, s
@@ -1850,6 +1852,19 @@ static int parse_assignment(char *str, s
ret = -ENOMEM;
goto out;
}
@ -73,7 +75,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
} else if (strncmp(str, "size=", strlen("size=")) == 0) {
int map_bits = parse_map_size(str);
@@ -1798,6 +1813,14 @@ static struct hist_trigger_attrs *parse_
@@ -1914,6 +1929,14 @@ static struct hist_trigger_attrs *parse_
goto free;
}
@ -88,7 +90,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return attrs;
free:
destroy_hist_trigger_attrs(attrs);
@@ -4660,6 +4683,8 @@ static int event_hist_trigger_print(stru
@@ -4926,6 +4949,8 @@ static int event_hist_trigger_print(stru
seq_puts(m, ".descending");
}
seq_printf(m, ":size=%u", (1 << hist_data->map->map_bits));
@ -97,7 +99,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
print_actions_spec(m, hist_data);
@@ -4922,10 +4947,19 @@ static int hist_register_trigger(char *g
@@ -5188,10 +5213,19 @@ static int hist_register_trigger(char *g
goto out;
}

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:12 -0500
Subject: [PATCH 41/42] tracing: Increase trace_recursive_lock() limit for
Date: Fri, 17 Nov 2017 14:33:14 -0600
Subject: [PATCH 35/37] tracing: Increase trace_recursive_lock() limit for
synthetic events
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Synthetic event generation needs to happen while the current event is
still in progress, so add 1 to the trace_recursive_lock() recursion
@ -20,7 +20,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2590,16 +2590,16 @@ rb_wakeups(struct ring_buffer *buffer, s
@@ -2589,16 +2589,16 @@ rb_wakeups(struct ring_buffer *buffer, s
* IRQ context
* NMI context
*

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:14 +0200
Date: Thu, 23 Nov 2017 16:39:16 +0100
Subject: [PATCH 35/36] usb/gadget/NCM: Replace tasklet with softirq hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The tx_tasklet tasklet is used in invoke the hrtimer (task_timer) in
softirq context. This can be also achieved without the tasklet but

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 22 Oct 2017 23:40:15 +0200
Date: Thu, 23 Nov 2017 16:39:17 +0100
Subject: [PATCH 36/36] net/mvpp2: Replace tasklet with softirq hrtimer
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The tx_done_tasklet tasklet is used in invoke the hrtimer
(mvpp2_hr_timer_cb) in softirq context. This can be also achieved without
@ -9,9 +9,9 @@ the tasklet but with HRTIMER_MODE_SOFT as hrtimer mode.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/net/ethernet/marvell/mvpp2.c | 62 ++++++++++++++---------------------

View File

@ -1,8 +1,8 @@
From: Tom Zanussi <tom.zanussi@linux.intel.com>
Date: Fri, 22 Sep 2017 15:00:13 -0500
Subject: [PATCH 42/42] tracing: Add inter-event blurb to HIST_TRIGGERS config
Date: Fri, 17 Nov 2017 14:33:15 -0600
Subject: [PATCH 36/37] tracing: Add inter-event blurb to HIST_TRIGGERS config
option
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
So that users know that inter-event tracing is supported as part of
the HIST_TRIGGERS option, include text to that effect in the help

View File

@ -0,0 +1,439 @@
From: Rajvi Jingar <rajvi.jingar@intel.com>
Date: Fri, 17 Nov 2017 14:33:16 -0600
Subject: [PATCH 37/37] selftests: ftrace: Add inter-event hist triggers
testcases
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
This adds inter-event hist triggers testcases which covers following:
- create/remove synthetic event
- disable histogram for synthetic event
- extended error support
- field variable support
- histogram variables
- histogram trigger onmatch action
- histogram trigger onmax action
- histogram trigger onmatch-onmax action
- simple expression support
- combined histogram
Here is the test result.
=== Ftrace unit tests ===
[1] event trigger - test extended error support [PASS]
[2] event trigger - test field variable support [PASS]
[3] event trigger - test inter-event combined histogram trigger [PASS]
[4] event trigger - test inter-event histogram trigger onmatch action [PASS]
[5] event trigger - test inter-event histogram trigger onmatch-onmax action [PASS]
[6] event trigger - test inter-event histogram trigger onmax action [PASS]
[7] event trigger - test synthetic event create remove [PASS]
Signed-off-by: Rajvi Jingar <rajvi.jingar@intel.com>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
tools/testing/selftests/ftrace/test.d/functions | 7 +
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc | 39 ++++++
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc | 54 +++++++++
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc | 58 ++++++++++
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-action-hist.tc | 50 ++++++++
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-onmax-action-hist.tc | 50 ++++++++
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmax-action-hist.tc | 48 ++++++++
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc | 54 +++++++++
8 files changed, 360 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-action-hist.tc
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-onmax-action-hist.tc
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmax-action-hist.tc
create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
--- a/tools/testing/selftests/ftrace/test.d/functions
+++ b/tools/testing/selftests/ftrace/test.d/functions
@@ -55,6 +55,13 @@ disable_events() {
echo 0 > events/enable
}
+clear_synthetic_events() { # reset all current synthetic events
+ grep -v ^# synthetic_events |
+ while read line; do
+ echo "!$line" >> synthetic_events
+ done
+}
+
initialize_ftrace() { # Reset ftrace to initial-state
# As the initial state, ftrace will be set to nop tracer,
# no events, no triggers, no filters, no function filters,
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
@@ -0,0 +1,39 @@
+#!/bin/sh
+# description: event trigger - test extended error support
+
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+reset_tracer
+do_reset
+
+echo "Test extended error support"
+echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
+echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger &>/dev/null
+if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then
+ fail "Failed to generate extended error in histogram"
+fi
+
+do_reset
+
+exit 0
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc
@@ -0,0 +1,54 @@
+#!/bin/sh
+# description: event trigger - test field variable support
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+clear_synthetic_events
+reset_tracer
+do_reset
+
+echo "Test field variable support"
+
+echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events
+echo 'hist:keys=comm:ts0=$common_timestamp.usecs if comm=="ping"' > events/sched/sched_waking/trigger
+echo 'hist:keys=next_comm:wakeup_lat=$common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger
+echo 'hist:keys=pid,prio,comm:vals=lat:sort=pid,prio' > events/synthetic/wakeup_latency/trigger
+
+ping localhost -c 3
+if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
+ fail "Failed to create inter-event histogram"
+fi
+
+if ! grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
+ fail "Failed to create histogram with field variable"
+fi
+
+echo '!hist:keys=next_comm:wakeup_lat=$common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
+
+if grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
+ fail "Failed to remove histogram with field variable"
+fi
+
+do_reset
+
+exit 0
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc
@@ -0,0 +1,58 @@
+#!/bin/sh
+# description: event trigger - test inter-event combined histogram trigger
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+reset_tracer
+do_reset
+clear_synthetic_events
+
+echo "Test create synthetic event"
+
+echo 'waking_latency u64 lat pid_t pid' > synthetic_events
+if [ ! -d events/synthetic/waking_latency ]; then
+ fail "Failed to create waking_latency synthetic event"
+fi
+
+echo "Test combined histogram"
+
+echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="ping"' > events/sched/sched_waking/trigger
+echo 'hist:keys=pid:waking_lat=$common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).waking_latency($waking_lat,pid) if comm=="ping"' > events/sched/sched_wakeup/trigger
+echo 'hist:keys=pid,lat:sort=pid,lat' > events/synthetic/waking_latency/trigger
+
+echo 'wakeup_latency u64 lat pid_t pid' >> synthetic_events
+echo 'hist:keys=pid:ts1=$common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger
+echo 'hist:keys=next_pid:wakeup_lat=$common_timestamp.usecs-$ts1:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid) if next_comm=="ping"' > events/sched/sched_switch/trigger
+
+echo 'waking+wakeup_latency u64 lat; pid_t pid' >> synthetic_events
+echo 'hist:keys=pid,lat:sort=pid,lat:ww_lat=$waking_lat+$wakeup_lat:onmatch(synthetic.wakeup_latency).waking+wakeup_latency($ww_lat,pid)' >> events/synthetic/wakeup_latency/trigger
+echo 'hist:keys=pid,lat:sort=pid,lat' >> events/synthetic/waking+wakeup_latency/trigger
+
+ping localhost -c 3
+if ! grep -q "pid:" events/synthetic/waking+wakeup_latency/hist; then
+ fail "Failed to create combined histogram"
+fi
+
+do_reset
+
+exit 0
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-action-hist.tc
@@ -0,0 +1,50 @@
+#!/bin/sh
+# description: event trigger - test inter-event histogram trigger onmatch action
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+clear_synthetic_events
+reset_tracer
+do_reset
+
+echo "Test create synthetic event"
+
+echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
+if [ ! -d events/synthetic/wakeup_latency ]; then
+ fail "Failed to create wakeup_latency synthetic event"
+fi
+
+echo "Test create histogram for synthetic event"
+echo "Test histogram variables,simple expression support and onmatch action"
+
+echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
+echo 'hist:keys=next_pid:wakeup_lat=$common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger
+echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > events/synthetic/wakeup_latency/trigger
+ping localhost -c 5
+if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
+ fail "Failed to create onmatch action inter-event histogram"
+fi
+
+do_reset
+
+exit 0
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmatch-onmax-action-hist.tc
@@ -0,0 +1,50 @@
+#!/bin/sh
+# description: event trigger - test inter-event histogram trigger onmatch-onmax action
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+clear_synthetic_events
+reset_tracer
+do_reset
+
+echo "Test create synthetic event"
+
+echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
+if [ ! -d events/synthetic/wakeup_latency ]; then
+ fail "Failed to create wakeup_latency synthetic event"
+fi
+
+echo "Test create histogram for synthetic event"
+echo "Test histogram variables,simple expression support and onmatch-onmax action"
+
+echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
+echo 'hist:keys=next_pid:wakeup_lat=$common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid,next_comm):onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
+echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > events/synthetic/wakeup_latency/trigger
+ping localhost -c 5
+if [ ! grep -q "ping" events/synthetic/wakeup_latency/hist -o ! grep -q "max:" events/sched/sched_switch/hist]; then
+ fail "Failed to create onmatch-onmax action inter-event histogram"
+fi
+
+do_reset
+
+exit 0
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onmax-action-hist.tc
@@ -0,0 +1,48 @@
+#!/bin/sh
+# description: event trigger - test inter-event histogram trigger onmax action
+
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+clear_synthetic_events
+reset_tracer
+do_reset
+
+echo "Test create synthetic event"
+
+echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
+if [ ! -d events/synthetic/wakeup_latency ]; then
+ fail "Failed to create wakeup_latency synthetic event"
+fi
+
+echo "Test onmax action"
+
+echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="ping"' >> events/sched/sched_waking/trigger
+echo 'hist:keys=next_pid:wakeup_lat=$common_timestamp.usecs-$ts0:onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
+ping localhost -c 3
+if ! grep -q "max:" events/sched/sched_switch/hist; then
+ fail "Failed to create onmax action inter-event histogram"
+fi
+
+do_reset
+
+exit 0
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc
@@ -0,0 +1,54 @@
+#!/bin/sh
+# description: event trigger - test synthetic event create remove
+do_reset() {
+ reset_trigger
+ echo > set_event
+ clear_trace
+}
+
+fail() { #msg
+ do_reset
+ echo $1
+ exit_fail
+}
+
+if [ ! -f set_event ]; then
+ echo "event tracing is not supported"
+ exit_unsupported
+fi
+
+if [ ! -f synthetic_events ]; then
+ echo "synthetic event is not supported"
+ exit_unsupported
+fi
+
+clear_synthetic_events
+reset_tracer
+do_reset
+
+echo "Test create synthetic event"
+
+echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
+if [ ! -d events/synthetic/wakeup_latency ]; then
+ fail "Failed to create wakeup_latency synthetic event"
+fi
+
+reset_trigger
+
+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 "Created wakeup_latency synthetic event with an invalid format"
+fi
+
+reset_trigger
+
+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 "Failed to delete wakeup_latency synthetic event"
+fi
+
+do_reset
+
+exit 0

View File

@ -1,7 +1,7 @@
From: "Yadi.hu" <yadi.hu@windriver.com>
Date: Wed, 10 Dec 2014 10:32:09 +0800
Subject: ARM: enable irq in translation/section permission fault handlers
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Probably happens on all ARM, with
CONFIG_PREEMPT_RT_FULL

View File

@ -2,7 +2,7 @@ From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 21 Sep 2017 15:35:57 +0200
Subject: Bluetooth: avoid recursive locking in
hci_send_to_channel()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Mart reported a deadlock in -RT in the call path:
hci_send_monitor_ctrl_event() -> hci_send_to_channel()

View File

@ -1,7 +1,7 @@
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 21 Mar 2013 19:01:05 +0100
Subject: printk: Drop the logbuf_lock more often
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The lock is hold with irgs off. The latency drops 500us+ on my arm bugs
with a "full" buffer after executing "dmesg" on the shell.

View File

@ -1,7 +1,7 @@
From: Josh Cartwright <joshc@ni.com>
Date: Thu, 11 Feb 2016 11:54:01 -0600
Subject: KVM: arm/arm64: downgrade preempt_disable()d region to migrate_disable()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
kvm_arch_vcpu_ioctl_run() disables the use of preemption when updating
the vgic and timer states to prevent the calling task from migrating to

View File

@ -5,7 +5,7 @@ Cc: Anna Schumaker <anna.schumaker@netapp.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
tglx@linutronix.de
Subject: NFSv4: replace seqcount_t with a seqlock_t
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The raw_write_seqcount_begin() in nfs4_reclaim_open_state() bugs me
because it maps to preempt_disable() in -RT which I can't have at this

View File

@ -2,7 +2,7 @@ From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 21 Sep 2017 14:25:13 +0200
Subject: [PATCH] RCU: we need to skip that warning but only on sleeping
locks
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
This check is okay for upstream. On RT we trigger this while blocking on
sleeping lock. In this case, it is okay to schedule() within a RCU

View File

@ -0,0 +1,26 @@
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 23 Nov 2017 17:51:51 +0100
Subject: [PATCH] Revert "fs: jbd2: pull your plug when waiting for space"
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
This reverts commit "fs: jbd2: pull your plug when waiting for space".
This was a duct-tape fix which shouldn't be needed since commit
"locking/rt-mutex: fix deadlock in device mapper / block-IO".
Cc: stable@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
fs/jbd2/checkpoint.c | 2 --
1 file changed, 2 deletions(-)
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -116,8 +116,6 @@ void __jbd2_log_wait_for_space(journal_t
nblocks = jbd2_space_needed(journal);
while (jbd2_log_space_left(journal) < nblocks) {
write_unlock(&journal->j_state_lock);
- if (current->plug)
- io_schedule();
mutex_lock(&journal->j_checkpoint_mutex);
/*

View File

@ -0,0 +1,101 @@
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Date: Wed, 22 Nov 2017 07:31:19 -0500
Subject: [PATCH] Revert "memcontrol: Prevent scheduling while atomic in cgroup
code"
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The commit "memcontrol: Prevent scheduling while atomic in cgroup code"
fixed this issue:
refill_stock()
get_cpu_var()
drain_stock()
res_counter_uncharge()
res_counter_uncharge_until()
spin_lock() <== boom
But commit 3e32cb2e0a12b ("mm: memcontrol: lockless page counters") replaced
the calls to res_counter_uncharge() in drain_stock() to the lockless
function page_counter_uncharge(). There is no more spin lock there and no
more reason to have that local lock.
Cc: <stable@vger.kernel.org>
Reported-by: Haiyang HY1 Tan <tanhy1@lenovo.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
[bigeasy: That upstream commit appeared in v3.19 and the patch in
question in v3.18.7-rt2 and v3.18 seems still to be maintained. So I
guess that v3.18 would need the locallocks that we are about to remove
here. I am not sure if any earlier versions have the patch
backported.
The stable tag here is because Haiyang reported (and debugged) a crash
in 4.4-RT with this patch applied (which has get_cpu_light() instead
the locallocks it gained in v4.9-RT).
https://lkml.kernel.org/r/05AA4EC5C6EC1D48BE2CDCFF3AE0B8A637F78A15@CNMAILEX04.lenovo.com
]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
mm/memcontrol.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1723,7 +1723,6 @@ struct memcg_stock_pcp {
#define FLUSHING_CACHED_CHARGE 0
};
static DEFINE_PER_CPU(struct memcg_stock_pcp, memcg_stock);
-static DEFINE_LOCAL_IRQ_LOCK(memcg_stock_ll);
static DEFINE_MUTEX(percpu_charge_mutex);
/**
@@ -1746,7 +1745,7 @@ static bool consume_stock(struct mem_cgr
if (nr_pages > CHARGE_BATCH)
return ret;
- local_lock_irqsave(memcg_stock_ll, flags);
+ local_irq_save(flags);
stock = this_cpu_ptr(&memcg_stock);
if (memcg == stock->cached && stock->nr_pages >= nr_pages) {
@@ -1754,7 +1753,7 @@ static bool consume_stock(struct mem_cgr
ret = true;
}
- local_unlock_irqrestore(memcg_stock_ll, flags);
+ local_irq_restore(flags);
return ret;
}
@@ -1785,13 +1784,13 @@ static void drain_local_stock(struct wor
* The only protection from memory hotplug vs. drain_stock races is
* that we always operate on local CPU stock here with IRQ disabled
*/
- local_lock_irqsave(memcg_stock_ll, flags);
+ local_irq_save(flags);
stock = this_cpu_ptr(&memcg_stock);
drain_stock(stock);
clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags);
- local_unlock_irqrestore(memcg_stock_ll, flags);
+ local_irq_restore(flags);
}
/*
@@ -1803,7 +1802,7 @@ static void refill_stock(struct mem_cgro
struct memcg_stock_pcp *stock;
unsigned long flags;
- local_lock_irqsave(memcg_stock_ll, flags);
+ local_irq_save(flags);
stock = this_cpu_ptr(&memcg_stock);
if (stock->cached != memcg) { /* reset if necessary */
@@ -1815,7 +1814,7 @@ static void refill_stock(struct mem_cgro
if (stock->nr_pages > CHARGE_BATCH)
drain_stock(stock);
- local_unlock_irqrestore(memcg_stock_ll, flags);
+ local_irq_restore(flags);
}
/*

View File

@ -1,7 +1,7 @@
From: Steven Rostedt <rostedt@goodmis.org>
Date: Wed, 13 Feb 2013 09:26:05 -0500
Subject: acpi/rt: Convert acpi_gbl_hardware lock back to a raw_spinlock_t
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
We hit the following bug with 3.6-rt:

View File

@ -1,7 +1,7 @@
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Sat, 27 May 2017 19:02:06 +0200
Subject: kernel/sched/core: add migrate_disable()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
---
include/linux/preempt.h | 23 ++++++++

View File

@ -1,7 +1,7 @@
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed, 11 Oct 2017 17:43:49 +0200
Subject: apparmor: use a locallock instead preempt_disable()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
get_buffers() disables preemption which acts as a lock for the per-CPU
variable. Since we can't disable preemption here on RT, a local_lock is

View File

@ -1,7 +1,7 @@
From: Anders Roxell <anders.roxell@linaro.org>
Date: Thu, 14 May 2015 17:52:17 +0200
Subject: arch/arm64: Add lazy preempt support
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
arm64 is missing support for PREEMPT_RT. The main feature which is
lacking is support for lazy preemption. The arch-specific entry code,

View File

@ -1,7 +1,7 @@
From: Benedikt Spranger <b.spranger@linutronix.de>
Date: Sat, 6 Mar 2010 17:47:10 +0100
Subject: ARM: AT91: PIT: Remove irq handler when clock event is unused
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
Setup and remove the interrupt handler in clock event mode selection.
This avoids calling the (shared) interrupt handler when the device is

View File

@ -1,7 +1,7 @@
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 1 May 2010 18:29:35 +0200
Subject: ARM: at91: tclib: Default to tclib timer for RT
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
RT is not too happy about the shared timer interrupt in AT91
devices. Default to tclib timer for RT.

View File

@ -1,7 +1,7 @@
From: Frank Rowand <frank.rowand@am.sony.com>
Date: Mon, 19 Sep 2011 14:51:14 -0700
Subject: arm: Convert arm boot_lock to raw
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The arm boot_lock is used by the secondary processor startup code. The locking
task is the idle thread, which has idle->sched_class == &idle_sched_class.

View File

@ -1,7 +1,7 @@
Subject: arm: Enable highmem for rt
From: Thomas Gleixner <tglx@linutronix.de>
Date: Wed, 13 Feb 2013 11:03:11 +0100
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
fixup highmem for ARM.

View File

@ -1,7 +1,7 @@
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Mon, 11 Mar 2013 21:37:27 +0100
Subject: arm/highmem: Flush tlb on unmap
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14-rt1.tar.xz
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patches-4.14.1-rt3.tar.xz
The tlb should be flushed on unmap and thus make the mapping entry
invalid. This is only done in the non-debug case which does not look

Some files were not shown because too many files have changed in this diff Show More