* [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag
2017-09-08 8:46 [PATCH 1/3] tools lib api: Fix make DEBUG=1 build Jiri Olsa
@ 2017-09-08 8:46 ` Jiri Olsa
2017-09-08 18:11 ` Arnaldo Carvalho de Melo
2017-09-13 7:44 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2017-09-08 8:46 ` [PATCH 3/3] perf tools: Add python-clean target Jiri Olsa
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Jiri Olsa @ 2017-09-08 8:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Ingo Molnar, Namhyung Kim, David Ahern, Peter Zijlstra
Do not carry the perf.data file descriptor into
the workload process and close it when perf
executes the workload.
Link: http://lkml.kernel.org/n/tip-j7qdp4ucreain1cqvy485wd4@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/data.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index e84bbc8ec058..6b9d3ec2c276 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -96,7 +96,8 @@ static int open_file_write(struct perf_data_file *file)
if (check_backup(file))
return -1;
- fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+ fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC,
+ S_IRUSR|S_IWUSR);
if (fd < 0)
pr_err("failed to open %s : %s\n", file->path,
--
2.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag
2017-09-08 8:46 ` [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag Jiri Olsa
@ 2017-09-08 18:11 ` Arnaldo Carvalho de Melo
2017-09-13 7:44 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
1 sibling, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-09-08 18:11 UTC (permalink / raw)
To: Jiri Olsa; +Cc: lkml, Ingo Molnar, Namhyung Kim, David Ahern, Peter Zijlstra
Em Fri, Sep 08, 2017 at 10:46:20AM +0200, Jiri Olsa escreveu:
> Do not carry the perf.data file descriptor into
> the workload process and close it when perf
> executes the workload.
Fails in some systems with:
util/data.c: In function 'open_file_write':
util/data.c:99: error: 'O_CLOEXEC' undeclared (first use in this function)
util/data.c:99: error: (Each undeclared identifier is reported only once
util/data.c:99: error: for each function it appears in.)
mv: cannot stat `/tmp/build/perf/util/.data.o.tmp': No such file or directory
just FYI, I'll get this fixed.
Thanks,
- Arnaldo
> Link: http://lkml.kernel.org/n/tip-j7qdp4ucreain1cqvy485wd4@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/perf/util/data.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> index e84bbc8ec058..6b9d3ec2c276 100644
> --- a/tools/perf/util/data.c
> +++ b/tools/perf/util/data.c
> @@ -96,7 +96,8 @@ static int open_file_write(struct perf_data_file *file)
> if (check_backup(file))
> return -1;
>
> - fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
> + fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC,
> + S_IRUSR|S_IWUSR);
>
> if (fd < 0)
> pr_err("failed to open %s : %s\n", file->path,
> --
> 2.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread* [tip:perf/urgent] perf tools: Open perf.data with O_CLOEXEC flag
2017-09-08 8:46 ` [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag Jiri Olsa
2017-09-08 18:11 ` Arnaldo Carvalho de Melo
@ 2017-09-13 7:44 ` tip-bot for Jiri Olsa
1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-09-13 7:44 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, mingo, tglx, linux-kernel, dsahern, hpa, namhyung, jolsa,
a.p.zijlstra
Commit-ID: cd6379ebb55ae53e77f17e22ce830bf3fe826736
Gitweb: http://git.kernel.org/tip/cd6379ebb55ae53e77f17e22ce830bf3fe826736
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Fri, 8 Sep 2017 10:46:20 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Sep 2017 12:34:23 -0300
perf tools: Open perf.data with O_CLOEXEC flag
Do not carry the perf.data file descriptor into the workload process and
close it when perf executes the workload.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170908084621.31595-2-jolsa@kernel.org
[ Add definitions for O_CLOEXEC for older systems ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/data.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index e84bbc8..263f5a9 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -10,6 +10,16 @@
#include "util.h"
#include "debug.h"
+#ifndef O_CLOEXEC
+#ifdef __sparc__
+#define O_CLOEXEC 0x400000
+#elif defined(__alpha__) || defined(__hppa__)
+#define O_CLOEXEC 010000000
+#else
+#define O_CLOEXEC 02000000
+#endif
+#endif
+
static bool check_pipe(struct perf_data_file *file)
{
struct stat st;
@@ -96,7 +106,8 @@ static int open_file_write(struct perf_data_file *file)
if (check_backup(file))
return -1;
- fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+ fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC,
+ S_IRUSR|S_IWUSR);
if (fd < 0)
pr_err("failed to open %s : %s\n", file->path,
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] perf tools: Add python-clean target
2017-09-08 8:46 [PATCH 1/3] tools lib api: Fix make DEBUG=1 build Jiri Olsa
2017-09-08 8:46 ` [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag Jiri Olsa
@ 2017-09-08 8:46 ` Jiri Olsa
2017-09-22 16:34 ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-09-08 13:29 ` [PATCH 1/3] tools lib api: Fix make DEBUG=1 build Arnaldo Carvalho de Melo
2017-09-13 7:44 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
3 siblings, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2017-09-08 8:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Ingo Molnar, Namhyung Kim, David Ahern, Peter Zijlstra
To be able to cleanup only python related binaries.
Link: http://lkml.kernel.org/n/tip-j7qdp4ucreain1cqvy485wd4@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/Makefile.perf | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 91ef44bfaf3e..1df93b4c4648 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -173,7 +173,7 @@ AWK = awk
# non-config cases
config := 1
-NON_CONFIG_TARGETS := clean TAGS tags cscope help install-doc install-man install-html install-info install-pdf doc man html info pdf
+NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help install-doc install-man install-html install-info install-pdf doc man html info pdf
ifdef MAKECMDGOALS
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
@@ -802,7 +802,10 @@ config-clean:
$(call QUIET_CLEAN, config)
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null
-clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean
+python-clean:
+ $(python-clean)
+
+clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean python-clean
$(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
$(Q)$(RM) $(OUTPUT).config-detected
@@ -819,7 +822,6 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(OUTPUT)$(vhost_virtio_ioctl_array) \
$(OUTPUT)$(perf_ioctl_array)
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
- $(python-clean)
#
# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
--
2.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:perf/core] perf tools: Add python-clean target
2017-09-08 8:46 ` [PATCH 3/3] perf tools: Add python-clean target Jiri Olsa
@ 2017-09-22 16:34 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-09-22 16:34 UTC (permalink / raw)
To: linux-tip-commits
Cc: a.p.zijlstra, tglx, dsahern, linux-kernel, hpa, namhyung, jolsa,
acme, mingo
Commit-ID: 80f873557112fc163f011cd131d4cfe4959100a6
Gitweb: http://git.kernel.org/tip/80f873557112fc163f011cd131d4cfe4959100a6
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Fri, 8 Sep 2017 10:46:21 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 13 Sep 2017 09:49:15 -0300
perf tools: Add python-clean target
To be able to cleanup only python related binaries.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170908084621.31595-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.perf | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 91ef44b..1df93b4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -173,7 +173,7 @@ AWK = awk
# non-config cases
config := 1
-NON_CONFIG_TARGETS := clean TAGS tags cscope help install-doc install-man install-html install-info install-pdf doc man html info pdf
+NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help install-doc install-man install-html install-info install-pdf doc man html info pdf
ifdef MAKECMDGOALS
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
@@ -802,7 +802,10 @@ config-clean:
$(call QUIET_CLEAN, config)
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null
-clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean
+python-clean:
+ $(python-clean)
+
+clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean python-clean
$(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
$(Q)$(RM) $(OUTPUT).config-detected
@@ -819,7 +822,6 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(OUTPUT)$(vhost_virtio_ioctl_array) \
$(OUTPUT)$(perf_ioctl_array)
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
- $(python-clean)
#
# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] tools lib api: Fix make DEBUG=1 build
2017-09-08 8:46 [PATCH 1/3] tools lib api: Fix make DEBUG=1 build Jiri Olsa
2017-09-08 8:46 ` [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag Jiri Olsa
2017-09-08 8:46 ` [PATCH 3/3] perf tools: Add python-clean target Jiri Olsa
@ 2017-09-08 13:29 ` Arnaldo Carvalho de Melo
2017-09-13 7:44 ` [tip:perf/urgent] " tip-bot for Jiri Olsa
3 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-09-08 13:29 UTC (permalink / raw)
To: Jiri Olsa; +Cc: lkml, Ingo Molnar, Namhyung Kim, David Ahern, Peter Zijlstra
Em Fri, Sep 08, 2017 at 10:46:19AM +0200, Jiri Olsa escreveu:
> Do not use -D_FORTIFY_SOURCE=2 for DEBUG build as it seems to
> mess up with debuginfo, which results in bad gdb experience.
>
> We already do that for perf.
Thanks, applied 1-3.
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/urgent] tools lib api: Fix make DEBUG=1 build
2017-09-08 8:46 [PATCH 1/3] tools lib api: Fix make DEBUG=1 build Jiri Olsa
` (2 preceding siblings ...)
2017-09-08 13:29 ` [PATCH 1/3] tools lib api: Fix make DEBUG=1 build Arnaldo Carvalho de Melo
@ 2017-09-13 7:44 ` tip-bot for Jiri Olsa
3 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-09-13 7:44 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, a.p.zijlstra, linux-kernel, hpa, acme, dsahern, namhyung,
tglx, mingo
Commit-ID: 58b79186c34306f4a14e98119afc10744a42fa40
Gitweb: http://git.kernel.org/tip/58b79186c34306f4a14e98119afc10744a42fa40
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Fri, 8 Sep 2017 10:46:19 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Sep 2017 12:34:14 -0300
tools lib api: Fix make DEBUG=1 build
Do not use -D_FORTIFY_SOURCE=2 for DEBUG build as it seems to mess up
with debuginfo, which results in bad gdb experience.
We already do that for tools/perf/.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170908084621.31595-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/api/Makefile | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 4563ba7..1e83e3c 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -17,13 +17,19 @@ MAKEFLAGS += --no-print-directory
LIBFILE = $(OUTPUT)libapi.a
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
-CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
+CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
+ifeq ($(DEBUG),0)
ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3
else
CFLAGS += -O6
endif
+endif
+
+ifeq ($(DEBUG),0)
+ CFLAGS += -D_FORTIFY_SOURCE
+endif
# Treat warnings as errors unless directed not to
ifneq ($(WERROR),0)
^ permalink raw reply related [flat|nested] 8+ messages in thread