History

Merge tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt: "This contains a few fixes and a clean up. - a bad merge caused an "endif" to go in the wrong place in scripts/Makefile.build - softirq tracing fix for tracing that corrupts lockdep and causes a false splat - histogram documentation typo fixes - fix a bad memory reference when passing in no filter to the filter code - simplify code by using the swap macro instead of open coding the swap" * tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount tracing: Fix some errors in histogram documentation tracing: Use swap macro in update_max_tr softirq: Reorder trace_softirqs_on to prevent lockdep splat tracing: Check for no filter when processing event filters

Linus Torvalds committed 8 years ago

Commit 81f9c4e2 parents 5e22048 ed7d40b5 files · +28 −19Browse files

Unified · Split

5 files
  1. Documentation/trace/histogram.txt +12 −11
  2. kernel/softirq.c +5 −1
  3. kernel/trace/trace.c +1 −5
  4. kernel/trace/trace_events_filter.c +9 −1
  5. scripts/Makefile.build +1 −1
Documentation/trace/histogram.txt+12−11
@@ -1729,35 +1729,35 @@ If a variable isn't a key variable or prefixed with 'vals=', the · 1728 unmodified lines
1729associated event field will be saved in a variable but won't be summed1729associated event field will be saved in a variable but won't be summed
1730as a value:1730as a value:
1731 1731
1732 # echo 'hist:keys=next_pid:ts1=common_timestamp ... >> event/trigger1732 # echo 'hist:keys=next_pid:ts1=common_timestamp ...' >> event/trigger
1733 1733
1734Multiple variables can be assigned at the same time. The below would1734Multiple variables can be assigned at the same time. The below would
1735result in both ts0 and b being created as variables, with both1735result in both ts0 and b being created as variables, with both
1736common_timestamp and field1 additionally being summed as values:1736common_timestamp and field1 additionally being summed as values:
1737 1737
1738 # echo 'hist:keys=pid:vals=$ts0,$b:ts0=common_timestamp,b=field1 ... >> \1738 # echo 'hist:keys=pid:vals=$ts0,$b:ts0=common_timestamp,b=field1 ...' >> \
1739 event/trigger1739 event/trigger
1740 1740
1741Note that variable assignments can appear either preceding or1741Note that variable assignments can appear either preceding or
1742following their use. The command below behaves identically to the1742following their use. The command below behaves identically to the
1743command above:1743command above:
1744 1744
1745 # echo 'hist:keys=pid:ts0=common_timestamp,b=field1:vals=$ts0,$b ... >> \1745 # echo 'hist:keys=pid:ts0=common_timestamp,b=field1:vals=$ts0,$b ...' >> \
1746 event/trigger1746 event/trigger
1747 1747
1748Any number of variables not bound to a 'vals=' prefix can also be1748Any number of variables not bound to a 'vals=' prefix can also be
1749assigned by simply separating them with colons. Below is the same1749assigned by simply separating them with colons. Below is the same
1750thing but without the values being summed in the histogram:1750thing but without the values being summed in the histogram:
1751 1751
1752 # echo 'hist:keys=pid:ts0=common_timestamp:b=field1 ... >> event/trigger1752 # echo 'hist:keys=pid:ts0=common_timestamp:b=field1 ...' >> event/trigger
1753 1753
1754Variables set as above can be referenced and used in expressions on1754Variables set as above can be referenced and used in expressions on
1755another event.1755another event.
1756 1756
1757For example, here's how a latency can be calculated:1757For example, here's how a latency can be calculated:
1758 1758
1759 # echo 'hist:keys=pid,prio:ts0=common_timestamp ... >> event1/trigger1759 # echo 'hist:keys=pid,prio:ts0=common_timestamp ...' >> event1/trigger
1760 # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ... >> event2/trigger1760 # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ...' >> event2/trigger
1761 1761
1762In the first line above, the event's timetamp is saved into the1762In the first line above, the event's timetamp is saved into the
1763variable ts0. In the next line, ts0 is subtracted from the second1763variable ts0. In the next line, ts0 is subtracted from the second
@@ -1766,7 +1766,7 @@ yet another variable, 'wakeup_lat'. The hist trigger below in turn · 2 unmodified lines
1766makes use of the wakeup_lat variable to compute a combined latency1766makes use of the wakeup_lat variable to compute a combined latency
1767using the same key and variable from yet another event:1767using the same key and variable from yet another event:
1768 1768
1769 # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ... >> event3/trigger1769 # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ...' >> event3/trigger
1770 1770
17712.2.2 Synthetic Events17712.2.2 Synthetic Events
1772----------------------1772----------------------
@@ -1807,10 +1807,11 @@ the command that defined it with a '!': · 34 unmodified lines
1807At this point, there isn't yet an actual 'wakeup_latency' event1807At this point, there isn't yet an actual 'wakeup_latency' event
1808instantiated in the event subsytem - for this to happen, a 'hist1808instantiated in the event subsytem - for this to happen, a 'hist
1809trigger action' needs to be instantiated and bound to actual fields1809trigger action' needs to be instantiated and bound to actual fields
1810and variables defined on other events (see Section 6.3.3 below).1810and variables defined on other events (see Section 2.2.3 below on
1811how that is done using hist trigger 'onmatch' action). Once that is
1812done, the 'wakeup_latency' synthetic event instance is created.
1811 1813
1812Once that is done, an event instance is created, and a histogram can1814A histogram can now be defined for the new synthetic event:
1813be defined using it:
1814 1815
1815 # echo 'hist:keys=pid,prio,lat.log2:sort=pid,lat' >> \1816 # echo 'hist:keys=pid,prio,lat.log2:sort=pid,lat' >> \
1816 /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger1817 /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger
@@ -1960,7 +1961,7 @@ hist trigger specification. · 143 unmodified lines
1960 back to that pid, the timestamp difference is calculated. If the1961 back to that pid, the timestamp difference is calculated. If the
1961 resulting latency, stored in wakeup_lat, exceeds the current1962 resulting latency, stored in wakeup_lat, exceeds the current
1962 maximum latency, the values specified in the save() fields are1963 maximum latency, the values specified in the save() fields are
1963 recoreded:1964 recorded:
1964 1965
1965 # echo 'hist:keys=pid:ts0=common_timestamp.usecs \1966 # echo 'hist:keys=pid:ts0=common_timestamp.usecs \
1966 if comm=="cyclictest"' >> \1967 if comm=="cyclictest"' >> \
kernel/softirq.c+5−1
@@ -139,9 +139,13 @@ static void __local_bh_enable(unsigned int cnt) · 138 unmodified lines
139{139{
140 lockdep_assert_irqs_disabled();140 lockdep_assert_irqs_disabled();
141 141
142 if (preempt_count() == cnt)
143 trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip());
144
142 if (softirq_count() == (cnt & SOFTIRQ_MASK))145 if (softirq_count() == (cnt & SOFTIRQ_MASK))
143 trace_softirqs_on(_RET_IP_);146 trace_softirqs_on(_RET_IP_);
144 preempt_count_sub(cnt);147
148 __preempt_count_sub(cnt);
145}149}
146 150
147/*151/*
kernel/trace/trace.c+1−5
@@ -1360,8 +1360,6 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) · 1359 unmodified lines
1360void1360void
1361update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)1361update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
1362{1362{
1363 struct ring_buffer *buf;
1364
1365 if (tr->stop_count)1363 if (tr->stop_count)
1366 return;1364 return;
1367 1365
@@ -1375,9 +1373,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) · 7 unmodified lines
1375 1373
1376 arch_spin_lock(&tr->max_lock);1374 arch_spin_lock(&tr->max_lock);
1377 1375
1378 buf = tr->trace_buffer.buffer;1376 swap(tr->trace_buffer.buffer, tr->max_buffer.buffer);
1379 tr->trace_buffer.buffer = tr->max_buffer.buffer;
1380 tr->max_buffer.buffer = buf;
1381 1377
1382 __update_max_tr(tr, tsk, cpu);1378 __update_max_tr(tr, tsk, cpu);
1383 arch_spin_unlock(&tr->max_lock);1379 arch_spin_unlock(&tr->max_lock);
kernel/trace/trace_events_filter.c+9−1
@@ -78,7 +78,8 @@ static const char * ops[] = { OPS }; · 77 unmodified lines
78 C(TOO_MANY_PREDS, "Too many terms in predicate expression"), \78 C(TOO_MANY_PREDS, "Too many terms in predicate expression"), \
79 C(INVALID_FILTER, "Meaningless filter expression"), \79 C(INVALID_FILTER, "Meaningless filter expression"), \
80 C(IP_FIELD_ONLY, "Only 'ip' field is supported for function trace"), \80 C(IP_FIELD_ONLY, "Only 'ip' field is supported for function trace"), \
81 C(INVALID_VALUE, "Invalid value (did you forget quotes)?"),81 C(INVALID_VALUE, "Invalid value (did you forget quotes)?"), \
82 C(NO_FILTER, "No filter found"),
82 83
83#undef C84#undef C
84#define C(a, b) FILT_ERR_##a85#define C(a, b) FILT_ERR_##a
@@ -550,6 +551,13 @@ predicate_parse(const char *str, int nr_parens, int nr_preds, · 465 unmodified lines
550 goto out_free;551 goto out_free;
551 }552 }
552 553
554 if (!N) {
555 /* No program? */
556 ret = -EINVAL;
557 parse_error(pe, FILT_ERR_NO_FILTER, ptr - str);
558 goto out_free;
559 }
560
553 prog[N].pred = NULL; /* #13 */561 prog[N].pred = NULL; /* #13 */
554 prog[N].target = 1; /* TRUE */562 prog[N].target = 1; /* TRUE */
555 prog[N+1].pred = NULL;563 prog[N+1].pred = NULL;
scripts/Makefile.build+1−1
@@ -239,6 +239,7 @@ cmd_record_mcount = \ · 238 unmodified lines
239 "$(CC_FLAGS_FTRACE)" ]; then \239 "$(CC_FLAGS_FTRACE)" ]; then \
240 $(sub_cmd_record_mcount) \240 $(sub_cmd_record_mcount) \
241 fi;241 fi;
242endif # -record-mcount
242endif # CONFIG_FTRACE_MCOUNT_RECORD243endif # CONFIG_FTRACE_MCOUNT_RECORD
243 244
244ifdef CONFIG_STACK_VALIDATION245ifdef CONFIG_STACK_VALIDATION
@@ -263,7 +264,6 @@ ifneq ($(RETPOLINE_CFLAGS),) · 18 unmodified lines
263 objtool_args += --retpoline264 objtool_args += --retpoline
264endif265endif
265endif266endif
266endif
267 267
268 268
269ifdef CONFIG_MODVERSIONS269ifdef CONFIG_MODVERSIONS