aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ring_buffer.c4
-rw-r--r--kernel/trace/trace.c39
2 files changed, 18 insertions, 25 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index eab81f918f6a..bb6922a931b1 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -258,7 +258,6 @@ struct ring_buffer_per_cpu {
258}; 258};
259 259
260struct ring_buffer { 260struct ring_buffer {
261 unsigned long size;
262 unsigned pages; 261 unsigned pages;
263 unsigned flags; 262 unsigned flags;
264 int cpus; 263 int cpus;
@@ -2210,8 +2209,7 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
2210 return -EINVAL; 2209 return -EINVAL;
2211 2210
2212 /* At least make sure the two buffers are somewhat the same */ 2211 /* At least make sure the two buffers are somewhat the same */
2213 if (buffer_a->size != buffer_b->size || 2212 if (buffer_a->pages != buffer_b->pages)
2214 buffer_a->pages != buffer_b->pages)
2215 return -EINVAL; 2213 return -EINVAL;
2216 2214
2217 cpu_buffer_a = buffer_a->buffers[cpu]; 2215 cpu_buffer_a = buffer_a->buffers[cpu];
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 49fc7201295e..0eb6d48347f7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1748,6 +1748,13 @@ lat_print_timestamp(struct trace_seq *s, u64 abs_usecs,
1748 1748
1749static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; 1749static const char state_to_char[] = TASK_STATE_TO_CHAR_STR;
1750 1750
1751static int task_state_char(unsigned long state)
1752{
1753 int bit = state ? __ffs(state) + 1 : 0;
1754
1755 return bit < sizeof(state_to_char) - 1 ? state_to_char[bit] : '?';
1756}
1757
1751/* 1758/*
1752 * The message is supposed to contain an ending newline. 1759 * The message is supposed to contain an ending newline.
1753 * If the printing stops prematurely, try to add a newline of our own. 1760 * If the printing stops prematurely, try to add a newline of our own.
@@ -1861,12 +1868,8 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1861 1868
1862 trace_assign_type(field, entry); 1869 trace_assign_type(field, entry);
1863 1870
1864 T = field->next_state < sizeof(state_to_char) ? 1871 T = task_state_char(field->next_state);
1865 state_to_char[field->next_state] : 'X'; 1872 S = task_state_char(field->prev_state);
1866
1867 state = field->prev_state ?
1868 __ffs(field->prev_state) + 1 : 0;
1869 S = state < sizeof(state_to_char) - 1 ? state_to_char[state] : 'X';
1870 comm = trace_find_cmdline(field->next_pid); 1873 comm = trace_find_cmdline(field->next_pid);
1871 trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", 1874 trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
1872 field->prev_pid, 1875 field->prev_pid,
@@ -2007,10 +2010,8 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
2007 2010
2008 trace_assign_type(field, entry); 2011 trace_assign_type(field, entry);
2009 2012
2010 S = field->prev_state < sizeof(state_to_char) ? 2013 T = task_state_char(field->next_state);
2011 state_to_char[field->prev_state] : 'X'; 2014 S = task_state_char(field->prev_state);
2012 T = field->next_state < sizeof(state_to_char) ?
2013 state_to_char[field->next_state] : 'X';
2014 ret = trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c\n", 2015 ret = trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c\n",
2015 field->prev_pid, 2016 field->prev_pid,
2016 field->prev_prio, 2017 field->prev_prio,
@@ -2140,12 +2141,9 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
2140 2141
2141 trace_assign_type(field, entry); 2142 trace_assign_type(field, entry);
2142 2143
2143 S = field->prev_state < sizeof(state_to_char) ? 2144 T = task_state_char(field->next_state);
2144 state_to_char[field->prev_state] : 'X'; 2145 S = entry->type == TRACE_WAKE ? '+' :
2145 T = field->next_state < sizeof(state_to_char) ? 2146 task_state_char(field->prev_state);
2146 state_to_char[field->next_state] : 'X';
2147 if (entry->type == TRACE_WAKE)
2148 S = '+';
2149 ret = trace_seq_printf(s, "%d %d %c %d %d %d %c\n", 2147 ret = trace_seq_printf(s, "%d %d %c %d %d %d %c\n",
2150 field->prev_pid, 2148 field->prev_pid,
2151 field->prev_prio, 2149 field->prev_prio,
@@ -2232,12 +2230,9 @@ static enum print_line_t print_hex_fmt(struct trace_iterator *iter)
2232 2230
2233 trace_assign_type(field, entry); 2231 trace_assign_type(field, entry);
2234 2232
2235 S = field->prev_state < sizeof(state_to_char) ? 2233 T = task_state_char(field->next_state);
2236 state_to_char[field->prev_state] : 'X'; 2234 S = entry->type == TRACE_WAKE ? '+' :
2237 T = field->next_state < sizeof(state_to_char) ? 2235 task_state_char(field->prev_state);
2238 state_to_char[field->next_state] : 'X';
2239 if (entry->type == TRACE_WAKE)
2240 S = '+';
2241 SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid); 2236 SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid);
2242 SEQ_PUT_HEX_FIELD_RET(s, field->prev_prio); 2237 SEQ_PUT_HEX_FIELD_RET(s, field->prev_prio);
2243 SEQ_PUT_HEX_FIELD_RET(s, S); 2238 SEQ_PUT_HEX_FIELD_RET(s, S);