All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts
@ 2015-09-27 18:37 Rabin Vincent
  2015-09-27 18:37 ` [PATCH 2/5] perf: unwind: pass symbol source to libunwind Rabin Vincent
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Rabin Vincent @ 2015-09-27 18:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Rabin Vincent

unw_word_t is uint64_t even on 32-bit MIPS.  Cast it to uintptr_t before
the cast to void *p to get rid of the following errors:

util/unwind-libunwind.c: In function 'access_mem':
util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[3]: *** [util/unwind-libunwind.o] Error 1

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
 tools/perf/util/unwind-libunwind.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 4c00507..ef799dc 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -461,7 +461,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
 		if (ret) {
 			pr_debug("unwind: access_mem %p not inside range"
 				 " 0x%" PRIx64 "-0x%" PRIx64 "\n",
-				 (void *) addr, start, end);
+				 (void *) (uintptr_t) addr, start, end);
 			*valp = 0;
 			return ret;
 		}
@@ -471,7 +471,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
 	offset = addr - start;
 	*valp  = *(unw_word_t *)&stack->data[offset];
 	pr_debug("unwind: access_mem addr %p val %lx, offset %d\n",
-		 (void *) addr, (unsigned long)*valp, offset);
+		 (void *) (uintptr_t) addr, (unsigned long)*valp, offset);
 	return 0;
 }
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/5] perf: unwind: pass symbol source to libunwind
  2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
@ 2015-09-27 18:37 ` Rabin Vincent
  2015-10-12 11:24   ` Jiri Olsa
  2015-09-27 18:37 ` [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable Rabin Vincent
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Rabin Vincent @ 2015-09-27 18:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Rabin Vincent

Even if --symfs is used to point to the debug binaries, we send in the
non-debug filenames to libunwind, which leads to libunwind not finding
the debug frame.  Fix this.

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
 tools/perf/util/unwind-libunwind.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index ef799dc..b93bf7f 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -363,7 +363,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 			dso__data_put_fd(map->dso);
 
 		memset(&di, 0, sizeof(di));
-		if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->name,
+		if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->symsrc_filename,
 					   map->start, map->end))
 			return dwarf_search_unwind_table(as, ip, &di, pi,
 							 need_unwind_info, arg);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable
  2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
  2015-09-27 18:37 ` [PATCH 2/5] perf: unwind: pass symbol source to libunwind Rabin Vincent
@ 2015-09-27 18:37 ` Rabin Vincent
  2015-10-12 11:28   ` Jiri Olsa
  2015-10-14 13:13   ` [tip:perf/core] perf callchain: Use " tip-bot for Rabin Vincent
  2015-09-27 18:37 ` [PATCH 4/5] tools: build: fix libiberty feature detection Rabin Vincent
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Rabin Vincent @ 2015-09-27 18:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Rabin Vincent

When NO_LIBUNWIND_DEBUG_FRAME=0, use the .debug_frame if the .eh_frame
doesn't contain the approprate unwind tables.

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
 tools/perf/util/unwind-libunwind.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index b93bf7f..e527b98 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -330,6 +330,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 	struct map *map;
 	unw_dyn_info_t di;
 	u64 table_data, segbase, fde_count;
+	int ret = -EINVAL;
 
 	map = find_map(ip, ui);
 	if (!map || !map->dso)
@@ -348,13 +349,14 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 		di.u.rti.table_data = map->start + table_data;
 		di.u.rti.table_len  = fde_count * sizeof(struct table_entry)
 				      / sizeof(unw_word_t);
-		return dwarf_search_unwind_table(as, ip, &di, pi,
-						 need_unwind_info, arg);
+		ret = dwarf_search_unwind_table(as, ip, &di, pi,
+						need_unwind_info, arg);
 	}
 
 #ifndef NO_LIBUNWIND_DEBUG_FRAME
 	/* Check the .debug_frame section for unwinding info */
-	if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
+	if (ret < 0 &&
+	    !read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
 		int fd = dso__data_get_fd(map->dso, ui->machine);
 		int is_exec = elf_is_exec(fd, map->dso->name);
 		unw_word_t base = is_exec ? 0 : map->start;
@@ -370,7 +372,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 	}
 #endif
 
-	return -EINVAL;
+	return ret;
 }
 
 static int access_fpreg(unw_addr_space_t __maybe_unused as,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/5] tools: build: fix libiberty feature detection
  2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
  2015-09-27 18:37 ` [PATCH 2/5] perf: unwind: pass symbol source to libunwind Rabin Vincent
  2015-09-27 18:37 ` [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable Rabin Vincent
@ 2015-09-27 18:37 ` Rabin Vincent
  2015-10-12 11:35   ` Jiri Olsa
  2015-09-27 18:37 ` [PATCH 5/5] perf: add Makefile.deps for easier cross compiling Rabin Vincent
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Rabin Vincent @ 2015-09-27 18:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Rabin Vincent

Pass CFLAGS and LDFLAGS to the libiberty compile line to make the
detection work when using a cross compiler.

Otherwise perf fails to link even though BFD is detected.

...                        libbfd: [ on  ]

  LINK     perf
libbfd.a(bfd.o): In function `bfd_errmsg':
bfd.c:(.text+0x168): undefined reference to `xstrerror'
bbfd.a(opncls.o): In function `_bfd_new_bfd':
opncls.c:(.text+0xe8): undefined reference to `objalloc_create'
...

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
 tools/build/feature/Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index e43a297..cea04ce9 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -132,10 +132,10 @@ test-libbfd.bin:
 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
 
 test-liberty.bin:
-	$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
+	$(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
 
 test-liberty-z.bin:
-	$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
+	$(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
 
 test-cplus-demangle.bin:
 	$(BUILD) -liberty
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
  2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
                   ` (2 preceding siblings ...)
  2015-09-27 18:37 ` [PATCH 4/5] tools: build: fix libiberty feature detection Rabin Vincent
@ 2015-09-27 18:37 ` Rabin Vincent
  2015-10-12 11:42   ` Jiri Olsa
  2015-10-10 15:49 ` [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
  2015-10-14 13:14 ` [tip:perf/core] perf callchains: Fix " tip-bot for Rabin Vincent
  5 siblings, 1 reply; 19+ messages in thread
From: Rabin Vincent @ 2015-09-27 18:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Rabin Vincent

It's easy to cross-compile a minimal perf binary without any external
libraries (other than a C library of course) but if you want more of the
juicy features it quickly becomes harder.  You need to either
cross-compile a bunch of libraries manually and send in the correct
paths or integrate the perf build into some external build system.

In order to make it easier for people to qucikly get up and running with
a fairly full featured cross-compiled mainline perf, provide a
Makefile.deps which will download and build the required libraries,
which can then be used in a static build of perf:

 $ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps
 $ make ARCH=arm CROSS_COMPILE=arm-linux- LDFLAGS="-static"

  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ OFF ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ OFF ]
  ...                       libperl: [ OFF ]
  ...                     libpython: [ OFF ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ OFF ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
---
 tools/perf/Makefile.deps |  140 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/Makefile.perf |    7 +++
 2 files changed, 147 insertions(+)
 create mode 100644 tools/perf/Makefile.deps

diff --git a/tools/perf/Makefile.deps b/tools/perf/Makefile.deps
new file mode 100644
index 0000000..157c047
--- /dev/null
+++ b/tools/perf/Makefile.deps
@@ -0,0 +1,140 @@
+LIBS += audit
+audit_BASENAME=audit-2.4.4
+audit_ARCHIVE=$(audit_BASENAME).tar.gz
+audit_URL=https://people.redhat.com/sgrubb/audit/$(audit_ARCHIVE)
+
+LIBS += bfd
+bfd_BASENAME=binutils-2.25.1
+bfd_ARCHIVE=$(bfd_BASENAME).tar.bz2
+bfd_URL=http://ftp.gnu.org/gnu/binutils/$(bfd_ARCHIVE)
+
+LIBS += bzip2
+bzip2_BASENAME=bzip2-1.0.6
+bzip2_ARCHIVE=$(bzip2_BASENAME).tar.gz
+bzip2_URL=http://www.bzip.org/1.0.6/$(bzip2_ARCHIVE)
+
+LIBS += elfutils
+elfutils_BASENAME=elfutils-0.163
+elfutils_ARCHIVE=$(elfutils_BASENAME).tar.bz2
+elfutils_URL=https://fedorahosted.org/releases/e/l/elfutils/0.163/$(elfutils_ARCHIVE)
+
+LIBS += lzma
+lzma_BASENAME=xz-5.2.1
+lzma_ARCHIVE=$(lzma_BASENAME).tar.gz
+lzma_URL=http://tukaani.org/xz/$(lzma_ARCHIVE)
+
+LIBS += slang
+slang_BASENAME=slang-2.1.4
+slang_ARCHIVE=$(slang_BASENAME).tar.bz2
+slang_URL=http://ftp.ntua.gr/pub/lang/slang/slang/v2.1/$(slang_ARCHIVE)
+
+LIBS += unwind
+unwind_BASENAME=libunwind-1.1
+unwind_ARCHIVE=$(unwind_BASENAME).tar.gz
+unwind_URL=http://download.savannah.gnu.org/releases/libunwind/$(unwind_ARCHIVE)
+
+LIBS += zlib
+zlib_BASENAME=zlib-1.2.8
+zlib_ARCHIVE=$(zlib_BASENAME).tar.gz
+zlib_URL=http://zlib.net/$(zlib_ARCHIVE)
+
+DLDIR=dl
+DEPSDIR=deps-$(ARCH)
+BUILDDIR=build-$(ARCH)
+HOST=$(shell echo $(CROSS_COMPILE) | sed 's/.$$//')
+PREFIX=$(realpath $(shell pwd))/$(DEPSDIR)
+MAKE1=$(MAKE) -j1
+
+CC=$(CROSS_COMPILE)gcc
+
+export CC
+
+.PHONY: all clean $(LIBS)
+
+all: $(LIBS)
+
+define LIB_template
+$1_DIR=$$(BUILDDIR)/$$($1_BASENAME)
+$1_EXTRACT=$$($1_DIR)/.extract
+$1_INSTALL=$$(DEPSDIR)/lib/.$1.install
+
+$$(DLDIR)/$$($1_ARCHIVE):
+	mkdir -p $$(DLDIR) && cd $$(DLDIR) && wget -N $$($1_URL)
+
+$$($1_EXTRACT): $$(DLDIR)/$$($1_ARCHIVE)
+	mkdir -p $$(BUILDDIR) && tar xf $$< -C $$(BUILDDIR)
+	touch $$@
+
+$1: $$($1_INSTALL)
+
+$1-clean:
+	rm -rf $$($1_DIR)
+endef
+
+$(foreach lib,$(LIBS),$(eval $(call LIB_template,$(lib))))
+
+$(audit_INSTALL): $(audit_EXTRACT)
+	cd $(audit_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX)
+	$(MAKE) -C $(audit_DIR)/lib
+	$(MAKE) -C $(audit_DIR)/lib install
+	touch $@
+
+CFLAGS=-I$(PREFIX)/include
+LDFLAGS=-L$(PREFIX)/lib
+
+$(bfd_INSTALL): $(zlib_INSTALL) $(bfd_EXTRACT)
+	cd $(bfd_DIR)/libiberty && ./configure --host=$(HOST) --prefix=$(PREFIX) --enable-install-libiberty
+	$(MAKE) -C $(bfd_DIR)/libiberty
+	$(MAKE) -C $(bfd_DIR)/libiberty install
+	cd $(bfd_DIR)/bfd && CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --host=$(HOST) --prefix=$(PREFIX) --with-zlib
+	$(MAKE) -C $(bfd_DIR)/bfd
+	$(MAKE) -C $(bfd_DIR)/bfd install
+	touch $@
+
+$(bzip2_INSTALL): $(bzip2_EXTRACT)
+	$(MAKE) -C $(bzip2_DIR) clean
+	$(MAKE) CC="$(CC)" PREFIX=$(PREFIX) -C $(bzip2_DIR) -f Makefile-libbz2_so
+	mkdir -p $(DEPSDIR)/lib
+	cp -a $(bzip2_DIR)/libbz2.so* $(DEPSDIR)/lib/
+	@rm -f $(DEPSDIR)/lib/libbz2.so
+	# The dynamic library is required to prevent errors while building elfutils
+	cd $(DEPSDIR)/lib && ln -s libbz2.so.1.0 libbz2.so
+	$(MAKE) -C $(bzip2_DIR) clean
+	$(MAKE) CC="$(CC)" PREFIX=$(PREFIX) -C $(bzip2_DIR) install
+	touch $@
+
+elfutils_LDFLAGS=$(LDFLAGS) -Wl,-rpath-link $(PREFIX)/lib
+
+$(elfutils_INSTALL): $(zlib_INSTALL) $(lzma_INSTALL) $(bzip2_INSTALL) $(elfutils_EXTRACT)
+	cd $(elfutils_DIR) && CFLAGS="$(CFLAGS)" LDFLAGS="$(elfutils_LDFLAGS)" ./configure --host=$(HOST) --prefix=$(PREFIX) --with-zlib --with-bzlib --with-lzma
+	$(MAKE) -C $(elfutils_DIR)
+	$(MAKE) -C $(elfutils_DIR) install
+	touch $@
+
+$(lzma_INSTALL): $(lzma_EXTRACT)
+	cd $(lzma_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX)
+	$(MAKE) -C $(lzma_DIR)
+	$(MAKE) -C $(lzma_DIR) install
+	touch $@
+
+$(slang_INSTALL): $(slang_EXTRACT)
+	cd $(slang_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX)
+	$(MAKE1) -C $(slang_DIR)
+	$(MAKE1) -C $(slang_DIR) install-all
+	touch $@
+
+$(zlib_INSTALL): $(zlib_EXTRACT)
+	cd $(zlib_DIR) && ./configure --prefix=$(PREFIX)
+	$(MAKE) -C $(zlib_DIR)
+	$(MAKE) -C $(zlib_DIR) install
+	touch $@
+
+$(unwind_INSTALL): $(unwind_EXTRACT)
+	cd $(unwind_DIR) && ./configure --host=$(HOST) --prefix=$(PREFIX) --enable-debug --enable-debug-frame
+	cd $(unwind_DIR) && $(MAKE)
+	cd $(unwind_DIR) && $(MAKE) install
+	touch $@
+
+clean:
+	rm -rf $(BUILDDIR)
+	rm -rf $(DEPSDIR)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index d9863cb..4d5d984 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -92,6 +92,13 @@ ifneq ($(objtree),)
 #$(info Determined 'objtree' to be $(objtree))
 endif
 
+ifeq ($(findstring -static,${LDFLAGS}),-static)
+  ifneq ($(wildcard deps-$(ARCH)/*),)
+    LDFLAGS += -L $(PWD)/deps-$(ARCH)/lib
+    EXTRA_CFLAGS += -isystem $(PWD)/deps-$(ARCH)/include
+  endif
+endif
+
 ifneq ($(OUTPUT),)
 #$(info Determined 'OUTPUT' to be $(OUTPUT))
 # Adding $(OUTPUT) as a directory to look for source files,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts
  2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
                   ` (3 preceding siblings ...)
  2015-09-27 18:37 ` [PATCH 5/5] perf: add Makefile.deps for easier cross compiling Rabin Vincent
@ 2015-10-10 15:49 ` Rabin Vincent
  2015-10-10 23:34   ` Arnaldo Carvalho de Melo
  2015-10-14 13:14 ` [tip:perf/core] perf callchains: Fix " tip-bot for Rabin Vincent
  5 siblings, 1 reply; 19+ messages in thread
From: Rabin Vincent @ 2015-10-10 15:49 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel

Hi Arnaldo,

Do you have any comments on this patch set?

Thanks.

On Sun, Sep 27, 2015 at 08:37:55PM +0200, Rabin Vincent wrote:
> unw_word_t is uint64_t even on 32-bit MIPS.  Cast it to uintptr_t before
> the cast to void *p to get rid of the following errors:
> 
> util/unwind-libunwind.c: In function 'access_mem':
> util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> cc1: all warnings being treated as errors
> make[3]: *** [util/unwind-libunwind.o] Error 1
> 
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
> ---
>  tools/perf/util/unwind-libunwind.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
> index 4c00507..ef799dc 100644
> --- a/tools/perf/util/unwind-libunwind.c
> +++ b/tools/perf/util/unwind-libunwind.c
> @@ -461,7 +461,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
>  		if (ret) {
>  			pr_debug("unwind: access_mem %p not inside range"
>  				 " 0x%" PRIx64 "-0x%" PRIx64 "\n",
> -				 (void *) addr, start, end);
> +				 (void *) (uintptr_t) addr, start, end);
>  			*valp = 0;
>  			return ret;
>  		}
> @@ -471,7 +471,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
>  	offset = addr - start;
>  	*valp  = *(unw_word_t *)&stack->data[offset];
>  	pr_debug("unwind: access_mem addr %p val %lx, offset %d\n",
> -		 (void *) addr, (unsigned long)*valp, offset);
> +		 (void *) (uintptr_t) addr, (unsigned long)*valp, offset);
>  	return 0;
>  }
>  
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts
  2015-10-10 15:49 ` [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
@ 2015-10-10 23:34   ` Arnaldo Carvalho de Melo
  2015-10-12  8:38     ` Jiri Olsa
  0 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-10 23:34 UTC (permalink / raw)
  To: Rabin Vincent, Jiri Olsa; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel

Em Sat, Oct 10, 2015 at 05:49:40PM +0200, Rabin Vincent escreveu:
> Hi Arnaldo,
> 
> Do you have any comments on this patch set?

I looked at the patches now, all seem fine from a quick look.

The last patch is interesting, and a more general way of installing what
is required for a full build using the native method for a distro, i.e.
using yum/dnf/apt/etc would come in handy as well, so that it doesn't
look like we recommend this fetch-the-sources-and-build-it method, but
sure, that can come later, when someone steps up to that work.

Since this touches the build system and libunwind, areas that Jiri
wrote/knows better, I'd like to get his ack, Jiri?

- Arnaldo
 
> Thanks.
> 
> On Sun, Sep 27, 2015 at 08:37:55PM +0200, Rabin Vincent wrote:
> > unw_word_t is uint64_t even on 32-bit MIPS.  Cast it to uintptr_t before
> > the cast to void *p to get rid of the following errors:
> > 
> > util/unwind-libunwind.c: In function 'access_mem':
> > util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > cc1: all warnings being treated as errors
> > make[3]: *** [util/unwind-libunwind.o] Error 1
> > 
> > Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
> > ---
> >  tools/perf/util/unwind-libunwind.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
> > index 4c00507..ef799dc 100644
> > --- a/tools/perf/util/unwind-libunwind.c
> > +++ b/tools/perf/util/unwind-libunwind.c
> > @@ -461,7 +461,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
> >  		if (ret) {
> >  			pr_debug("unwind: access_mem %p not inside range"
> >  				 " 0x%" PRIx64 "-0x%" PRIx64 "\n",
> > -				 (void *) addr, start, end);
> > +				 (void *) (uintptr_t) addr, start, end);
> >  			*valp = 0;
> >  			return ret;
> >  		}
> > @@ -471,7 +471,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
> >  	offset = addr - start;
> >  	*valp  = *(unw_word_t *)&stack->data[offset];
> >  	pr_debug("unwind: access_mem addr %p val %lx, offset %d\n",
> > -		 (void *) addr, (unsigned long)*valp, offset);
> > +		 (void *) (uintptr_t) addr, (unsigned long)*valp, offset);
> >  	return 0;
> >  }
> >  
> > -- 
> > 1.7.10.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts
  2015-10-10 23:34   ` Arnaldo Carvalho de Melo
@ 2015-10-12  8:38     ` Jiri Olsa
  0 siblings, 0 replies; 19+ messages in thread
From: Jiri Olsa @ 2015-10-12  8:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Rabin Vincent, Jiri Olsa, Ingo Molnar, Peter Zijlstra, linux-kernel

On Sat, Oct 10, 2015 at 08:34:08PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sat, Oct 10, 2015 at 05:49:40PM +0200, Rabin Vincent escreveu:
> > Hi Arnaldo,
> > 
> > Do you have any comments on this patch set?
> 
> I looked at the patches now, all seem fine from a quick look.
> 
> The last patch is interesting, and a more general way of installing what
> is required for a full build using the native method for a distro, i.e.
> using yum/dnf/apt/etc would come in handy as well, so that it doesn't
> look like we recommend this fetch-the-sources-and-build-it method, but
> sure, that can come later, when someone steps up to that work.
> 
> Since this touches the build system and libunwind, areas that Jiri
> wrote/knows better, I'd like to get his ack, Jiri?

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] perf: unwind: pass symbol source to libunwind
  2015-09-27 18:37 ` [PATCH 2/5] perf: unwind: pass symbol source to libunwind Rabin Vincent
@ 2015-10-12 11:24   ` Jiri Olsa
  2015-10-12 12:35     ` Namhyung Kim
  0 siblings, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2015-10-12 11:24 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	linux-kernel, Rabin Vincent, Namhyung Kim

On Sun, Sep 27, 2015 at 08:37:56PM +0200, Rabin Vincent wrote:
> Even if --symfs is used to point to the debug binaries, we send in the
> non-debug filenames to libunwind, which leads to libunwind not finding
> the debug frame.  Fix this.
> 
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>

cc-ing Namhyung on this one

jirka

> ---
>  tools/perf/util/unwind-libunwind.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
> index ef799dc..b93bf7f 100644
> --- a/tools/perf/util/unwind-libunwind.c
> +++ b/tools/perf/util/unwind-libunwind.c
> @@ -363,7 +363,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
>  			dso__data_put_fd(map->dso);
>  
>  		memset(&di, 0, sizeof(di));
> -		if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->name,
> +		if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->symsrc_filename,
>  					   map->start, map->end))
>  			return dwarf_search_unwind_table(as, ip, &di, pi,
>  							 need_unwind_info, arg);
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable
  2015-09-27 18:37 ` [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable Rabin Vincent
@ 2015-10-12 11:28   ` Jiri Olsa
  2015-10-14 13:13   ` [tip:perf/core] perf callchain: Use " tip-bot for Rabin Vincent
  1 sibling, 0 replies; 19+ messages in thread
From: Jiri Olsa @ 2015-10-12 11:28 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	linux-kernel, Rabin Vincent

On Sun, Sep 27, 2015 at 08:37:57PM +0200, Rabin Vincent wrote:
> When NO_LIBUNWIND_DEBUG_FRAME=0, use the .debug_frame if the .eh_frame
> doesn't contain the approprate unwind tables.
> 

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] tools: build: fix libiberty feature detection
  2015-09-27 18:37 ` [PATCH 4/5] tools: build: fix libiberty feature detection Rabin Vincent
@ 2015-10-12 11:35   ` Jiri Olsa
  2015-10-13 11:00     ` Rabin Vincent
  0 siblings, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2015-10-12 11:35 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	linux-kernel, Rabin Vincent

On Sun, Sep 27, 2015 at 08:37:58PM +0200, Rabin Vincent wrote:
> Pass CFLAGS and LDFLAGS to the libiberty compile line to make the
> detection work when using a cross compiler.
> 
> Otherwise perf fails to link even though BFD is detected.
> 
> ...                        libbfd: [ on  ]
> 
>   LINK     perf
> libbfd.a(bfd.o): In function `bfd_errmsg':
> bfd.c:(.text+0x168): undefined reference to `xstrerror'
> bbfd.a(opncls.o): In function `_bfd_new_bfd':
> opncls.c:(.text+0xe8): undefined reference to `objalloc_create'

We have FEATURE_CHECK_CFLAGS/FEATURE_CHECK_LDFLAGS variables
to pass CFLAGS/LDFLAGS to feature detection build

Could you also be more specific on what is missing
to make the libiberty check compile?

thanks,
jirka

> ...
> 
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
> ---
>  tools/build/feature/Makefile |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index e43a297..cea04ce9 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -132,10 +132,10 @@ test-libbfd.bin:
>  	$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
>  
>  test-liberty.bin:
> -	$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
> +	$(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
>  
>  test-liberty-z.bin:
> -	$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
> +	$(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
>  
>  test-cplus-demangle.bin:
>  	$(BUILD) -liberty
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
  2015-09-27 18:37 ` [PATCH 5/5] perf: add Makefile.deps for easier cross compiling Rabin Vincent
@ 2015-10-12 11:42   ` Jiri Olsa
  2015-10-13 10:50     ` Rabin Vincent
  0 siblings, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2015-10-12 11:42 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	linux-kernel, Rabin Vincent

On Sun, Sep 27, 2015 at 08:37:59PM +0200, Rabin Vincent wrote:
> It's easy to cross-compile a minimal perf binary without any external
> libraries (other than a C library of course) but if you want more of the
> juicy features it quickly becomes harder.  You need to either
> cross-compile a bunch of libraries manually and send in the correct
> paths or integrate the perf build into some external build system.
> 
> In order to make it easier for people to qucikly get up and running with
> a fairly full featured cross-compiled mainline perf, provide a
> Makefile.deps which will download and build the required libraries,
> which can then be used in a static build of perf:
> 
>  $ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps

Makefile.cross_compile or Makefile.cross might suit better

Could you provide more details help/doc on how to use it
and what it's actualy doing?

>  $ make ARCH=arm CROSS_COMPILE=arm-linux- LDFLAGS="-static"
> 
>   Auto-detecting system features:
>   ...                         dwarf: [ on  ]
>   ...                         glibc: [ on  ]
>   ...                          gtk2: [ OFF ]
>   ...                      libaudit: [ on  ]
>   ...                        libbfd: [ on  ]
>   ...                        libelf: [ on  ]
>   ...                       libnuma: [ OFF ]
>   ...                       libperl: [ OFF ]
>   ...                     libpython: [ OFF ]
>   ...                      libslang: [ on  ]
>   ...                     libunwind: [ on  ]
>   ...            libdw-dwarf-unwind: [ OFF ]
>   ...                          zlib: [ on  ]
>   ...                          lzma: [ on  ]
> 
> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>

running the command from changelog failed on my setup,
please check attached log

jirka


---
[jolsa@krava perf]$ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps
mkdir -p dl && cd dl && wget -N https://people.redhat.com/sgrubb/audit/audit-2.4.4.tar.gz
--2015-10-12 13:36:45--  https://people.redhat.com/sgrubb/audit/audit-2.4.4.tar.gz
Resolving people.redhat.com (people.redhat.com)... 10.5.19.28
Connecting to people.redhat.com (people.redhat.com)|10.5.19.28|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1004024 (980K) [application/x-gzip]
Saving to: ‘audit-2.4.4.tar.gz’

audit-2.4.4.tar.gz                 100%[=================================================================>] 980.49K   298KB/s   in 3.3s   

2015-10-12 13:36:50 (298 KB/s) - ‘audit-2.4.4.tar.gz’ saved [1004024/1004024]

mkdir -p build-arm && tar xf dl/audit-2.4.4.tar.gz -C build-arm
touch build-arm/audit-2.4.4/.extract
cd build-arm/audit-2.4.4 && ./configure --host=arm-linux --prefix=/home/jolsa/kernel/linux-perf/tools/perf/deps-arm
Configuring auditd
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking target system type... arm-unknown-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for arm-linux-gcc... arm-linux-gcc
checking whether the C compiler works... no
configure: error: in `/home/jolsa/kernel/linux-perf/tools/perf/build-arm/audit-2.4.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
Makefile.deps:77: recipe for target 'deps-arm/lib/.audit.install' failed
make: *** [deps-arm/lib/.audit.install] Error 77





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] perf: unwind: pass symbol source to libunwind
  2015-10-12 11:24   ` Jiri Olsa
@ 2015-10-12 12:35     ` Namhyung Kim
  2015-10-13 10:51       ` Rabin Vincent
  0 siblings, 1 reply; 19+ messages in thread
From: Namhyung Kim @ 2015-10-12 12:35 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Rabin Vincent, Arnaldo Carvalho de Melo, Ingo Molnar,
	Peter Zijlstra, linux-kernel, Rabin Vincent

Hi Jiri,

On Mon, Oct 12, 2015 at 8:24 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Sun, Sep 27, 2015 at 08:37:56PM +0200, Rabin Vincent wrote:
>> Even if --symfs is used to point to the debug binaries, we send in the
>> non-debug filenames to libunwind, which leads to libunwind not finding
>> the debug frame.  Fix this.
>>
>> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
>
> cc-ing Namhyung on this one

It seems that the dso->symsrc_filename can be NULL and it's unsafe to
call dwarf_find_debug_frame() with the NULL pointer.  Other than that
looks good to me.

Thanks,
Namhyung


>> ---
>>  tools/perf/util/unwind-libunwind.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
>> index ef799dc..b93bf7f 100644
>> --- a/tools/perf/util/unwind-libunwind.c
>> +++ b/tools/perf/util/unwind-libunwind.c
>> @@ -363,7 +363,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
>>                       dso__data_put_fd(map->dso);
>>
>>               memset(&di, 0, sizeof(di));
>> -             if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->name,
>> +             if (dwarf_find_debug_frame(0, &di, ip, base, map->dso->symsrc_filename,
>>                                          map->start, map->end))
>>                       return dwarf_search_unwind_table(as, ip, &di, pi,
>>                                                        need_unwind_info, arg);
>> --
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/



-- 
Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
  2015-10-12 11:42   ` Jiri Olsa
@ 2015-10-13 10:50     ` Rabin Vincent
  2015-10-13 11:52       ` Jiri Olsa
  0 siblings, 1 reply; 19+ messages in thread
From: Rabin Vincent @ 2015-10-13 10:50 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, linux-kernel

On Mon, Oct 12, 2015 at 01:42:29PM +0200, Jiri Olsa wrote:
> On Sun, Sep 27, 2015 at 08:37:59PM +0200, Rabin Vincent wrote:
> > In order to make it easier for people to qucikly get up and running with
> > a fairly full featured cross-compiled mainline perf, provide a
> > Makefile.deps which will download and build the required libraries,
> > which can then be used in a static build of perf:
> > 
> >  $ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps
> 
> Makefile.cross_compile or Makefile.cross might suit better

OK, I will change it to Makefile.cross.

> Could you provide more details help/doc on how to use it
> and what it's actualy doing?

I will add comments to the file with this information.

> running the command from changelog failed on my setup,
> please check attached log

Looks like you don't have a compiler with the name arm-linux-gcc in your
PATH?  The CROSS_COMPILE flag has the same meaning as in the perf and
kernel builds: it's the prefix for a cross-toolchain which is available
on the host.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] perf: unwind: pass symbol source to libunwind
  2015-10-12 12:35     ` Namhyung Kim
@ 2015-10-13 10:51       ` Rabin Vincent
  0 siblings, 0 replies; 19+ messages in thread
From: Rabin Vincent @ 2015-10-13 10:51 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	linux-kernel

On Mon, Oct 12, 2015 at 02:35:08PM +0200, Namhyung Kim wrote:
> On Mon, Oct 12, 2015 at 8:24 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Sun, Sep 27, 2015 at 08:37:56PM +0200, Rabin Vincent wrote:
> >> Even if --symfs is used to point to the debug binaries, we send in the
> >> non-debug filenames to libunwind, which leads to libunwind not finding
> >> the debug frame.  Fix this.
> >>
> >> Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
> >
> > cc-ing Namhyung on this one
> 
> It seems that the dso->symsrc_filename can be NULL and it's unsafe to
> call dwarf_find_debug_frame() with the NULL pointer.  Other than that
> looks good to me.

Thanks, I will change it to fallback to dso->name if
dso->symsrc_filename is NULL.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] tools: build: fix libiberty feature detection
  2015-10-12 11:35   ` Jiri Olsa
@ 2015-10-13 11:00     ` Rabin Vincent
  0 siblings, 0 replies; 19+ messages in thread
From: Rabin Vincent @ 2015-10-13 11:00 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, linux-kernel

On Mon, Oct 12, 2015 at 01:35:02PM +0200, Jiri Olsa wrote:
> We have FEATURE_CHECK_CFLAGS/FEATURE_CHECK_LDFLAGS variables
> to pass CFLAGS/LDFLAGS to feature detection build
> 
> Could you also be more specific on what is missing
> to make the libiberty check compile?

We don't need any special CFLAGS/LDFLAGS for libiberty.  What we do need
is any CFLAGS or LDFLAGS set by the user, for example -I or -L to point
to libraries and include files in custom paths.  In all the other
test-*.bin rules in build/feature/Makefile, we use the BUILD macro which
always sends in CFLAGS and LDFLAGS.  The libiberty build line doesn't
use the BUILD macro and thus needs to send in CFLAGS and LDFLAGS
explicitly.

So FEATURE_CHECK_CFLAGS_libiberty doesn't seem like the correct thing to
use, since that would imply that libiberty needs some special flags?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] perf: add Makefile.deps for easier cross compiling
  2015-10-13 10:50     ` Rabin Vincent
@ 2015-10-13 11:52       ` Jiri Olsa
  0 siblings, 0 replies; 19+ messages in thread
From: Jiri Olsa @ 2015-10-13 11:52 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, linux-kernel

On Tue, Oct 13, 2015 at 12:50:29PM +0200, Rabin Vincent wrote:
> On Mon, Oct 12, 2015 at 01:42:29PM +0200, Jiri Olsa wrote:
> > On Sun, Sep 27, 2015 at 08:37:59PM +0200, Rabin Vincent wrote:
> > > In order to make it easier for people to qucikly get up and running with
> > > a fairly full featured cross-compiled mainline perf, provide a
> > > Makefile.deps which will download and build the required libraries,
> > > which can then be used in a static build of perf:
> > > 
> > >  $ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.deps
> > 
> > Makefile.cross_compile or Makefile.cross might suit better
> 
> OK, I will change it to Makefile.cross.
> 
> > Could you provide more details help/doc on how to use it
> > and what it's actualy doing?
> 
> I will add comments to the file with this information.
> 
> > running the command from changelog failed on my setup,
> > please check attached log
> 
> Looks like you don't have a compiler with the name arm-linux-gcc in your
> PATH?  The CROSS_COMPILE flag has the same meaning as in the perf and
> kernel builds: it's the prefix for a cross-toolchain which is available
> on the host.

could the doc have this description as well? to have
complete info on how to make it cross compile

thanks,
jirka

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [tip:perf/core] perf callchain: Use debug_frame if eh_frame is unusable
  2015-09-27 18:37 ` [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable Rabin Vincent
  2015-10-12 11:28   ` Jiri Olsa
@ 2015-10-14 13:13   ` tip-bot for Rabin Vincent
  1 sibling, 0 replies; 19+ messages in thread
From: tip-bot for Rabin Vincent @ 2015-10-14 13:13 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, jolsa, tglx, hpa, rabinv, acme, a.p.zijlstra,
	rabin.vincent, mingo

Commit-ID:  8eac1d5e9256260b9cc3bfcdd9b8b995990950f5
Gitweb:     http://git.kernel.org/tip/8eac1d5e9256260b9cc3bfcdd9b8b995990950f5
Author:     Rabin Vincent <rabin.vincent@axis.com>
AuthorDate: Sun, 27 Sep 2015 20:37:57 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 12 Oct 2015 23:25:25 -0300

perf callchain: Use debug_frame if eh_frame is unusable

When NO_LIBUNWIND_DEBUG_FRAME=0, use the .debug_frame if the .eh_frame
doesn't contain the approprate unwind tables.

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Rabin Vincent <rabinv@axis.com>
Link: http://lkml.kernel.org/r/1443379079-29133-3-git-send-email-rabin.vincent@axis.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/unwind-libunwind.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 4c00507..ea993f6 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -330,6 +330,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 	struct map *map;
 	unw_dyn_info_t di;
 	u64 table_data, segbase, fde_count;
+	int ret = -EINVAL;
 
 	map = find_map(ip, ui);
 	if (!map || !map->dso)
@@ -348,13 +349,14 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 		di.u.rti.table_data = map->start + table_data;
 		di.u.rti.table_len  = fde_count * sizeof(struct table_entry)
 				      / sizeof(unw_word_t);
-		return dwarf_search_unwind_table(as, ip, &di, pi,
-						 need_unwind_info, arg);
+		ret = dwarf_search_unwind_table(as, ip, &di, pi,
+						need_unwind_info, arg);
 	}
 
 #ifndef NO_LIBUNWIND_DEBUG_FRAME
 	/* Check the .debug_frame section for unwinding info */
-	if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
+	if (ret < 0 &&
+	    !read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
 		int fd = dso__data_get_fd(map->dso, ui->machine);
 		int is_exec = elf_is_exec(fd, map->dso->name);
 		unw_word_t base = is_exec ? 0 : map->start;
@@ -370,7 +372,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
 	}
 #endif
 
-	return -EINVAL;
+	return ret;
 }
 
 static int access_fpreg(unw_addr_space_t __maybe_unused as,

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [tip:perf/core] perf callchains: Fix unw_word_t pointer casts
  2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
                   ` (4 preceding siblings ...)
  2015-10-10 15:49 ` [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
@ 2015-10-14 13:14 ` tip-bot for Rabin Vincent
  5 siblings, 0 replies; 19+ messages in thread
From: tip-bot for Rabin Vincent @ 2015-10-14 13:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, rabin.vincent, jolsa, acme, a.p.zijlstra, hpa,
	mingo, rabinv, tglx

Commit-ID:  186c6cfb32beae66140bc3c3fe4a519ee0234e33
Gitweb:     http://git.kernel.org/tip/186c6cfb32beae66140bc3c3fe4a519ee0234e33
Author:     Rabin Vincent <rabin.vincent@axis.com>
AuthorDate: Sun, 27 Sep 2015 20:37:55 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 12 Oct 2015 23:27:40 -0300

perf callchains: Fix unw_word_t pointer casts

unw_word_t is uint64_t even on 32-bit MIPS.  Cast it to uintptr_t before
the cast to void *p to get rid of the following errors:

  util/unwind-libunwind.c: In function 'access_mem':
  util/unwind-libunwind.c:464:4: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  util/unwind-libunwind.c:475:2: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  cc1: all warnings being treated as errors
  make[3]: *** [util/unwind-libunwind.o] Error 1

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Rabin Vincent <rabinv@axis.com>
Link: http://lkml.kernel.org/r/1443379079-29133-1-git-send-email-rabin.vincent@axis.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/unwind-libunwind.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index ea993f6..f729f9e 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -463,7 +463,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
 		if (ret) {
 			pr_debug("unwind: access_mem %p not inside range"
 				 " 0x%" PRIx64 "-0x%" PRIx64 "\n",
-				 (void *) addr, start, end);
+				 (void *) (uintptr_t) addr, start, end);
 			*valp = 0;
 			return ret;
 		}
@@ -473,7 +473,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
 	offset = addr - start;
 	*valp  = *(unw_word_t *)&stack->data[offset];
 	pr_debug("unwind: access_mem addr %p val %lx, offset %d\n",
-		 (void *) addr, (unsigned long)*valp, offset);
+		 (void *) (uintptr_t) addr, (unsigned long)*valp, offset);
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-10-14 13:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-27 18:37 [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
2015-09-27 18:37 ` [PATCH 2/5] perf: unwind: pass symbol source to libunwind Rabin Vincent
2015-10-12 11:24   ` Jiri Olsa
2015-10-12 12:35     ` Namhyung Kim
2015-10-13 10:51       ` Rabin Vincent
2015-09-27 18:37 ` [PATCH 3/5] perf: unwind: use debug_frame if eh_frame is unusable Rabin Vincent
2015-10-12 11:28   ` Jiri Olsa
2015-10-14 13:13   ` [tip:perf/core] perf callchain: Use " tip-bot for Rabin Vincent
2015-09-27 18:37 ` [PATCH 4/5] tools: build: fix libiberty feature detection Rabin Vincent
2015-10-12 11:35   ` Jiri Olsa
2015-10-13 11:00     ` Rabin Vincent
2015-09-27 18:37 ` [PATCH 5/5] perf: add Makefile.deps for easier cross compiling Rabin Vincent
2015-10-12 11:42   ` Jiri Olsa
2015-10-13 10:50     ` Rabin Vincent
2015-10-13 11:52       ` Jiri Olsa
2015-10-10 15:49 ` [PATCH 1/5] perf: unwind: fix unw_word_t pointer casts Rabin Vincent
2015-10-10 23:34   ` Arnaldo Carvalho de Melo
2015-10-12  8:38     ` Jiri Olsa
2015-10-14 13:14 ` [tip:perf/core] perf callchains: Fix " tip-bot for Rabin Vincent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.