diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-09 18:43:55 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-09 18:43:55 -0500 |
| commit | a4cbbf549a9be10b7583c44249efccd64839533d (patch) | |
| tree | 4b4862e4513b629723b8853e379cd38fee08b095 /tools/lib | |
| parent | 8308756f45a12e2ff4f7749c2694fc83cdef0be9 (diff) | |
| parent | 2fde4f94e0a9531251e706fa57131b51b0df042e (diff) | |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"Kernel side changes:
- AMD range breakpoints support:
Extend breakpoint tools and core to support address range through
perf event with initial backend support for AMD extended
breakpoints.
The syntax is:
perf record -e mem:addr/len:type
For example set write breakpoint from 0x1000 to 0x1200 (0x1000 + 512)
perf record -e mem:0x1000/512:w
- event throttling/rotating fixes
- various event group handling fixes, cleanups and general paranoia
code to be more robust against bugs in the future.
- kernel stack overhead fixes
User-visible tooling side changes:
- Show precise number of samples in at the end of a 'record' session,
if processing build ids, since we will then traverse the whole
perf.data file and see all the PERF_RECORD_SAMPLE records,
otherwise stop showing the previous off-base heuristicly counted
number of "samples" (Namhyung Kim).
- Support to read compressed module from build-id cache (Namhyung
Kim)
- Enable sampling loads and stores simultaneously in 'perf mem'
(Stephane Eranian)
- 'perf diff' output improvements (Namhyung Kim)
- Fix error reporting for evsel pgfault constructor (Arnaldo Carvalho
de Melo)
Tooling side infrastructure changes:
- Cache eh/debug frame offset for dwarf unwind (Namhyung Kim)
- Support parsing parameterized events (Cody P Schafer)
- Add support for IP address formats in libtraceevent (David Ahern)
Plus other misc fixes"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (48 commits)
perf: Decouple unthrottling and rotating
perf: Drop module reference on event init failure
perf: Use POLLIN instead of POLL_IN for perf poll data in flag
perf: Fix put_event() ctx lock
perf: Fix move_group() order
perf: Fix event->ctx locking
perf: Add a bit of paranoia
perf symbols: Convert lseek + read to pread
perf tools: Use perf_data_file__fd() consistently
perf symbols: Support to read compressed module from build-id cache
perf evsel: Set attr.task bit for a tracking event
perf header: Set header version correctly
perf record: Show precise number of samples
perf tools: Do not use __perf_session__process_events() directly
perf callchain: Cache eh/debug frame offset for dwarf unwind
perf tools: Provide stub for missing pthread_attr_setaffinity_np
perf evsel: Don't rely on malloc working for sz 0
tools lib traceevent: Add support for IP address formats
perf ui/tui: Show fatal error message only if exists
perf tests: Fix typo in sample-parsing.c
...
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/api/fs/debugfs.c | 43 | ||||
| -rw-r--r-- | tools/lib/api/fs/debugfs.h | 3 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.c | 328 |
3 files changed, 374 insertions, 0 deletions
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c index 86ea2d7b8845..d2b18e887071 100644 --- a/tools/lib/api/fs/debugfs.c +++ b/tools/lib/api/fs/debugfs.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #define _GNU_SOURCE | ||
| 1 | #include <errno.h> | 2 | #include <errno.h> |
| 2 | #include <stdio.h> | 3 | #include <stdio.h> |
| 3 | #include <stdlib.h> | 4 | #include <stdlib.h> |
| @@ -98,3 +99,45 @@ char *debugfs_mount(const char *mountpoint) | |||
| 98 | out: | 99 | out: |
| 99 | return debugfs_mountpoint; | 100 | return debugfs_mountpoint; |
| 100 | } | 101 | } |
| 102 | |||
| 103 | int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename) | ||
| 104 | { | ||
| 105 | char sbuf[128]; | ||
| 106 | |||
| 107 | switch (err) { | ||
| 108 | case ENOENT: | ||
| 109 | if (debugfs_found) { | ||
| 110 | snprintf(buf, size, | ||
| 111 | "Error:\tFile %s/%s not found.\n" | ||
| 112 | "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", | ||
| 113 | debugfs_mountpoint, filename); | ||
| 114 | break; | ||
| 115 | } | ||
| 116 | snprintf(buf, size, "%s", | ||
| 117 | "Error:\tUnable to find debugfs\n" | ||
| 118 | "Hint:\tWas your kernel compiled with debugfs support?\n" | ||
| 119 | "Hint:\tIs the debugfs filesystem mounted?\n" | ||
| 120 | "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'"); | ||
| 121 | break; | ||
| 122 | case EACCES: | ||
| 123 | snprintf(buf, size, | ||
| 124 | "Error:\tNo permissions to read %s/%s\n" | ||
| 125 | "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", | ||
| 126 | debugfs_mountpoint, filename, debugfs_mountpoint); | ||
| 127 | break; | ||
| 128 | default: | ||
| 129 | snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf))); | ||
| 130 | break; | ||
| 131 | } | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name) | ||
| 137 | { | ||
| 138 | char path[PATH_MAX]; | ||
| 139 | |||
| 140 | snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); | ||
| 141 | |||
| 142 | return debugfs__strerror_open(err, buf, size, path); | ||
| 143 | } | ||
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h index f19d3df9609d..0739881a9897 100644 --- a/tools/lib/api/fs/debugfs.h +++ b/tools/lib/api/fs/debugfs.h | |||
| @@ -26,4 +26,7 @@ char *debugfs_mount(const char *mountpoint); | |||
| 26 | 26 | ||
| 27 | extern char debugfs_mountpoint[]; | 27 | extern char debugfs_mountpoint[]; |
| 28 | 28 | ||
| 29 | int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename); | ||
| 30 | int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name); | ||
| 31 | |||
| 29 | #endif /* __API_DEBUGFS_H__ */ | 32 | #endif /* __API_DEBUGFS_H__ */ |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index cf3a44bf1ec3..afe20ed9fac8 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <stdint.h> | 32 | #include <stdint.h> |
| 33 | #include <limits.h> | 33 | #include <limits.h> |
| 34 | 34 | ||
| 35 | #include <netinet/ip6.h> | ||
| 35 | #include "event-parse.h" | 36 | #include "event-parse.h" |
| 36 | #include "event-utils.h" | 37 | #include "event-utils.h" |
| 37 | 38 | ||
| @@ -4149,6 +4150,324 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size, | |||
| 4149 | trace_seq_printf(s, fmt, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); | 4150 | trace_seq_printf(s, fmt, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); |
| 4150 | } | 4151 | } |
| 4151 | 4152 | ||
| 4153 | static void print_ip4_addr(struct trace_seq *s, char i, unsigned char *buf) | ||
| 4154 | { | ||
| 4155 | const char *fmt; | ||
| 4156 | |||
| 4157 | if (i == 'i') | ||
| 4158 | fmt = "%03d.%03d.%03d.%03d"; | ||
| 4159 | else | ||
| 4160 | fmt = "%d.%d.%d.%d"; | ||
| 4161 | |||
| 4162 | trace_seq_printf(s, fmt, buf[0], buf[1], buf[2], buf[3]); | ||
| 4163 | } | ||
| 4164 | |||
| 4165 | static inline bool ipv6_addr_v4mapped(const struct in6_addr *a) | ||
| 4166 | { | ||
| 4167 | return ((unsigned long)(a->s6_addr32[0] | a->s6_addr32[1]) | | ||
| 4168 | (unsigned long)(a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0UL; | ||
| 4169 | } | ||
| 4170 | |||
| 4171 | static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr) | ||
| 4172 | { | ||
| 4173 | return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE); | ||
| 4174 | } | ||
| 4175 | |||
| 4176 | static void print_ip6c_addr(struct trace_seq *s, unsigned char *addr) | ||
| 4177 | { | ||
| 4178 | int i, j, range; | ||
| 4179 | unsigned char zerolength[8]; | ||
| 4180 | int longest = 1; | ||
| 4181 | int colonpos = -1; | ||
| 4182 | uint16_t word; | ||
| 4183 | uint8_t hi, lo; | ||
| 4184 | bool needcolon = false; | ||
| 4185 | bool useIPv4; | ||
| 4186 | struct in6_addr in6; | ||
| 4187 | |||
| 4188 | memcpy(&in6, addr, sizeof(struct in6_addr)); | ||
| 4189 | |||
| 4190 | useIPv4 = ipv6_addr_v4mapped(&in6) || ipv6_addr_is_isatap(&in6); | ||
| 4191 | |||
| 4192 | memset(zerolength, 0, sizeof(zerolength)); | ||
| 4193 | |||
| 4194 | if (useIPv4) | ||
| 4195 | range = 6; | ||
| 4196 | else | ||
| 4197 | range = 8; | ||
| 4198 | |||
| 4199 | /* find position of longest 0 run */ | ||
| 4200 | for (i = 0; i < range; i++) { | ||
| 4201 | for (j = i; j < range; j++) { | ||
| 4202 | if (in6.s6_addr16[j] != 0) | ||
| 4203 | break; | ||
| 4204 | zerolength[i]++; | ||
| 4205 | } | ||
| 4206 | } | ||
| 4207 | for (i = 0; i < range; i++) { | ||
| 4208 | if (zerolength[i] > longest) { | ||
| 4209 | longest = zerolength[i]; | ||
| 4210 | colonpos = i; | ||
| 4211 | } | ||
| 4212 | } | ||
| 4213 | if (longest == 1) /* don't compress a single 0 */ | ||
| 4214 | colonpos = -1; | ||
| 4215 | |||
| 4216 | /* emit address */ | ||
| 4217 | for (i = 0; i < range; i++) { | ||
| 4218 | if (i == colonpos) { | ||
| 4219 | if (needcolon || i == 0) | ||
| 4220 | trace_seq_printf(s, ":"); | ||
| 4221 | trace_seq_printf(s, ":"); | ||
| 4222 | needcolon = false; | ||
| 4223 | i += longest - 1; | ||
| 4224 | continue; | ||
| 4225 | } | ||
| 4226 | if (needcolon) { | ||
| 4227 | trace_seq_printf(s, ":"); | ||
| 4228 | needcolon = false; | ||
| 4229 | } | ||
| 4230 | /* hex u16 without leading 0s */ | ||
| 4231 | word = ntohs(in6.s6_addr16[i]); | ||
| 4232 | hi = word >> 8; | ||
| 4233 | lo = word & 0xff; | ||
| 4234 | if (hi) | ||
| 4235 | trace_seq_printf(s, "%x%02x", hi, lo); | ||
| 4236 | else | ||
| 4237 | trace_seq_printf(s, "%x", lo); | ||
| 4238 | |||
| 4239 | needcolon = true; | ||
| 4240 | } | ||
| 4241 | |||
| 4242 | if (useIPv4) { | ||
| 4243 | if (needcolon) | ||
| 4244 | trace_seq_printf(s, ":"); | ||
| 4245 | print_ip4_addr(s, 'I', &in6.s6_addr[12]); | ||
| 4246 | } | ||
| 4247 | |||
| 4248 | return; | ||
