]> err.no Git - linux-2.6/blobdiff - kernel/trace/trace_mmiotrace.c
x86 mmiotrace: use resource_size_t for phys addresses
[linux-2.6] / kernel / trace / trace_mmiotrace.c
index 6d2edbdde93943d66faf6919255659f68b015371..b13dc19dcbb4691e51bd802238cfbbda15782a73 100644 (file)
@@ -17,11 +17,13 @@ struct header_iter {
 };
 
 static struct trace_array *mmio_trace_array;
+static bool overrun_detected;
 
 static void mmio_reset_data(struct trace_array *tr)
 {
        int cpu;
 
+       overrun_detected = false;
        tr->time_start = ftrace_now(tr->cpu);
 
        for_each_online_cpu(cpu)
@@ -124,12 +126,34 @@ static void mmio_close(struct trace_iterator *iter)
        iter->private = NULL;
 }
 
+static unsigned long count_overruns(struct trace_iterator *iter)
+{
+       int cpu;
+       unsigned long cnt = 0;
+       for_each_online_cpu(cpu) {
+               cnt += iter->overrun[cpu];
+               iter->overrun[cpu] = 0;
+       }
+       return cnt;
+}
+
 static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
                                char __user *ubuf, size_t cnt, loff_t *ppos)
 {
        ssize_t ret;
        struct header_iter *hiter = iter->private;
        struct trace_seq *s = &iter->seq;
+       unsigned long n;
+
+       n = count_overruns(iter);
+       if (n) {
+               /* XXX: This is later than where events were lost. */
+               trace_seq_printf(s, "MARK 0.000000 Lost %lu events.\n", n);
+               if (!overrun_detected)
+                       pr_warning("mmiotrace has lost events.\n");
+               overrun_detected = true;
+               goto print_out;
+       }
 
        if (!hiter)
                return 0;
@@ -142,6 +166,7 @@ static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
                iter->private = NULL;
        }
 
+print_out:
        ret = trace_seq_to_user(s, ubuf, cnt);
        return (ret == -EBUSY) ? 0 : ret;
 }
@@ -159,20 +184,23 @@ static int mmio_print_rw(struct trace_iterator *iter)
        switch (entry->mmiorw.opcode) {
        case MMIO_READ:
                ret = trace_seq_printf(s,
-                       "R %d %lu.%06lu %d 0x%lx 0x%lx 0x%lx %d\n",
-                       rw->width, secs, usec_rem, rw->map_id, rw->phys,
+                       "R %d %lu.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
+                       rw->width, secs, usec_rem, rw->map_id,
+                       (unsigned long long)rw->phys,
                        rw->value, rw->pc, 0);
                break;
        case MMIO_WRITE:
                ret = trace_seq_printf(s,
-                       "W %d %lu.%06lu %d 0x%lx 0x%lx 0x%lx %d\n",
-                       rw->width, secs, usec_rem, rw->map_id, rw->phys,
+                       "W %d %lu.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
+                       rw->width, secs, usec_rem, rw->map_id,
+                       (unsigned long long)rw->phys,
                        rw->value, rw->pc, 0);
                break;
        case MMIO_UNKNOWN_OP:
                ret = trace_seq_printf(s,
-                       "UNKNOWN %lu.%06lu %d 0x%lx %02x,%02x,%02x 0x%lx %d\n",
-                       secs, usec_rem, rw->map_id, rw->phys,
+                       "UNKNOWN %lu.%06lu %d 0x%llx %02x,%02x,%02x 0x%lx %d\n",
+                       secs, usec_rem, rw->map_id,
+                       (unsigned long long)rw->phys,
                        (rw->value >> 16) & 0xff, (rw->value >> 8) & 0xff,
                        (rw->value >> 0) & 0xff, rw->pc, 0);
                break;
@@ -198,14 +226,15 @@ static int mmio_print_map(struct trace_iterator *iter)
        switch (entry->mmiorw.opcode) {
        case MMIO_PROBE:
                ret = trace_seq_printf(s,
-                       "MAP %lu.%06lu %d 0x%lx 0x%lx 0x%lx 0x%lx %d\n",
-                       secs, usec_rem, m->map_id, m->phys, m->virt, m->len,
-                       0UL, entry->pid);
+                       "MAP %lu.%06lu %d 0x%llx 0x%lx 0x%lx 0x%lx %d\n",
+                       secs, usec_rem, m->map_id,
+                       (unsigned long long)m->phys, m->virt, m->len,
+                       0UL, 0);
                break;
        case MMIO_UNPROBE:
                ret = trace_seq_printf(s,
                        "UNMAP %lu.%06lu %d 0x%lx %d\n",
-                       secs, usec_rem, m->map_id, 0UL, entry->pid);
+                       secs, usec_rem, m->map_id, 0UL, 0);
                break;
        default:
                ret = trace_seq_printf(s, "map what?\n");