From 99dd30a309b22219bf98146141f27030ab8fff33 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Wed, 28 Oct 2015 10:45:04 -0700 Subject: [PATCH] trace: fix compilation for 4.1 Change-Id: Id88b5d30847bc6d3cfe1d8cd00cbdc975c9712d1 Signed-off-by: Dmitry Shmidt --- kernel/trace/trace.c | 10 ++++---- kernel/trace/trace_output.c | 50 +++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 225d450cd84d..5f375d4c05fb 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1352,7 +1352,7 @@ void tracing_reset_all_online_cpus(void) #define SAVED_CMDLINES_DEFAULT 128 #define NO_CMDLINE_MAP UINT_MAX -static unsigned saved_tgids[SAVED_CMDLINES]; +static unsigned saved_tgids[SAVED_CMDLINES_DEFAULT]; static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED; struct saved_cmdlines_buffer { unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1]; @@ -1641,7 +1641,7 @@ int trace_find_tgid(int pid) preempt_disable(); arch_spin_lock(&trace_cmdline_lock); - map = map_pid_to_cmdline[pid]; + map = savedcmd->map_pid_to_cmdline[pid]; if (map != NO_CMDLINE_MAP) tgid = saved_tgids[map]; else @@ -4215,17 +4215,17 @@ tracing_saved_tgids_read(struct file *file, char __user *ubuf, int pid; int i; - file_buf = kmalloc(SAVED_CMDLINES*(16+1+16), GFP_KERNEL); + file_buf = kmalloc(SAVED_CMDLINES_DEFAULT*(16+1+16), GFP_KERNEL); if (!file_buf) return -ENOMEM; buf = file_buf; - for (i = 0; i < SAVED_CMDLINES; i++) { + for (i = 0; i < SAVED_CMDLINES_DEFAULT; i++) { int tgid; int r; - pid = map_cmdline_to_pid[i]; + pid = savedcmd->map_cmdline_to_pid[i]; if (pid == -1 || pid == NO_CMDLINE_MAP) continue; diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index d03ecf65ad53..3bc4b6de0f4d 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -864,13 +864,15 @@ static enum print_line_t trace_graph_ent_trace(struct trace_iterator *iter, int trace_assign_type(field, iter->ent); - if (!trace_seq_puts(s, "graph_ent: func=")) + trace_seq_puts(s, "graph_ent: func="); + if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; if (!seq_print_ip_sym(s, field->graph_ent.func, flags)) return TRACE_TYPE_PARTIAL_LINE; - if (!trace_seq_puts(s, "\n")) + trace_seq_puts(s, "\n"); + if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_HANDLED; @@ -883,9 +885,10 @@ static enum print_line_t trace_graph_ent_raw(struct trace_iterator *iter, int fl trace_assign_type(field, iter->ent); - if (!trace_seq_printf(&iter->seq, "%lx %d\n", + trace_seq_printf(&iter->seq, "%lx %d\n", field->graph_ent.func, - field->graph_ent.depth)) + field->graph_ent.depth); + if (trace_seq_has_overflowed(&iter->seq)) return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_HANDLED; @@ -899,8 +902,8 @@ static enum print_line_t trace_graph_ent_hex(struct trace_iterator *iter, int fl trace_assign_type(field, iter->ent); - SEQ_PUT_HEX_FIELD_RET(s, field->graph_ent.func); - SEQ_PUT_HEX_FIELD_RET(s, field->graph_ent.depth); + SEQ_PUT_HEX_FIELD(s, field->graph_ent.func); + SEQ_PUT_HEX_FIELD(s, field->graph_ent.depth); return TRACE_TYPE_HANDLED; } @@ -913,8 +916,8 @@ static enum print_line_t trace_graph_ent_bin(struct trace_iterator *iter, int fl trace_assign_type(field, iter->ent); - SEQ_PUT_FIELD_RET(s, field->graph_ent.func); - SEQ_PUT_FIELD_RET(s, field->graph_ent.depth); + SEQ_PUT_FIELD(s, field->graph_ent.func); + SEQ_PUT_FIELD(s, field->graph_ent.depth); return TRACE_TYPE_HANDLED; } @@ -941,13 +944,15 @@ static enum print_line_t trace_graph_ret_trace(struct trace_iterator *iter, int trace_assign_type(field, entry); - if (!trace_seq_puts(s, "graph_ret: func=")) + trace_seq_puts(s, "graph_ret: func="); + if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; if (!seq_print_ip_sym(s, field->ret.func, flags)) return TRACE_TYPE_PARTIAL_LINE; - if (!trace_seq_puts(s, "\n")) + trace_seq_puts(s, "\n"); + if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_HANDLED; @@ -960,12 +965,13 @@ static enum print_line_t trace_graph_ret_raw(struct trace_iterator *iter, int fl trace_assign_type(field, iter->ent); - if (!trace_seq_printf(&iter->seq, "%lx %lld %lld %ld %d\n", + trace_seq_printf(&iter->seq, "%lx %lld %lld %ld %d\n", field->ret.func, field->ret.calltime, field->ret.rettime, field->ret.overrun, - field->ret.depth)); + field->ret.depth); + if (trace_seq_has_overflowed(&iter->seq)) return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_HANDLED; @@ -979,11 +985,11 @@ static enum print_line_t trace_graph_ret_hex(struct trace_iterator *iter, int fl trace_assign_type(field, iter->ent); - SEQ_PUT_HEX_FIELD_RET(s, field->ret.func); - SEQ_PUT_HEX_FIELD_RET(s, field->ret.calltime); - SEQ_PUT_HEX_FIELD_RET(s, field->ret.rettime); - SEQ_PUT_HEX_FIELD_RET(s, field->ret.overrun); - SEQ_PUT_HEX_FIELD_RET(s, field->ret.depth); + SEQ_PUT_HEX_FIELD(s, field->ret.func); + SEQ_PUT_HEX_FIELD(s, field->ret.calltime); + SEQ_PUT_HEX_FIELD(s, field->ret.rettime); + SEQ_PUT_HEX_FIELD(s, field->ret.overrun); + SEQ_PUT_HEX_FIELD(s, field->ret.depth); return TRACE_TYPE_HANDLED; } @@ -996,11 +1002,11 @@ static enum print_line_t trace_graph_ret_bin(struct trace_iterator *iter, int fl trace_assign_type(field, iter->ent); - SEQ_PUT_FIELD_RET(s, field->ret.func); - SEQ_PUT_FIELD_RET(s, field->ret.calltime); - SEQ_PUT_FIELD_RET(s, field->ret.rettime); - SEQ_PUT_FIELD_RET(s, field->ret.overrun); - SEQ_PUT_FIELD_RET(s, field->ret.depth); + SEQ_PUT_FIELD(s, field->ret.func); + SEQ_PUT_FIELD(s, field->ret.calltime); + SEQ_PUT_FIELD(s, field->ret.rettime); + SEQ_PUT_FIELD(s, field->ret.overrun); + SEQ_PUT_FIELD(s, field->ret.depth); return TRACE_TYPE_HANDLED; } -- 2.34.1