Skip to content

Commit

Permalink
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/linux-2.6-tip

* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf sched: Fix build failure on sparc
  perf bench: Add "all" pseudo subsystem and "all" pseudo suite
  perf tools: Introduce perf_session class
  perf symbols: Ditch dso->find_symbol
  perf symbols: Allow lookups by symbol name too
  perf symbols: Add missing "Variables" entry to map_type__name
  perf symbols: Add support for 'variable' symtabs
  perf symbols: Introduce ELF counterparts to symbol_type__is_a
  perf symbols: Introduce symbol_type__is_a
  perf symbols: Rename kthreads to kmaps, using another abstraction for it
  perf tools: Allow building for ARM
  hw-breakpoints: Handle bad modify_user_hw_breakpoint off-case return value
  perf tools: Allow cross compiling
  tracing, slab: Fix no callsite ifndef CONFIG_KMEMTRACE
  tracing, slab: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING

Trivial conflict due to different fixes to modify_user_hw_breakpoint()
in include/linux/hw_breakpoint.h
  • Loading branch information
Linus Torvalds committed Dec 14, 2009
2 parents 491424c + 2cd9046 commit 2205afa
Show file tree
Hide file tree
Showing 31 changed files with 651 additions and 353 deletions.
2 changes: 1 addition & 1 deletion include/linux/hw_breakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ register_user_hw_breakpoint(struct perf_event_attr *attr,
struct task_struct *tsk) { return NULL; }
static inline int
modify_user_hw_breakpoint(struct perf_event *bp,
struct perf_event_attr *attr) { return 0; }
struct perf_event_attr *attr) { return -ENOSYS; }
static inline struct perf_event *
register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
perf_overflow_handler_t triggered,
Expand Down
4 changes: 2 additions & 2 deletions include/linux/slab_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extern struct cache_sizes malloc_sizes[];
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags);
extern size_t slab_buffer_size(struct kmem_cache *cachep);
#else
Expand Down Expand Up @@ -166,7 +166,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid);
Expand Down
4 changes: 2 additions & 2 deletions include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags);
#else
static __always_inline void *
Expand Down Expand Up @@ -266,7 +266,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
void *__kmalloc_node(size_t size, gfp_t flags, int node);
void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node);
Expand Down
12 changes: 6 additions & 6 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp)

#endif

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
size_t slab_buffer_size(struct kmem_cache *cachep)
{
return cachep->buffer_size;
Expand Down Expand Up @@ -3578,7 +3578,7 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
}
EXPORT_SYMBOL(kmem_cache_alloc);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags)
{
return __cache_alloc(cachep, flags, __builtin_return_address(0));
Expand Down Expand Up @@ -3641,7 +3641,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
}
EXPORT_SYMBOL(kmem_cache_alloc_node);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid)
Expand Down Expand Up @@ -3669,7 +3669,7 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
return ret;
}

#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc_node(size_t size, gfp_t flags, int node)
{
return __do_kmalloc_node(size, flags, node,
Expand All @@ -3689,7 +3689,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
return __do_kmalloc_node(size, flags, node, NULL);
}
EXPORT_SYMBOL(__kmalloc_node);
#endif /* CONFIG_DEBUG_SLAB */
#endif /* CONFIG_DEBUG_SLAB || CONFIG_TRACING */
#endif /* CONFIG_NUMA */

/**
Expand Down Expand Up @@ -3721,7 +3721,7 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
}


#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc(size_t size, gfp_t flags)
{
return __do_kmalloc(size, flags, __builtin_return_address(0));
Expand Down
4 changes: 2 additions & 2 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags)
}
EXPORT_SYMBOL(kmem_cache_alloc);

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
{
return slab_alloc(s, gfpflags, -1, _RET_IP_);
Expand All @@ -1775,7 +1775,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node)
EXPORT_SYMBOL(kmem_cache_alloc_node);
#endif

#ifdef CONFIG_KMEMTRACE
#ifdef CONFIG_TRACING
void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node)
Expand Down
9 changes: 7 additions & 2 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ lib = lib

export prefix bindir sharedir sysconfdir

CC = gcc
AR = ar
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
RM = rm -f
TAR = tar
FIND = find
Expand Down Expand Up @@ -356,7 +356,9 @@ LIB_H += util/parse-options.h
LIB_H += util/parse-events.h
LIB_H += util/quote.h
LIB_H += util/util.h
LIB_H += util/header.h
LIB_H += util/help.h
LIB_H += util/session.h
LIB_H += util/strbuf.h
LIB_H += util/string.h
LIB_H += util/strlist.h
Expand Down Expand Up @@ -405,6 +407,7 @@ LIB_OBJS += util/callchain.o
LIB_OBJS += util/values.o
LIB_OBJS += util/debug.o
LIB_OBJS += util/map.o
LIB_OBJS += util/session.o
LIB_OBJS += util/thread.o
LIB_OBJS += util/trace-event-parse.o
LIB_OBJS += util/trace-event-read.o
Expand Down Expand Up @@ -492,8 +495,10 @@ else
LIB_OBJS += util/probe-finder.o
endif

ifndef NO_LIBPERL
PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
endif

ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
BASIC_CFLAGS += -DNO_LIBPERL
Expand Down
8 changes: 5 additions & 3 deletions tools/perf/bench/sched-messaging.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* builtin-bench-messaging.c
* sched-messaging.c
*
* messaging: Benchmark for scheduler and IPC mechanisms
*
Expand Down Expand Up @@ -320,10 +320,12 @@ int bench_sched_messaging(int argc, const char **argv,
num_groups, num_groups * 2 * num_fds,
thread_mode ? "threads" : "processes");
printf(" %14s: %lu.%03lu [sec]\n", "Total time",
diff.tv_sec, diff.tv_usec/1000);
diff.tv_sec,
(unsigned long) (diff.tv_usec/1000));
break;
case BENCH_FORMAT_SIMPLE:
printf("%lu.%03lu\n", diff.tv_sec, diff.tv_usec/1000);
printf("%lu.%03lu\n", diff.tv_sec,
(unsigned long) (diff.tv_usec/1000));
break;
default:
/* reaching here is something disaster */
Expand Down
11 changes: 7 additions & 4 deletions tools/perf/bench/sched-pipe.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* builtin-bench-pipe.c
* sched-pipe.c
*
* pipe: Benchmark for pipe()
*
Expand Down Expand Up @@ -87,7 +87,8 @@ int bench_sched_pipe(int argc, const char **argv,
if (pid) {
retpid = waitpid(pid, &wait_stat, 0);
assert((retpid == pid) && WIFEXITED(wait_stat));
return 0;
} else {
exit(0);
}

switch (bench_format) {
Expand All @@ -99,7 +100,8 @@ int bench_sched_pipe(int argc, const char **argv,
result_usec += diff.tv_usec;

printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
diff.tv_sec, diff.tv_usec/1000);
diff.tv_sec,
(unsigned long) (diff.tv_usec/1000));

printf(" %14lf usecs/op\n",
(double)result_usec / (double)loops);
Expand All @@ -110,7 +112,8 @@ int bench_sched_pipe(int argc, const char **argv,

case BENCH_FORMAT_SIMPLE:
printf("%lu.%03lu\n",
diff.tv_sec, diff.tv_usec / 1000);
diff.tv_sec,
(unsigned long) (diff.tv_usec / 1000));
break;

default:
Expand Down
15 changes: 10 additions & 5 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "util/thread.h"
#include "util/sort.h"
#include "util/hist.h"
#include "util/session.h"
#include "util/data_map.h"

static char const *input_name = "perf.data";
Expand Down Expand Up @@ -462,21 +463,23 @@ static struct perf_file_handler file_handler = {

static int __cmd_annotate(void)
{
struct perf_header *header;
struct perf_session *session = perf_session__new(input_name, O_RDONLY, force);
struct thread *idle;
int ret;

if (session == NULL)
return -ENOMEM;

idle = register_idle_thread();
register_perf_file_handler(&file_handler);

ret = mmap_dispatch_perf_file(&header, input_name, 0, 0,
&event__cwdlen, &event__cwd);
ret = perf_session__process_events(session, 0, &event__cwdlen, &event__cwd);
if (ret)
return ret;
goto out_delete;

if (dump_trace) {
event__print_totals();
return 0;
goto out_delete;
}

if (verbose > 3)
Expand All @@ -489,6 +492,8 @@ static int __cmd_annotate(void)
output__resort(event__total[0]);

find_annotations();
out_delete:
perf_session__delete(session);

return ret;
}
Expand Down
57 changes: 53 additions & 4 deletions tools/perf/builtin-bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ struct bench_suite {
const char *summary;
int (*fn)(int, const char **, const char *);
};
\
/* sentinel: easy for help */
#define suite_all { "all", "test all suite (pseudo suite)", NULL }

static struct bench_suite sched_suites[] = {
{ "messaging",
Expand All @@ -39,6 +42,7 @@ static struct bench_suite sched_suites[] = {
{ "pipe",
"Flood of communication over pipe() between two processes",
bench_sched_pipe },
suite_all,
{ NULL,
NULL,
NULL }
Expand All @@ -48,6 +52,7 @@ static struct bench_suite mem_suites[] = {
{ "memcpy",
"Simple memory copy in various ways",
bench_mem_memcpy },
suite_all,
{ NULL,
NULL,
NULL }
Expand All @@ -66,6 +71,9 @@ static struct bench_subsys subsystems[] = {
{ "mem",
"memory access performance",
mem_suites },
{ "all", /* sentinel: easy for help */
"test all subsystem (pseudo subsystem)",
NULL },
{ NULL,
NULL,
NULL }
Expand All @@ -75,11 +83,11 @@ static void dump_suites(int subsys_index)
{
int i;

printf("List of available suites for %s...\n\n",
printf("# List of available suites for %s...\n\n",
subsystems[subsys_index].name);

for (i = 0; subsystems[subsys_index].suites[i].name; i++)
printf("\t%s: %s\n",
printf("%14s: %s\n",
subsystems[subsys_index].suites[i].name,
subsystems[subsys_index].suites[i].summary);

Expand Down Expand Up @@ -110,10 +118,10 @@ static void print_usage(void)
printf("\t%s\n", bench_usage[i]);
printf("\n");

printf("List of available subsystems...\n\n");
printf("# List of available subsystems...\n\n");

for (i = 0; subsystems[i].name; i++)
printf("\t%s: %s\n",
printf("%14s: %s\n",
subsystems[i].name, subsystems[i].summary);
printf("\n");
}
Expand All @@ -131,6 +139,37 @@ static int bench_str2int(char *str)
return BENCH_FORMAT_UNKNOWN;
}

static void all_suite(struct bench_subsys *subsys) /* FROM HERE */
{
int i;
const char *argv[2];
struct bench_suite *suites = subsys->suites;

argv[1] = NULL;
/*
* TODO:
* preparing preset parameters for
* embedded, ordinary PC, HPC, etc...
* will be helpful
*/
for (i = 0; suites[i].fn; i++) {
printf("# Running %s/%s benchmark...\n",
subsys->name,
suites[i].name);

argv[1] = suites[i].name;
suites[i].fn(1, argv, NULL);
printf("\n");
}
}

static void all_subsystem(void)
{
int i;
for (i = 0; subsystems[i].suites; i++)
all_suite(&subsystems[i]);
}

int cmd_bench(int argc, const char **argv, const char *prefix __used)
{
int i, j, status = 0;
Expand All @@ -155,6 +194,11 @@ int cmd_bench(int argc, const char **argv, const char *prefix __used)
goto end;
}

if (!strcmp(argv[0], "all")) {
all_subsystem();
goto end;
}

for (i = 0; subsystems[i].name; i++) {
if (strcmp(subsystems[i].name, argv[0]))
continue;
Expand All @@ -165,6 +209,11 @@ int cmd_bench(int argc, const char **argv, const char *prefix __used)
goto end;
}

if (!strcmp(argv[1], "all")) {
all_suite(&subsystems[i]);
goto end;
}

for (j = 0; subsystems[i].suites[j].name; j++) {
if (strcmp(subsystems[i].suites[j].name, argv[1]))
continue;
Expand Down
Loading

0 comments on commit 2205afa

Please sign in to comment.