Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1690867 > unrolled thread
| Started by | David Carrillo-Cisneros <davidcc@google.com> |
|---|---|
| First post | 2017-07-19 03:20 +0200 |
| Last post | 2017-07-21 19:10 +0200 |
| Articles | 9 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4] Resubmitted forgotten patches David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
[PATCH 4/4] tools: perf: Fix linker error when libelf config is disabled David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
[tip:perf/core] perf jvmti: Fix linker error when libelf config is disabled tip-bot for Sudeep Holla <tipbot@zytor.com> - 2017-07-26 19:30 +0200
[PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
Re: [PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-21 19:00 +0200
[PATCH 2/4] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile David Carrillo-Cisneros <davidcc@google.com> - 2017-07-19 03:20 +0200
[tip:perf/core] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-07-26 19:30 +0200
Re: [PATCH 0/4] Resubmitted forgotten patches Jiri Olsa <jolsa@redhat.com> - 2017-07-19 10:50 +0200
Re: [PATCH 0/4] Resubmitted forgotten patches Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-21 19:10 +0200
| From | David Carrillo-Cisneros <davidcc@google.com> |
|---|---|
| Date | 2017-07-19 03:20 +0200 |
| Subject | [PATCH 0/4] Resubmitted forgotten patches |
| Message-ID | <u4LOF-1ts-3@gated-at.bofh.it> |
Pickup some small fixes that have been forgotten. David Carrillo-Cisneros (3): perf tool cgroup: Initialize cgroup refcnt with refcount_set perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile perf annotate: Process tracing data in pipe mode Sudeep Holla (1): tools: perf: Fix linker error when libelf config is disabled tools/perf/Makefile.perf | 10 ++++++++-- tools/perf/builtin-annotate.c | 1 + tools/perf/util/cgroup.c | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) -- 2.13.2.932.g7449e964c-goog
[toc] | [next] | [standalone]
| From | David Carrillo-Cisneros <davidcc@google.com> |
|---|---|
| Date | 2017-07-19 03:20 +0200 |
| Subject | [PATCH 4/4] tools: perf: Fix linker error when libelf config is disabled |
| Message-ID | <u4LOG-1ts-15@gated-at.bofh.it> |
| In reply to | #1690867 |
From: Sudeep Holla <Sudeep.Holla@arm.com>
When libelf is disabled in the configuration, we get the following
linker error:
LINK libperf-jvmti.so
ld: cannot find -lelf
Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.
Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: David Carrillo-Cisneros <davidcc@google.com>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 100a6c1670c8..d66f90e6be5c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -518,7 +518,7 @@ $(LIBJVMTI_IN): FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
- $(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+ $(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
endif
$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
--
2.13.2.932.g7449e964c-goog
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Sudeep Holla <tipbot@zytor.com> |
|---|---|
| Date | 2017-07-26 19:30 +0200 |
| Subject | [tip:perf/core] perf jvmti: Fix linker error when libelf config is disabled |
| Message-ID | <u7yih-3eE-79@gated-at.bofh.it> |
| In reply to | #1690870 |
Commit-ID: 5d90faf45427dd76fadbe7a4dc4fce3b6f87b550
Gitweb: http://git.kernel.org/tip/5d90faf45427dd76fadbe7a4dc4fce3b6f87b550
Author: Sudeep Holla <Sudeep.Holla@arm.com>
AuthorDate: Tue, 18 Jul 2017 18:18:39 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 25 Jul 2017 11:23:53 -0300
perf jvmti: Fix linker error when libelf config is disabled
When libelf is disabled in the configuration, we get the following
linker error:
LINK libperf-jvmti.so
ld: cannot find -lelf
Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
Jiri pointed out that both librt and libelf are not really required. So
this patch fixes the linker error by getting rid of unwanted libraries
in the linker stage.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: David Carrillo-Cisneros <davidcc@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 209045adc2bb ("perf tools: add JVMTI agent library")
Link: http://lkml.kernel.org/r/20170719011839.99399-5-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 100a6c1..d66f90e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -518,7 +518,7 @@ $(LIBJVMTI_IN): FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
- $(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< -lelf -lrt
+ $(QUIET_LINK)$(CC) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
endif
$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
[toc] | [prev] | [next] | [standalone]
| From | David Carrillo-Cisneros <davidcc@google.com> |
|---|---|
| Date | 2017-07-19 03:20 +0200 |
| Subject | [PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set |
| Message-ID | <u4LOG-1ts-11@gated-at.bofh.it> |
| In reply to | #1690867 |
Atomic reference counters were replaced by refcount_t in
commit 79c5fe6db8c7 ("perf/core: Fix error handling in perf_event_alloc()")
In util/cgroup.c atomic_inc was replaced by refcount_inc, but the latter
is not mean to initiliaze refcounts with zero value. Add a path
to initialize cgrp->refcnt == 0 using refcount_set.
Before this patch:
$ perf stat -e cycles -C 0 -G /
perf_before: /usr/local/.../tools/include/linux/refcount.h:108: refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
Aborted (core dumped)
After this patch:
$ perf stat -e cycles -C 0 -G /
Performance counter stats for 'CPU(s) 0':
17,516,664 cycles /
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Change-Id: I8f00f61aaecce876e7df448bd7f850b20db13ef1
---
tools/perf/util/cgroup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 03347748f3fa..7bbc19b3caf3 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -133,7 +133,10 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
return -1;
found:
- refcount_inc(&cgrp->refcnt);
+ if (refcount_read(&cgrp->refcnt) == 0)
+ refcount_set(&cgrp->refcnt, 1);
+ else
+ refcount_inc(&cgrp->refcnt);
counter->cgrp = cgrp;
return 0;
}
--
2.13.2.932.g7449e964c-goog
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2017-07-21 19:00 +0200 |
| Subject | Re: [PATCH 1/4] perf tool cgroup: Initialize cgroup refcnt with refcount_set |
| Message-ID | <u5Jrs-7hV-39@gated-at.bofh.it> |
| In reply to | #1690872 |
Em Tue, Jul 18, 2017 at 06:18:36PM -0700, David Carrillo-Cisneros escreveu:
> Atomic reference counters were replaced by refcount_t in
> commit 79c5fe6db8c7 ("perf/core: Fix error handling in perf_event_alloc()")
>
> In util/cgroup.c atomic_inc was replaced by refcount_inc, but the latter
> is not mean to initiliaze refcounts with zero value. Add a path
> to initialize cgrp->refcnt == 0 using refcount_set.
>
> Before this patch:
>
> $ perf stat -e cycles -C 0 -G /
> perf_before: /usr/local/.../tools/include/linux/refcount.h:108: refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
> Aborted (core dumped)
>
> After this patch:
>
> $ perf stat -e cycles -C 0 -G /
> Performance counter stats for 'CPU(s) 0':
> 17,516,664 cycles /
Ok, so this one was also reported by Brendan and I came up with an
alternative patch, that follows the usual sequence of steps, see below.
- Arnaldo
commit b13ca9843c4ea07c5a1dbf0295986b5dfeb6ef6f
Author: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Date: Tue Jul 18 20:20:19 2017 -0300
perf cgroup: Fix refcount usage
When converting from atomic_t to refcount_t we didn't follow the usual
step of initializing it to one before taking any new reference, which
trips over checking if taking a reference for a freed refcount_t, fix
it.
Brendan's report:
---
It's 4.12-rc7, with node v4.4.1. I'm building 4.13-rc1 now, as I hit
what I think is another unrelated perf bug and I'm starting to wonder
what else is broken on that version:
(root) /mnt/src/linux-4.12-rc7/tools/perf # ./perf record -F 99 -a -e
cpu-clock --cgroup=docker/f9e9d5df065b14646e8a11edc837a13877fd90c171137b2ba3feb67a0201cb65
-g
perf: /mnt/src/linux-4.12-rc7/tools/include/linux/refcount.h:108:
refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
Aborted
that used to work...
---
Testing it:
Before:
# perf stat -e cycles -C 0 --cgroup /
perf: /home/acme/git/linux/tools/include/linux/refcount.h:108: refcount_inc: Assertion `!(!refcount_inc_not_zero(r))' failed.
Aborted (core dumped)
#
After:
# perf stat -e cycles -C 0 --cgroup /
^C
Performance counter stats for 'CPU(s) 0':
132,081,393 cycles /
2.492942763 seconds time elapsed
#
Reported-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Acked-by: Elena Reshetova <elena.reshetova@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sudeep Holla <Sudeep.Holla@arm.com>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 79c5fe6db8c7 ("perf cgroup: Convert cgroup_sel.refcnt from atomic_t to refcount_t")
Link: http://lkml.kernel.org/n/tip-l7ovfblq14ip2i08m1g0fkhv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 03347748f3fa..0e77bc9e5f3c 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -98,8 +98,10 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
cgrp = counter->cgrp;
if (!cgrp)
continue;
- if (!strcmp(cgrp->name, str))
+ if (!strcmp(cgrp->name, str)) {
+ refcount_inc(&cgrp->refcnt);
break;
+ }
cgrp = NULL;
}
@@ -110,6 +112,7 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
return -1;
cgrp->name = str;
+ refcount_set(&cgrp->refcnt, 1);
cgrp->fd = open_cgroup(str);
if (cgrp->fd == -1) {
@@ -128,12 +131,11 @@ static int add_cgroup(struct perf_evlist *evlist, char *str)
goto found;
n++;
}
- if (refcount_read(&cgrp->refcnt) == 0)
+ if (refcount_dec_and_test(&cgrp->refcnt))
free(cgrp);
return -1;
found:
- refcount_inc(&cgrp->refcnt);
counter->cgrp = cgrp;
return 0;
}
[toc] | [prev] | [next] | [standalone]
| From | David Carrillo-Cisneros <davidcc@google.com> |
|---|---|
| Date | 2017-07-19 03:20 +0200 |
| Subject | [PATCH 2/4] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile |
| Message-ID | <u4LOG-1ts-17@gated-at.bofh.it> |
| In reply to | #1690867 |
The goal is to allow users to override linking of libraries that were automatically added to PERFLIBS. EXCLUDE_EXTLIBS contains linker flags to be removed from LIBS while EXTRA_PERFLIBS contains linker flags to be added. My use case is to force certain library to be build statically, e.g. for libelf: EXCLUDE_EXTLIBS=-lelf EXTRA_PERFLIBS=path/libelf.a Signed-off-by: David Carrillo-Cisneros <davidcc@google.com> --- tools/perf/Makefile.perf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5008f51a08a2..100a6c1670c8 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -33,6 +33,11 @@ include ../scripts/utilities.mak # # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. # +# Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated +# EXTLIBS. +# +# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS. +# # Define NO_DWARF if you do not want debug-info analysis feature at all. # # Define WERROR=0 to disable treating any warnings as errors. @@ -352,7 +357,8 @@ ifdef ASCIIDOC8 export ASCIIDOC8 endif -LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group +EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS)) +LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group ifeq ($(USE_CLANG), 1) CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization -- 2.13.2.932.g7449e964c-goog
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> |
|---|---|
| Date | 2017-07-26 19:30 +0200 |
| Subject | [tip:perf/core] perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile |
| Message-ID | <u7yif-3eE-39@gated-at.bofh.it> |
| In reply to | #1690873 |
Commit-ID: cb281fea4b0a326d2a2104f8ffae2b6895c561fd Gitweb: http://git.kernel.org/tip/cb281fea4b0a326d2a2104f8ffae2b6895c561fd Author: David Carrillo-Cisneros <davidcc@google.com> AuthorDate: Tue, 18 Jul 2017 18:18:37 -0700 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Tue, 25 Jul 2017 11:23:51 -0300 perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile The goal is to allow users to override linking of libraries that were automatically added to PERFLIBS. EXCLUDE_EXTLIBS contains linker flags to be removed from LIBS while EXTRA_PERFLIBS contains linker flags to be added. My use case is to force certain library to be build statically, e.g. for libelf: EXCLUDE_EXTLIBS=-lelf EXTRA_PERFLIBS=path/libelf.a Signed-off-by: David Carrillo-Cisneros <davidcc@google.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Elena Reshetova <elena.reshetova@intel.com> Cc: Kees Kook <keescook@chromium.org> Cc: Paul Turner <pjt@google.com> Cc: Stephane Eranian <eranian@google.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20170719011839.99399-3-davidcc@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/Makefile.perf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5008f51..100a6c1 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -33,6 +33,11 @@ include ../scripts/utilities.mak # # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. # +# Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated +# EXTLIBS. +# +# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS. +# # Define NO_DWARF if you do not want debug-info analysis feature at all. # # Define WERROR=0 to disable treating any warnings as errors. @@ -352,7 +357,8 @@ ifdef ASCIIDOC8 export ASCIIDOC8 endif -LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group +EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS)) +LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group ifeq ($(USE_CLANG), 1) CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2017-07-19 10:50 +0200 |
| Message-ID | <u4SQ9-62M-5@gated-at.bofh.it> |
| In reply to | #1690867 |
On Tue, Jul 18, 2017 at 06:18:35PM -0700, David Carrillo-Cisneros wrote: > Pickup some small fixes that have been forgotten. > > David Carrillo-Cisneros (3): > perf tool cgroup: Initialize cgroup refcnt with refcount_set > perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS to makefile > perf annotate: Process tracing data in pipe mode > > Sudeep Holla (1): > tools: perf: Fix linker error when libelf config is disabled for patchset: Acked-by: Jiri Olsa <jolsa@kernel.org> thanks, jirka
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2017-07-21 19:10 +0200 |
| Message-ID | <u5JB7-7Ar-11@gated-at.bofh.it> |
| In reply to | #1690867 |
Em Tue, Jul 18, 2017 at 06:18:35PM -0700, David Carrillo-Cisneros escreveu: > Pickup some small fixes that have been forgotten. Thanks, applied 2-4, and sent the alternative patch for 1/4 for your information. - Arnaldo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web