diff options
| -rw-r--r-- | Documentation/trace/histogram.txt | 23 | ||||
| -rw-r--r-- | kernel/softirq.c | 6 | ||||
| -rw-r--r-- | kernel/trace/trace.c | 6 | ||||
| -rw-r--r-- | kernel/trace/trace_events_filter.c | 10 | ||||
| -rw-r--r-- | scripts/Makefile.build | 2 |
5 files changed, 28 insertions, 19 deletions
diff --git a/Documentation/trace/histogram.txt b/Documentation/trace/histogram.txt index e73bcf9cb5f3..7ffea6aa22e3 100644 --- a/Documentation/trace/histogram.txt +++ b/Documentation/trace/histogram.txt | |||
| @@ -1729,35 +1729,35 @@ If a variable isn't a key variable or prefixed with 'vals=', the | |||
| 1729 | associated event field will be saved in a variable but won't be summed | 1729 | associated event field will be saved in a variable but won't be summed |
| 1730 | as a value: | 1730 | as a value: |
| 1731 | 1731 | ||
| 1732 | # echo 'hist:keys=next_pid:ts1=common_timestamp ... >> event/trigger | 1732 | # echo 'hist:keys=next_pid:ts1=common_timestamp ...' >> event/trigger |
| 1733 | 1733 | ||
| 1734 | Multiple variables can be assigned at the same time. The below would | 1734 | Multiple variables can be assigned at the same time. The below would |
| 1735 | result in both ts0 and b being created as variables, with both | 1735 | result in both ts0 and b being created as variables, with both |
| 1736 | common_timestamp and field1 additionally being summed as values: | 1736 | common_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/trigger | 1739 | event/trigger |
| 1740 | 1740 | ||
| 1741 | Note that variable assignments can appear either preceding or | 1741 | Note that variable assignments can appear either preceding or |
| 1742 | following their use. The command below behaves identically to the | 1742 | following their use. The command below behaves identically to the |
| 1743 | command above: | 1743 | command 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/trigger | 1746 | event/trigger |
| 1747 | 1747 | ||
| 1748 | Any number of variables not bound to a 'vals=' prefix can also be | 1748 | Any number of variables not bound to a 'vals=' prefix can also be |
| 1749 | assigned by simply separating them with colons. Below is the same | 1749 | assigned by simply separating them with colons. Below is the same |
| 1750 | thing but without the values being summed in the histogram: | 1750 | thing but without the values being summed in the histogram: |
| 1751 | 1751 | ||
| 1752 | # echo 'hist:keys=pid:ts0=common_timestamp:b=field1 ... >> event/trigger | 1752 | # echo 'hist:keys=pid:ts0=common_timestamp:b=field1 ...' >> event/trigger |
| 1753 | 1753 | ||
| 1754 | Variables set as above can be referenced and used in expressions on | 1754 | Variables set as above can be referenced and used in expressions on |
| 1755 | another event. | 1755 | another event. |
| 1756 | 1756 | ||
| 1757 | For example, here's how a latency can be calculated: | 1757 | For example, here's how a latency can be calculated: |
| 1758 | 1758 | ||
| 1759 | # echo 'hist:keys=pid,prio:ts0=common_timestamp ... >> event1/trigger | 1759 | # echo 'hist:keys=pid,prio:ts0=common_timestamp ...' >> event1/trigger |
| 1760 | # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ... >> event2/trigger | 1760 | # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ...' >> event2/trigger |
| 1761 | 1761 | ||
| 1762 | In the first line above, the event's timetamp is saved into the | 1762 | In the first line above, the event's timetamp is saved into the |
| 1763 | variable ts0. In the next line, ts0 is subtracted from the second | 1763 | variable 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 | |||
| 1766 | makes use of the wakeup_lat variable to compute a combined latency | 1766 | makes use of the wakeup_lat variable to compute a combined latency |
| 1767 | using the same key and variable from yet another event: | 1767 | using the same key and variable from yet another event: |
| 1768 | 1768 | ||
| 1769 | # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ... >> event3/trigger | 1769 | # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ...' >> event3/trigger |
| 1770 | 1770 | ||
| 1771 | 2.2.2 Synthetic Events | 1771 | 2.2.2 Synthetic Events |
| 1772 | ---------------------- | 1772 | ---------------------- |
| @@ -1807,10 +1807,11 @@ the command that defined it with a '!': | |||
| 1807 | At this point, there isn't yet an actual 'wakeup_latency' event | 1807 | At this point, there isn't yet an actual 'wakeup_latency' event |
| 1808 | instantiated in the event subsytem - for this to happen, a 'hist | 1808 | instantiated in the event subsytem - for this to happen, a 'hist |
| 1809 | trigger action' needs to be instantiated and bound to actual fields | 1809 | trigger action' needs to be instantiated and bound to actual fields |
| 1810 | and variables defined on other events (see Section 6.3.3 below). | 1810 | and variables defined on other events (see Section 2.2.3 below on |
| 1811 | how that is done using hist trigger 'onmatch' action). Once that is | ||
| 1812 | done, the 'wakeup_latency' synthetic event instance is created. | ||
| 1811 | 1813 | ||
| 1812 | Once that is done, an event instance is created, and a histogram can | 1814 | A histogram can now be defined for the new synthetic event: |
| 1813 | be 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/trigger | 1817 | /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger |
| @@ -1960,7 +1961,7 @@ hist trigger specification. | |||
| 1960 | back to that pid, the timestamp difference is calculated. If the | 1961 | back to that pid, the timestamp difference is calculated. If the |
| 1961 | resulting latency, stored in wakeup_lat, exceeds the current | 1962 | resulting latency, stored in wakeup_lat, exceeds the current |
| 1962 | maximum latency, the values specified in the save() fields are | 1963 | 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"' >> \ |
diff --git a/kernel/softirq.c b/kernel/softirq.c index de2f57fddc04..900dcfee542c 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
| @@ -139,9 +139,13 @@ static void __local_bh_enable(unsigned int cnt) | |||
| 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 | /* |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c9336e98ac59..a0079b4c7a49 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1360,8 +1360,6 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
| 1360 | void | 1360 | void |
| 1361 | update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | 1361 | update_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) | |||
| 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); |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index e1c818dbc0d7..0dceb77d1d42 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
| @@ -78,7 +78,8 @@ static const char * ops[] = { OPS }; | |||
| 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 C | 84 | #undef C |
| 84 | #define C(a, b) FILT_ERR_##a | 85 | #define C(a, b) FILT_ERR_##a |
| @@ -550,6 +551,13 @@ predicate_parse(const char *str, int nr_parens, int nr_preds, | |||
| 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; |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 34d9e9ce97c2..e7889f486ca1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -239,6 +239,7 @@ cmd_record_mcount = \ | |||
| 239 | "$(CC_FLAGS_FTRACE)" ]; then \ | 239 | "$(CC_FLAGS_FTRACE)" ]; then \ |
| 240 | $(sub_cmd_record_mcount) \ | 240 | $(sub_cmd_record_mcount) \ |
| 241 | fi; | 241 | fi; |
| 242 | endif # -record-mcount | ||
| 242 | endif # CONFIG_FTRACE_MCOUNT_RECORD | 243 | endif # CONFIG_FTRACE_MCOUNT_RECORD |
| 243 | 244 | ||
| 244 | ifdef CONFIG_STACK_VALIDATION | 245 | ifdef CONFIG_STACK_VALIDATION |
| @@ -263,7 +264,6 @@ ifneq ($(RETPOLINE_CFLAGS),) | |||
| 263 | objtool_args += --retpoline | 264 | objtool_args += --retpoline |
| 264 | endif | 265 | endif |
| 265 | endif | 266 | endif |
| 266 | endif | ||
| 267 | 267 | ||
| 268 | 268 | ||
| 269 | ifdef CONFIG_MODVERSIONS | 269 | ifdef CONFIG_MODVERSIONS |
