From 85730eff4257806ad6a0b2a7b26202347210a315 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 14 Jun 2012 10:54:28 -0400 Subject: [PATCH] --- yaml --- r: 311197 b: refs/heads/master c: 93b3cca1ccd30b1ad290951a3fc7c10c73db7313 h: refs/heads/master i: 311195: 0544de40c2f61147dc9d6ffbc446556ff4a6d395 v: v3 --- [refs] | 2 +- trunk/include/linux/compiler-gcc.h | 6 +-- trunk/kernel/events/core.c | 10 ++-- trunk/tools/perf/builtin-stat.c | 8 +--- trunk/tools/perf/util/header.c | 48 +++----------------- trunk/tools/perf/util/include/linux/bitops.h | 2 - trunk/tools/perf/util/session.c | 10 ---- trunk/tools/perf/util/session.h | 1 - 8 files changed, 15 insertions(+), 72 deletions(-) diff --git a/[refs] b/[refs] index 11121c4e5c9f..f031d9ccc600 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9c5da09d266ca9b32eb16cf940f8161d949c2fe5 +refs/heads/master: 93b3cca1ccd30b1ad290951a3fc7c10c73db7313 diff --git a/trunk/include/linux/compiler-gcc.h b/trunk/include/linux/compiler-gcc.h index e5834aa24b9e..6a6d7aefe12d 100644 --- a/trunk/include/linux/compiler-gcc.h +++ b/trunk/include/linux/compiler-gcc.h @@ -47,9 +47,9 @@ */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) -# define inline inline __attribute__((always_inline)) -# define __inline__ __inline__ __attribute__((always_inline)) -# define __inline __inline __attribute__((always_inline)) +# define inline inline __attribute__((always_inline)) notrace +# define __inline__ __inline__ __attribute__((always_inline)) notrace +# define __inline __inline __attribute__((always_inline)) notrace #else /* A lot of inline functions can cause havoc with function tracing */ # define inline inline notrace diff --git a/trunk/kernel/events/core.c b/trunk/kernel/events/core.c index d7d71d6ec972..f85c0154b333 100644 --- a/trunk/kernel/events/core.c +++ b/trunk/kernel/events/core.c @@ -253,9 +253,9 @@ perf_cgroup_match(struct perf_event *event) return !event->cgrp || event->cgrp == cpuctx->cgrp; } -static inline bool perf_tryget_cgroup(struct perf_event *event) +static inline void perf_get_cgroup(struct perf_event *event) { - return css_tryget(&event->cgrp->css); + css_get(&event->cgrp->css); } static inline void perf_put_cgroup(struct perf_event *event) @@ -484,11 +484,7 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event, event->cgrp = cgrp; /* must be done before we fput() the file */ - if (!perf_tryget_cgroup(event)) { - event->cgrp = NULL; - ret = -ENOENT; - goto out; - } + perf_get_cgroup(event); /* * all events in a group must monitor diff --git a/trunk/tools/perf/builtin-stat.c b/trunk/tools/perf/builtin-stat.c index 07b5c7703dd1..262589991ea4 100644 --- a/trunk/tools/perf/builtin-stat.c +++ b/trunk/tools/perf/builtin-stat.c @@ -1179,12 +1179,6 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used) fprintf(stderr, "cannot use both --output and --log-fd\n"); usage_with_options(stat_usage, options); } - - if (output_fd < 0) { - fprintf(stderr, "argument to --log-fd must be a > 0\n"); - usage_with_options(stat_usage, options); - } - if (!output) { struct timespec tm; mode = append_file ? "a" : "w"; @@ -1196,7 +1190,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used) } clock_gettime(CLOCK_REALTIME, &tm); fprintf(output, "# started on %s\n", ctime(&tm.tv_sec)); - } else if (output_fd > 0) { + } else if (output_fd != 2) { mode = append_file ? "a" : "w"; output = fdopen(output_fd, mode); if (!output) { diff --git a/trunk/tools/perf/util/header.c b/trunk/tools/perf/util/header.c index e909d43cf542..2dd5edf161b7 100644 --- a/trunk/tools/perf/util/header.c +++ b/trunk/tools/perf/util/header.c @@ -1942,6 +1942,7 @@ int perf_file_header__read(struct perf_file_header *header, else return -1; } else if (ph->needs_swap) { + unsigned int i; /* * feature bitmap is declared as an array of unsigned longs -- * not good since its size can differ between the host that @@ -1957,17 +1958,14 @@ int perf_file_header__read(struct perf_file_header *header, * file), punt and fallback to the original behavior -- * clearing all feature bits and setting buildid. */ - mem_bswap_64(&header->adds_features, - BITS_TO_U64(HEADER_FEAT_BITS)); + for (i = 0; i < BITS_TO_LONGS(HEADER_FEAT_BITS); ++i) + header->adds_features[i] = bswap_64(header->adds_features[i]); if (!test_bit(HEADER_HOSTNAME, header->adds_features)) { - /* unswap as u64 */ - mem_bswap_64(&header->adds_features, - BITS_TO_U64(HEADER_FEAT_BITS)); - - /* unswap as u32 */ - mem_bswap_32(&header->adds_features, - BITS_TO_U32(HEADER_FEAT_BITS)); + for (i = 0; i < BITS_TO_LONGS(HEADER_FEAT_BITS); ++i) { + header->adds_features[i] = bswap_64(header->adds_features[i]); + header->adds_features[i] = bswap_32(header->adds_features[i]); + } } if (!test_bit(HEADER_HOSTNAME, header->adds_features)) { @@ -2093,35 +2091,6 @@ static int read_attr(int fd, struct perf_header *ph, return ret <= 0 ? -1 : 0; } -static int perf_evsel__set_tracepoint_name(struct perf_evsel *evsel) -{ - struct event_format *event = trace_find_event(evsel->attr.config); - char bf[128]; - - if (event == NULL) - return -1; - - snprintf(bf, sizeof(bf), "%s:%s", event->system, event->name); - evsel->name = strdup(bf); - if (event->name == NULL) - return -1; - - return 0; -} - -static int perf_evlist__set_tracepoint_names(struct perf_evlist *evlist) -{ - struct perf_evsel *pos; - - list_for_each_entry(pos, &evlist->entries, node) { - if (pos->attr.type == PERF_TYPE_TRACEPOINT && - perf_evsel__set_tracepoint_name(pos)) - return -1; - } - - return 0; -} - int perf_session__read_header(struct perf_session *session, int fd) { struct perf_header *header = &session->header; @@ -2203,9 +2172,6 @@ int perf_session__read_header(struct perf_session *session, int fd) lseek(fd, header->data_offset, SEEK_SET); - if (perf_evlist__set_tracepoint_names(session->evlist)) - goto out_delete_evlist; - header->frozen = 1; return 0; out_errno: diff --git a/trunk/tools/perf/util/include/linux/bitops.h b/trunk/tools/perf/util/include/linux/bitops.h index 587a230d2075..f1584833bd22 100644 --- a/trunk/tools/perf/util/include/linux/bitops.h +++ b/trunk/tools/perf/util/include/linux/bitops.h @@ -8,8 +8,6 @@ #define BITS_PER_LONG __WORDSIZE #define BITS_PER_BYTE 8 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) -#define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64)) -#define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32)) #define for_each_set_bit(bit, addr, size) \ for ((bit) = find_first_bit((addr), (size)); \ diff --git a/trunk/tools/perf/util/session.c b/trunk/tools/perf/util/session.c index c3e399bcf18d..2600916efa83 100644 --- a/trunk/tools/perf/util/session.c +++ b/trunk/tools/perf/util/session.c @@ -442,16 +442,6 @@ static void perf_tool__fill_defaults(struct perf_tool *tool) tool->finished_round = process_finished_round_stub; } } - -void mem_bswap_32(void *src, int byte_size) -{ - u32 *m = src; - while (byte_size > 0) { - *m = bswap_32(*m); - byte_size -= sizeof(u32); - ++m; - } -} void mem_bswap_64(void *src, int byte_size) { diff --git a/trunk/tools/perf/util/session.h b/trunk/tools/perf/util/session.h index 0c702e3f0a36..7a5434c00565 100644 --- a/trunk/tools/perf/util/session.h +++ b/trunk/tools/perf/util/session.h @@ -80,7 +80,6 @@ struct branch_info *machine__resolve_bstack(struct machine *self, bool perf_session__has_traces(struct perf_session *self, const char *msg); void mem_bswap_64(void *src, int byte_size); -void mem_bswap_32(void *src, int byte_size); void perf_event__attr_swap(struct perf_event_attr *attr); int perf_session__create_kernel_maps(struct perf_session *self);