diff options
author | Pekka Paalanen <pq@iki.fi> | 2008-05-12 15:20:57 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-24 05:24:53 -0400 |
commit | bd8ac686c73c7e925fcfe0b02dc4e7b947127864 (patch) | |
tree | 7a675c4919429b507bb8e7b09677d96ae30ec561 /include/linux | |
parent | f984b51e0779a6dd30feedc41404013ca54e5d05 (diff) |
ftrace: mmiotrace, updates
here is a patch that makes mmiotrace work almost well within the tracing
framework. The patch applies on top of my previous patch. I have my own
output formatting in place now.
Summary of changes:
- fix the NULL dereference that was due to not calling tracing_reset()
- add print_line() callback into struct tracer
- implement print_line() for mmiotrace, producing up-to-spec text
- add my output header, but that is not really called in the right place
- rewrote the main structs in mmiotrace
- added two new trace entry types: TRACE_MMIO_RW and TRACE_MMIO_MAP
- made some functions in trace.c non-static
- check current==NULL in tracing_generic_entry_update()
- fix(?) comparison in trace_seq_printf()
Things seem to work fine except a few issues. Markers (text lines injected
into mmiotrace log) are missing, I did not feel hacking them in before we
have variable length entries. My output header is printed only for 'trace'
file, but not 'trace_pipe'. For some reason, despite my quick fix,
iter->trace is NULL in print_trace_line() when called from 'trace_pipe'
file, which means I don't get proper output formatting.
I only tried by loading nouveau.ko, which just detects the card, and that
is traced fine. I didn't try further. Map, two reads and unmap. Works
perfectly.
I am missing the information about overflows, I'd prefer to have a
counter for lost events. I didn't try, but I guess currently there is no
way of knowning when it overflows?
So, not too far from being fully operational, it seems :-)
And looking at the diffstat, there also is some 700-900 lines of user space
code that just became obsolete.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mmiotrace.h | 85 |
1 files changed, 25 insertions, 60 deletions
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 579b3b06c90e..c88a9c197d22 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
@@ -54,73 +54,38 @@ static inline void mmiotrace_iounmap(volatile void __iomem *addr) | |||
54 | } | 54 | } |
55 | #endif /* CONFIG_MMIOTRACE_HOOKS */ | 55 | #endif /* CONFIG_MMIOTRACE_HOOKS */ |
56 | 56 | ||
57 | /* in kernel/trace/trace_mmiotrace.c */ | 57 | enum mm_io_opcode { |
58 | extern int __init init_mmiotrace(void); | 58 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ |
59 | extern void enable_mmiotrace(void); | 59 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ |
60 | extern void disable_mmiotrace(void); | 60 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ |
61 | extern void mmio_trace_record(u32 type, unsigned long addr, unsigned long arg); | 61 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ |
62 | |||
63 | #endif /* __KERNEL__ */ | ||
64 | |||
65 | |||
66 | /* | ||
67 | * If you change anything here, you must bump MMIO_VERSION. | ||
68 | * This is the relay data format for user space. | ||
69 | */ | ||
70 | #define MMIO_VERSION 0x04 | ||
71 | |||
72 | /* mm_io_header.type */ | ||
73 | #define MMIO_OPCODE_MASK 0xff | ||
74 | #define MMIO_OPCODE_SHIFT 0 | ||
75 | #define MMIO_WIDTH_MASK 0xff00 | ||
76 | #define MMIO_WIDTH_SHIFT 8 | ||
77 | #define MMIO_MAGIC (0x6f000000 | (MMIO_VERSION<<16)) | ||
78 | #define MMIO_MAGIC_MASK 0xffff0000 | ||
79 | |||
80 | enum mm_io_opcode { /* payload type: */ | ||
81 | MMIO_READ = 0x1, /* struct mm_io_rw */ | ||
82 | MMIO_WRITE = 0x2, /* struct mm_io_rw */ | ||
83 | MMIO_PROBE = 0x3, /* struct mm_io_map */ | ||
84 | MMIO_UNPROBE = 0x4, /* struct mm_io_map */ | ||
85 | MMIO_MARKER = 0x5, /* raw char data */ | 62 | MMIO_MARKER = 0x5, /* raw char data */ |
86 | MMIO_UNKNOWN_OP = 0x6, /* struct mm_io_rw */ | 63 | MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */ |
87 | }; | 64 | }; |
88 | 65 | ||
89 | struct mm_io_header { | 66 | struct mmiotrace_rw { |
90 | __u32 type; /* see MMIO_* macros above */ | 67 | unsigned long phys; /* PCI address of register */ |
91 | __u32 sec; /* timestamp */ | 68 | unsigned long value; |
92 | __u32 nsec; | 69 | unsigned long pc; /* optional program counter */ |
93 | __u32 pid; /* PID of the process, or 0 for kernel core */ | 70 | int map_id; |
94 | __u16 data_len; /* length of the following payload */ | 71 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ |
72 | unsigned char width; /* size of register access in bytes */ | ||
95 | }; | 73 | }; |
96 | 74 | ||
97 | struct mm_io_rw { | 75 | struct mmiotrace_map { |
98 | __u64 address; /* virtual address of register */ | 76 | unsigned long phys; /* base address in PCI space */ |
99 | __u64 value; | 77 | unsigned long virt; /* base virtual address */ |
100 | __u64 pc; /* optional program counter */ | 78 | unsigned long len; /* mapping size */ |
79 | int map_id; | ||
80 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ | ||
101 | }; | 81 | }; |
102 | 82 | ||
103 | struct mm_io_map { | 83 | /* in kernel/trace/trace_mmiotrace.c */ |
104 | __u64 phys; /* base address in PCI space */ | 84 | extern void enable_mmiotrace(void); |
105 | __u64 addr; /* base virtual address */ | 85 | extern void disable_mmiotrace(void); |
106 | __u64 len; /* mapping size */ | 86 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); |
107 | __u64 pc; /* optional program counter */ | 87 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
108 | }; | ||
109 | |||
110 | |||
111 | /* | ||
112 | * These structures are used to allow a single relay_write() | ||
113 | * call to write a full packet. | ||
114 | */ | ||
115 | |||
116 | struct mm_io_header_rw { | ||
117 | struct mm_io_header header; | ||
118 | struct mm_io_rw rw; | ||
119 | } __attribute__((packed)); | ||
120 | 88 | ||
121 | struct mm_io_header_map { | 89 | #endif /* __KERNEL__ */ |
122 | struct mm_io_header header; | ||
123 | struct mm_io_map map; | ||
124 | } __attribute__((packed)); | ||
125 | 90 | ||
126 | #endif /* MMIOTRACE_H */ | 91 | #endif /* MMIOTRACE_H */ |