aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-06-03 05:50:18 -0400
committerIngo Molnar <mingo@kernel.org>2019-06-03 05:50:18 -0400
commit26b73da3604cc1a6596406d136b14d1a01c3676f (patch)
treec7839809e35fce4868910742157e8ef96782b378 /kernel/trace
parent5ca584d935c32906d114924dc0e1dbfcbb13fdb2 (diff)
parentf2c7c76c5d0a443053e94adb9f0918fa2fb85c3a (diff)
Merge tag 'v5.2-rc3' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c6
-rw-r--r--kernel/trace/trace.h19
-rw-r--r--kernel/trace/trace_events_filter.c8
-rw-r--r--kernel/trace/trace_events_hist.c13
-rw-r--r--kernel/trace/trace_kdb.c6
5 files changed, 37 insertions, 15 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2c92b3d9ea30..1c80521fd436 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -8910,12 +8910,8 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mode)
8910 8910
8911 cnt++; 8911 cnt++;
8912 8912
8913 /* reset all but tr, trace, and overruns */ 8913 trace_iterator_reset(&iter);
8914 memset(&iter.seq, 0,
8915 sizeof(struct trace_iterator) -
8916 offsetof(struct trace_iterator, seq));
8917 iter.iter_flags |= TRACE_FILE_LAT_FMT; 8914 iter.iter_flags |= TRACE_FILE_LAT_FMT;
8918 iter.pos = -1;
8919 8915
8920 if (trace_find_next_entry_inc(&iter) != NULL) { 8916 if (trace_find_next_entry_inc(&iter) != NULL) {
8921 int ret; 8917 int ret;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 1974ce818ddb..005f08629b8b 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -15,7 +15,6 @@
15#include <linux/trace_seq.h> 15#include <linux/trace_seq.h>
16#include <linux/trace_events.h> 16#include <linux/trace_events.h>
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/trace_seq.h>
19#include <linux/glob.h> 18#include <linux/glob.h>
20 19
21#ifdef CONFIG_FTRACE_SYSCALLS 20#ifdef CONFIG_FTRACE_SYSCALLS
@@ -1967,4 +1966,22 @@ static inline void tracer_hardirqs_off(unsigned long a0, unsigned long a1) { }
1967 1966
1968extern struct trace_iterator *tracepoint_print_iter; 1967extern struct trace_iterator *tracepoint_print_iter;
1969 1968
1969/*
1970 * Reset the state of the trace_iterator so that it can read consumed data.
1971 * Normally, the trace_iterator is used for reading the data when it is not
1972 * consumed, and must retain state.
1973 */
1974static __always_inline void trace_iterator_reset(struct trace_iterator *iter)
1975{
1976 const size_t offset = offsetof(struct trace_iterator, seq);
1977
1978 /*
1979 * Keep gcc from complaining about overwriting more than just one
1980 * member in the structure.
1981 */
1982 memset((char *)iter + offset, 0, sizeof(struct trace_iterator) - offset);
1983
1984 iter->pos = -1;
1985}
1986
1970#endif /* _LINUX_KERNEL_TRACE_H */ 1987#endif /* _LINUX_KERNEL_TRACE_H */
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index d3e59312ef40..5079d1db3754 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -428,7 +428,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
428 op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL); 428 op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL);
429 if (!op_stack) 429 if (!op_stack)
430 return ERR_PTR(-ENOMEM); 430 return ERR_PTR(-ENOMEM);
431 prog_stack = kmalloc_array(nr_preds, sizeof(*prog_stack), GFP_KERNEL); 431 prog_stack = kcalloc(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
432 if (!prog_stack) { 432 if (!prog_stack) {
433 parse_error(pe, -ENOMEM, 0); 433 parse_error(pe, -ENOMEM, 0);
434 goto out_free; 434 goto out_free;
@@ -579,7 +579,11 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
579out_free: 579out_free:
580 kfree(op_stack); 580 kfree(op_stack);
581 kfree(inverts); 581 kfree(inverts);
582 kfree(prog_stack); 582 if (prog_stack) {
583 for (i = 0; prog_stack[i].pred; i++)
584 kfree(prog_stack[i].pred);
585 kfree(prog_stack);
586 }
583 return ERR_PTR(ret); 587 return ERR_PTR(ret);
584} 588}
585 589
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 7fca3457c705..ca6b0dff60c5 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -59,7 +59,7 @@
59 C(NO_CLOSING_PAREN, "No closing paren found"), \ 59 C(NO_CLOSING_PAREN, "No closing paren found"), \
60 C(SUBSYS_NOT_FOUND, "Missing subsystem"), \ 60 C(SUBSYS_NOT_FOUND, "Missing subsystem"), \
61 C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"), \ 61 C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"), \
62 C(INVALID_REF_KEY, "Using variable references as keys not supported"), \ 62 C(INVALID_REF_KEY, "Using variable references in keys not supported"), \
63 C(VAR_NOT_FOUND, "Couldn't find variable"), \ 63 C(VAR_NOT_FOUND, "Couldn't find variable"), \
64 C(FIELD_NOT_FOUND, "Couldn't find field"), 64 C(FIELD_NOT_FOUND, "Couldn't find field"),
65 65
@@ -1854,6 +1854,9 @@ static u64 hist_field_var_ref(struct hist_field *hist_field,
1854 struct hist_elt_data *elt_data; 1854 struct hist_elt_data *elt_data;
1855 u64 var_val = 0; 1855 u64 var_val = 0;
1856 1856
1857 if (WARN_ON_ONCE(!elt))
1858 return var_val;
1859
1857 elt_data = elt->private_data; 1860 elt_data = elt->private_data;
1858 var_val = elt_data->var_ref_vals[hist_field->var_ref_idx]; 1861 var_val = elt_data->var_ref_vals[hist_field->var_ref_idx];
1859 1862
@@ -3582,14 +3585,20 @@ static bool cond_snapshot_update(struct trace_array *tr, void *cond_data)
3582 struct track_data *track_data = tr->cond_snapshot->cond_data; 3585 struct track_data *track_data = tr->cond_snapshot->cond_data;
3583 struct hist_elt_data *elt_data, *track_elt_data; 3586 struct hist_elt_data *elt_data, *track_elt_data;
3584 struct snapshot_context *context = cond_data; 3587 struct snapshot_context *context = cond_data;
3588 struct action_data *action;
3585 u64 track_val; 3589 u64 track_val;
3586 3590
3587 if (!track_data) 3591 if (!track_data)
3588 return false; 3592 return false;
3589 3593
3594 action = track_data->action_data;
3595
3590 track_val = get_track_val(track_data->hist_data, context->elt, 3596 track_val = get_track_val(track_data->hist_data, context->elt,
3591 track_data->action_data); 3597 track_data->action_data);
3592 3598
3599 if (!action->track_data.check_val(track_data->track_val, track_val))
3600 return false;
3601
3593 track_data->track_val = track_val; 3602 track_data->track_val = track_val;
3594 memcpy(track_data->key, context->key, track_data->key_len); 3603 memcpy(track_data->key, context->key, track_data->key_len);
3595 3604
@@ -4503,7 +4512,7 @@ static int create_key_field(struct hist_trigger_data *hist_data,
4503 goto out; 4512 goto out;
4504 } 4513 }
4505 4514
4506 if (hist_field->flags & HIST_FIELD_FL_VAR_REF) { 4515 if (field_has_hist_vars(hist_field, 0)) {
4507 hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str)); 4516 hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str));
4508 destroy_hist_field(hist_field, 0); 4517 destroy_hist_field(hist_field, 0);
4509 ret = -EINVAL; 4518 ret = -EINVAL;
diff --git a/kernel/trace/trace_kdb.c b/kernel/trace/trace_kdb.c
index 6c1ae6b752d1..cca65044c14c 100644
--- a/kernel/trace/trace_kdb.c
+++ b/kernel/trace/trace_kdb.c
@@ -37,12 +37,8 @@ static void ftrace_dump_buf(int skip_entries, long cpu_file)
37 if (skip_entries) 37 if (skip_entries)
38 kdb_printf("(skipping %d entries)\n", skip_entries); 38 kdb_printf("(skipping %d entries)\n", skip_entries);
39 39
40 /* reset all but tr, trace, and overruns */ 40 trace_iterator_reset(&iter);
41 memset(&iter.seq, 0,
42 sizeof(struct trace_iterator) -
43 offsetof(struct trace_iterator, seq));
44 iter.iter_flags |= TRACE_FILE_LAT_FMT; 41 iter.iter_flags |= TRACE_FILE_LAT_FMT;
45 iter.pos = -1;
46 42
47 if (cpu_file == RING_BUFFER_ALL_CPUS) { 43 if (cpu_file == RING_BUFFER_ALL_CPUS) {
48 for_each_tracing_cpu(cpu) { 44 for_each_tracing_cpu(cpu) {