Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf updates from Ingo Molnar.

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
ftrace: Make all inline tags also include notrace
perf: Use css_tryget() to avoid propping up css refcount
perf tools: Fix synthesizing tracepoint names from the perf.data headers
perf stat: Fix default output file
perf tools: Fix endianity swapping for adds_features bitmask

+71 -14
+3 -3
include/linux/compiler-gcc.h
··· 47 47 */ 48 48 #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ 49 49 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) 50 - # define inline inline __attribute__((always_inline)) 51 - # define __inline__ __inline__ __attribute__((always_inline)) 52 - # define __inline __inline __attribute__((always_inline)) 50 + # define inline inline __attribute__((always_inline)) notrace 51 + # define __inline__ __inline__ __attribute__((always_inline)) notrace 52 + # define __inline __inline __attribute__((always_inline)) notrace 53 53 #else 54 54 /* A lot of inline functions can cause havoc with function tracing */ 55 55 # define inline inline notrace
+7 -3
kernel/events/core.c
··· 253 253 return !event->cgrp || event->cgrp == cpuctx->cgrp; 254 254 } 255 255 256 - static inline void perf_get_cgroup(struct perf_event *event) 256 + static inline bool perf_tryget_cgroup(struct perf_event *event) 257 257 { 258 - css_get(&event->cgrp->css); 258 + return css_tryget(&event->cgrp->css); 259 259 } 260 260 261 261 static inline void perf_put_cgroup(struct perf_event *event) ··· 484 484 event->cgrp = cgrp; 485 485 486 486 /* must be done before we fput() the file */ 487 - perf_get_cgroup(event); 487 + if (!perf_tryget_cgroup(event)) { 488 + event->cgrp = NULL; 489 + ret = -ENOENT; 490 + goto out; 491 + } 488 492 489 493 /* 490 494 * all events in a group must monitor
+7 -1
tools/perf/builtin-stat.c
··· 1179 1179 fprintf(stderr, "cannot use both --output and --log-fd\n"); 1180 1180 usage_with_options(stat_usage, options); 1181 1181 } 1182 + 1183 + if (output_fd < 0) { 1184 + fprintf(stderr, "argument to --log-fd must be a > 0\n"); 1185 + usage_with_options(stat_usage, options); 1186 + } 1187 + 1182 1188 if (!output) { 1183 1189 struct timespec tm; 1184 1190 mode = append_file ? "a" : "w"; ··· 1196 1190 } 1197 1191 clock_gettime(CLOCK_REALTIME, &tm); 1198 1192 fprintf(output, "# started on %s\n", ctime(&tm.tv_sec)); 1199 - } else if (output_fd != 2) { 1193 + } else if (output_fd > 0) { 1200 1194 mode = append_file ? "a" : "w"; 1201 1195 output = fdopen(output_fd, mode); 1202 1196 if (!output) {
+41 -7
tools/perf/util/header.c
··· 1942 1942 else 1943 1943 return -1; 1944 1944 } else if (ph->needs_swap) { 1945 - unsigned int i; 1946 1945 /* 1947 1946 * feature bitmap is declared as an array of unsigned longs -- 1948 1947 * not good since its size can differ between the host that ··· 1957 1958 * file), punt and fallback to the original behavior -- 1958 1959 * clearing all feature bits and setting buildid. 1959 1960 */ 1960 - for (i = 0; i < BITS_TO_LONGS(HEADER_FEAT_BITS); ++i) 1961 - header->adds_features[i] = bswap_64(header->adds_features[i]); 1961 + mem_bswap_64(&header->adds_features, 1962 + BITS_TO_U64(HEADER_FEAT_BITS)); 1962 1963 1963 1964 if (!test_bit(HEADER_HOSTNAME, header->adds_features)) { 1964 - for (i = 0; i < BITS_TO_LONGS(HEADER_FEAT_BITS); ++i) { 1965 - header->adds_features[i] = bswap_64(header->adds_features[i]); 1966 - header->adds_features[i] = bswap_32(header->adds_features[i]); 1967 - } 1965 + /* unswap as u64 */ 1966 + mem_bswap_64(&header->adds_features, 1967 + BITS_TO_U64(HEADER_FEAT_BITS)); 1968 + 1969 + /* unswap as u32 */ 1970 + mem_bswap_32(&header->adds_features, 1971 + BITS_TO_U32(HEADER_FEAT_BITS)); 1968 1972 } 1969 1973 1970 1974 if (!test_bit(HEADER_HOSTNAME, header->adds_features)) { ··· 2093 2091 return ret <= 0 ? -1 : 0; 2094 2092 } 2095 2093 2094 + static int perf_evsel__set_tracepoint_name(struct perf_evsel *evsel) 2095 + { 2096 + struct event_format *event = trace_find_event(evsel->attr.config); 2097 + char bf[128]; 2098 + 2099 + if (event == NULL) 2100 + return -1; 2101 + 2102 + snprintf(bf, sizeof(bf), "%s:%s", event->system, event->name); 2103 + evsel->name = strdup(bf); 2104 + if (event->name == NULL) 2105 + return -1; 2106 + 2107 + return 0; 2108 + } 2109 + 2110 + static int perf_evlist__set_tracepoint_names(struct perf_evlist *evlist) 2111 + { 2112 + struct perf_evsel *pos; 2113 + 2114 + list_for_each_entry(pos, &evlist->entries, node) { 2115 + if (pos->attr.type == PERF_TYPE_TRACEPOINT && 2116 + perf_evsel__set_tracepoint_name(pos)) 2117 + return -1; 2118 + } 2119 + 2120 + return 0; 2121 + } 2122 + 2096 2123 int perf_session__read_header(struct perf_session *session, int fd) 2097 2124 { 2098 2125 struct perf_header *header = &session->header; ··· 2202 2171 perf_file_section__process); 2203 2172 2204 2173 lseek(fd, header->data_offset, SEEK_SET); 2174 + 2175 + if (perf_evlist__set_tracepoint_names(session->evlist)) 2176 + goto out_delete_evlist; 2205 2177 2206 2178 header->frozen = 1; 2207 2179 return 0;
+2
tools/perf/util/include/linux/bitops.h
··· 8 8 #define BITS_PER_LONG __WORDSIZE 9 9 #define BITS_PER_BYTE 8 10 10 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 11 + #define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64)) 12 + #define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32)) 11 13 12 14 #define for_each_set_bit(bit, addr, size) \ 13 15 for ((bit) = find_first_bit((addr), (size)); \
+10
tools/perf/util/session.c
··· 442 442 tool->finished_round = process_finished_round_stub; 443 443 } 444 444 } 445 + 446 + void mem_bswap_32(void *src, int byte_size) 447 + { 448 + u32 *m = src; 449 + while (byte_size > 0) { 450 + *m = bswap_32(*m); 451 + byte_size -= sizeof(u32); 452 + ++m; 453 + } 454 + } 445 455 446 456 void mem_bswap_64(void *src, int byte_size) 447 457 {
+1
tools/perf/util/session.h
··· 80 80 bool perf_session__has_traces(struct perf_session *self, const char *msg); 81 81 82 82 void mem_bswap_64(void *src, int byte_size); 83 + void mem_bswap_32(void *src, int byte_size); 83 84 void perf_event__attr_swap(struct perf_event_attr *attr); 84 85 85 86 int perf_session__create_kernel_maps(struct perf_session *self);