diff options
Diffstat (limited to 'kernel/trace/trace_mmiotrace.c')
-rw-r--r-- | kernel/trace/trace_mmiotrace.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index 80e503ef6136..8e37fcddd8b4 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/atomic.h> | 12 | #include <asm/atomic.h> |
13 | 13 | ||
14 | #include "trace.h" | 14 | #include "trace.h" |
15 | #include "trace_output.h" | ||
15 | 16 | ||
16 | struct header_iter { | 17 | struct header_iter { |
17 | struct pci_dev *dev; | 18 | struct pci_dev *dev; |
@@ -183,21 +184,22 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter) | |||
183 | switch (rw->opcode) { | 184 | switch (rw->opcode) { |
184 | case MMIO_READ: | 185 | case MMIO_READ: |
185 | ret = trace_seq_printf(s, | 186 | ret = trace_seq_printf(s, |
186 | "R %d %lu.%06lu %d 0x%llx 0x%lx 0x%lx %d\n", | 187 | "R %d %u.%06lu %d 0x%llx 0x%lx 0x%lx %d\n", |
187 | rw->width, secs, usec_rem, rw->map_id, | 188 | rw->width, secs, usec_rem, rw->map_id, |
188 | (unsigned long long)rw->phys, | 189 | (unsigned long long)rw->phys, |
189 | rw->value, rw->pc, 0); | 190 | rw->value, rw->pc, 0); |
190 | break; | 191 | break; |
191 | case MMIO_WRITE: | 192 | case MMIO_WRITE: |
192 | ret = trace_seq_printf(s, | 193 | ret = trace_seq_printf(s, |
193 | "W %d %lu.%06lu %d 0x%llx 0x%lx 0x%lx %d\n", | 194 | "W %d %u.%06lu %d 0x%llx 0x%lx 0x%lx %d\n", |
194 | rw->width, secs, usec_rem, rw->map_id, | 195 | rw->width, secs, usec_rem, rw->map_id, |
195 | (unsigned long long)rw->phys, | 196 | (unsigned long long)rw->phys, |
196 | rw->value, rw->pc, 0); | 197 | rw->value, rw->pc, 0); |
197 | break; | 198 | break; |
198 | case MMIO_UNKNOWN_OP: | 199 | case MMIO_UNKNOWN_OP: |
199 | ret = trace_seq_printf(s, | 200 | ret = trace_seq_printf(s, |
200 | "UNKNOWN %lu.%06lu %d 0x%llx %02x,%02x,%02x 0x%lx %d\n", | 201 | "UNKNOWN %u.%06lu %d 0x%llx %02lx,%02lx," |
202 | "%02lx 0x%lx %d\n", | ||
201 | secs, usec_rem, rw->map_id, | 203 | secs, usec_rem, rw->map_id, |
202 | (unsigned long long)rw->phys, | 204 | (unsigned long long)rw->phys, |
203 | (rw->value >> 16) & 0xff, (rw->value >> 8) & 0xff, | 205 | (rw->value >> 16) & 0xff, (rw->value >> 8) & 0xff, |
@@ -229,14 +231,14 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter) | |||
229 | switch (m->opcode) { | 231 | switch (m->opcode) { |
230 | case MMIO_PROBE: | 232 | case MMIO_PROBE: |
231 | ret = trace_seq_printf(s, | 233 | ret = trace_seq_printf(s, |
232 | "MAP %lu.%06lu %d 0x%llx 0x%lx 0x%lx 0x%lx %d\n", | 234 | "MAP %u.%06lu %d 0x%llx 0x%lx 0x%lx 0x%lx %d\n", |
233 | secs, usec_rem, m->map_id, | 235 | secs, usec_rem, m->map_id, |
234 | (unsigned long long)m->phys, m->virt, m->len, | 236 | (unsigned long long)m->phys, m->virt, m->len, |
235 | 0UL, 0); | 237 | 0UL, 0); |
236 | break; | 238 | break; |
237 | case MMIO_UNPROBE: | 239 | case MMIO_UNPROBE: |
238 | ret = trace_seq_printf(s, | 240 | ret = trace_seq_printf(s, |
239 | "UNMAP %lu.%06lu %d 0x%lx %d\n", | 241 | "UNMAP %u.%06lu %d 0x%lx %d\n", |
240 | secs, usec_rem, m->map_id, 0UL, 0); | 242 | secs, usec_rem, m->map_id, 0UL, 0); |
241 | break; | 243 | break; |
242 | default: | 244 | default: |
@@ -255,18 +257,15 @@ static enum print_line_t mmio_print_mark(struct trace_iterator *iter) | |||
255 | const char *msg = print->buf; | 257 | const char *msg = print->buf; |
256 | struct trace_seq *s = &iter->seq; | 258 | struct trace_seq *s = &iter->seq; |
257 | unsigned long long t = ns2usecs(iter->ts); | 259 | unsigned long long t = ns2usecs(iter->ts); |
258 | unsigned long usec_rem = do_div(t, 1000000ULL); | 260 | unsigned long usec_rem = do_div(t, USEC_PER_SEC); |
259 | unsigned secs = (unsigned long)t; | 261 | unsigned secs = (unsigned long)t; |
260 | int ret; | 262 | int ret; |
261 | 263 | ||
262 | /* The trailing newline must be in the message. */ | 264 | /* The trailing newline must be in the message. */ |
263 | ret = trace_seq_printf(s, "MARK %lu.%06lu %s", secs, usec_rem, msg); | 265 | ret = trace_seq_printf(s, "MARK %u.%06lu %s", secs, usec_rem, msg); |
264 | if (!ret) | 266 | if (!ret) |
265 | return TRACE_TYPE_PARTIAL_LINE; | 267 | return TRACE_TYPE_PARTIAL_LINE; |
266 | 268 | ||
267 | if (entry->flags & TRACE_FLAG_CONT) | ||
268 | trace_seq_print_cont(s, iter); | ||
269 | |||
270 | return TRACE_TYPE_HANDLED; | 269 | return TRACE_TYPE_HANDLED; |
271 | } | 270 | } |
272 | 271 | ||
@@ -308,21 +307,17 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, | |||
308 | { | 307 | { |
309 | struct ring_buffer_event *event; | 308 | struct ring_buffer_event *event; |
310 | struct trace_mmiotrace_rw *entry; | 309 | struct trace_mmiotrace_rw *entry; |
311 | unsigned long irq_flags; | 310 | int pc = preempt_count(); |
312 | 311 | ||
313 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), | 312 | event = trace_buffer_lock_reserve(tr, TRACE_MMIO_RW, |
314 | &irq_flags); | 313 | sizeof(*entry), 0, pc); |
315 | if (!event) { | 314 | if (!event) { |
316 | atomic_inc(&dropped_count); | 315 | atomic_inc(&dropped_count); |
317 | return; | 316 | return; |
318 | } | 317 | } |
319 | entry = ring_buffer_event_data(event); | 318 | entry = ring_buffer_event_data(event); |
320 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); | ||
321 | entry->ent.type = TRACE_MMIO_RW; | ||
322 | entry->rw = *rw; | 319 | entry->rw = *rw; |
323 | ring_buffer_unlock_commit(tr->buffer, event, irq_flags); | 320 | trace_buffer_unlock_commit(tr, event, 0, pc); |
324 | |||
325 | trace_wake_up(); | ||
326 | } | 321 | } |
327 | 322 | ||
328 | void mmio_trace_rw(struct mmiotrace_rw *rw) | 323 | void mmio_trace_rw(struct mmiotrace_rw *rw) |
@@ -338,21 +333,17 @@ static void __trace_mmiotrace_map(struct trace_array *tr, | |||
338 | { | 333 | { |
339 | struct ring_buffer_event *event; | 334 | struct ring_buffer_event *event; |
340 | struct trace_mmiotrace_map *entry; | 335 | struct trace_mmiotrace_map *entry; |
341 | unsigned long irq_flags; | 336 | int pc = preempt_count(); |
342 | 337 | ||
343 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), | 338 | event = trace_buffer_lock_reserve(tr, TRACE_MMIO_MAP, |
344 | &irq_flags); | 339 | sizeof(*entry), 0, pc); |
345 | if (!event) { | 340 | if (!event) { |
346 | atomic_inc(&dropped_count); | 341 | atomic_inc(&dropped_count); |
347 | return; | 342 | return; |
348 | } | 343 | } |
349 | entry = ring_buffer_event_data(event); | 344 | entry = ring_buffer_event_data(event); |
350 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); | ||
351 | entry->ent.type = TRACE_MMIO_MAP; | ||
352 | entry->map = *map; | 345 | entry->map = *map; |
353 | ring_buffer_unlock_commit(tr->buffer, event, irq_flags); | 346 | trace_buffer_unlock_commit(tr, event, 0, pc); |
354 | |||
355 | trace_wake_up(); | ||
356 | } | 347 | } |
357 | 348 | ||
358 | void mmio_trace_mapping(struct mmiotrace_map *map) | 349 | void mmio_trace_mapping(struct mmiotrace_map *map) |
@@ -368,5 +359,5 @@ void mmio_trace_mapping(struct mmiotrace_map *map) | |||
368 | 359 | ||
369 | int mmio_trace_printk(const char *fmt, va_list args) | 360 | int mmio_trace_printk(const char *fmt, va_list args) |
370 | { | 361 | { |
371 | return trace_vprintk(0, -1, fmt, args); | 362 | return trace_vprintk(0, fmt, args); |
372 | } | 363 | } |