diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-16 15:27:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-16 15:27:47 -0500 |
commit | c6a93d330b53fa587f550aedcdeb93ff23ea7f87 (patch) | |
tree | 9f702ce8e33f5c455cd95d6d5f6f78537e65ba67 | |
parent | 6ccc347b699681a0b21c2f7b1a1f85500a58c6b8 (diff) | |
parent | 1703f2c321a8a531c393e137a82602e16c6061cb (diff) |
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/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 tools: Check if /dev/null can be used as the -o gcc argument
perf tools: Move QUIET_STDERR def to before first use
perf: Stop stack frame walking off kernel addresses boundaries
-rw-r--r-- | arch/x86/kernel/dumpstack.c | 14 | ||||
-rw-r--r-- | tools/perf/Makefile | 44 |
2 files changed, 36 insertions, 22 deletions
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index c56bc2873030..6d817554780a 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
@@ -123,13 +123,15 @@ print_context_stack_bp(struct thread_info *tinfo, | |||
123 | while (valid_stack_ptr(tinfo, ret_addr, sizeof(*ret_addr), end)) { | 123 | while (valid_stack_ptr(tinfo, ret_addr, sizeof(*ret_addr), end)) { |
124 | unsigned long addr = *ret_addr; | 124 | unsigned long addr = *ret_addr; |
125 | 125 | ||
126 | if (__kernel_text_address(addr)) { | 126 | if (!__kernel_text_address(addr)) |
127 | ops->address(data, addr, 1); | 127 | break; |
128 | frame = frame->next_frame; | 128 | |
129 | ret_addr = &frame->return_address; | 129 | ops->address(data, addr, 1); |
130 | print_ftrace_graph_addr(addr, data, ops, tinfo, graph); | 130 | frame = frame->next_frame; |
131 | } | 131 | ret_addr = &frame->return_address; |
132 | print_ftrace_graph_addr(addr, data, ops, tinfo, graph); | ||
132 | } | 133 | } |
134 | |||
133 | return (unsigned long)frame; | 135 | return (unsigned long)frame; |
134 | } | 136 | } |
135 | EXPORT_SYMBOL_GPL(print_context_stack_bp); | 137 | EXPORT_SYMBOL_GPL(print_context_stack_bp); |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 652a470b5f74..2e7fa3a06806 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -250,7 +250,19 @@ PTHREAD_LIBS = -lpthread | |||
250 | # explicitly what architecture to check for. Fix this up for yours.. | 250 | # explicitly what architecture to check for. Fix this up for yours.. |
251 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | 251 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
252 | 252 | ||
253 | ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y) | 253 | ifeq ($(V), 2) |
254 | QUIET_STDERR = ">/dev/null" | ||
255 | else | ||
256 | QUIET_STDERR = ">/dev/null 2>&1" | ||
257 | endif | ||
258 | |||
259 | BITBUCKET = "/dev/null" | ||
260 | |||
261 | ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y) | ||
262 | BITBUCKET = .perf.dev.null | ||
263 | endif | ||
264 | |||
265 | ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y) | ||
254 | CFLAGS := $(CFLAGS) -fstack-protector-all | 266 | CFLAGS := $(CFLAGS) -fstack-protector-all |
255 | endif | 267 | endif |
256 | 268 | ||
@@ -451,11 +463,6 @@ BUILTIN_OBJS += builtin-kmem.o | |||
451 | 463 | ||
452 | PERFLIBS = $(LIB_FILE) | 464 | PERFLIBS = $(LIB_FILE) |
453 | 465 | ||
454 | ifeq ($(V), 2) | ||
455 | QUIET_STDERR = ">/dev/null" | ||
456 | else | ||
457 | QUIET_STDERR = ">/dev/null 2>&1" | ||
458 | endif | ||
459 | # | 466 | # |
460 | # Platform specific tweaks | 467 | # Platform specific tweaks |
461 | # | 468 | # |
@@ -483,19 +490,19 @@ ifeq ($(uname_S),Darwin) | |||
483 | PTHREAD_LIBS = | 490 | PTHREAD_LIBS = |
484 | endif | 491 | endif |
485 | 492 | ||
486 | ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 493 | ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
487 | ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 494 | ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
488 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 495 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
489 | endif | 496 | endif |
490 | 497 | ||
491 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 498 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
492 | BASIC_CFLAGS += -DLIBELF_NO_MMAP | 499 | BASIC_CFLAGS += -DLIBELF_NO_MMAP |
493 | endif | 500 | endif |
494 | else | 501 | else |
495 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); | 502 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
496 | endif | 503 | endif |
497 | 504 | ||
498 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) | 505 | ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) |
499 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); | 506 | msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); |
500 | BASIC_CFLAGS += -DNO_LIBDWARF | 507 | BASIC_CFLAGS += -DNO_LIBDWARF |
501 | else | 508 | else |
@@ -509,7 +516,7 @@ PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null` | |||
509 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | 516 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
510 | endif | 517 | endif |
511 | 518 | ||
512 | 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) | 519 | 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 $(BITBUCKET) $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) |
513 | BASIC_CFLAGS += -DNO_LIBPERL | 520 | BASIC_CFLAGS += -DNO_LIBPERL |
514 | else | 521 | else |
515 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) | 522 | ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) |
@@ -519,20 +526,20 @@ endif | |||
519 | ifdef NO_DEMANGLE | 526 | ifdef NO_DEMANGLE |
520 | BASIC_CFLAGS += -DNO_DEMANGLE | 527 | BASIC_CFLAGS += -DNO_DEMANGLE |
521 | else | 528 | else |
522 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") | 529 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") |
523 | 530 | ||
524 | ifeq ($(has_bfd),y) | 531 | ifeq ($(has_bfd),y) |
525 | EXTLIBS += -lbfd | 532 | EXTLIBS += -lbfd |
526 | else | 533 | else |
527 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") | 534 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") |
528 | ifeq ($(has_bfd_iberty),y) | 535 | ifeq ($(has_bfd_iberty),y) |
529 | EXTLIBS += -lbfd -liberty | 536 | EXTLIBS += -lbfd -liberty |
530 | else | 537 | else |
531 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") | 538 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") |
532 | ifeq ($(has_bfd_iberty_z),y) | 539 | ifeq ($(has_bfd_iberty_z),y) |
533 | EXTLIBS += -lbfd -liberty -lz | 540 | EXTLIBS += -lbfd -liberty -lz |
534 | else | 541 | else |
535 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") | 542 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") |
536 | ifeq ($(has_cplus_demangle),y) | 543 | ifeq ($(has_cplus_demangle),y) |
537 | EXTLIBS += -liberty | 544 | EXTLIBS += -liberty |
538 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | 545 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE |
@@ -780,7 +787,7 @@ export TAR INSTALL DESTDIR SHELL_PATH | |||
780 | 787 | ||
781 | SHELL = $(SHELL_PATH) | 788 | SHELL = $(SHELL_PATH) |
782 | 789 | ||
783 | all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS | 790 | all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS |
784 | ifneq (,$X) | 791 | ifneq (,$X) |
785 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) | 792 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) |
786 | endif | 793 | endif |
@@ -1107,6 +1114,11 @@ clean: | |||
1107 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS | 1114 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS |
1108 | .PHONY: .FORCE-PERF-BUILD-OPTIONS | 1115 | .PHONY: .FORCE-PERF-BUILD-OPTIONS |
1109 | 1116 | ||
1117 | .perf.dev.null: | ||
1118 | touch .perf.dev.null | ||
1119 | |||
1120 | .INTERMEDIATE: .perf.dev.null | ||
1121 | |||
1110 | ### Make sure built-ins do not have dups and listed in perf.c | 1122 | ### Make sure built-ins do not have dups and listed in perf.c |
1111 | # | 1123 | # |
1112 | check-builtins:: | 1124 | check-builtins:: |