tools lib api: Fix make DEBUG=1 build
Jiri Olsa
reviewerPATCH 1/3 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 perf.
--- tools/lib/api/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/lib/api/Makefile +7 -1
@@ -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)
Signature · 1 line
2.9.5
Jiri Olsa
reviewerPATCH 2/3 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.
--- tools/perf/util/data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/data.c +2 -1
@@ -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,
Signature · 1 line
2.9.5
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 2/3] perf tools: Open perf.data with O_CLOEXEC flag
Em Fri, Sep 08, 2017 at 10:46:20AM +0200, Jiri Olsa escreveu:
Quoted 3 lines
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
Quoted 22 lines
Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/util/data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/data.c +2
-1@@ -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,Signature · 1 line
2.9.5
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf tools: Open perf.data with O_CLOEXEC flag
In reply to Jiri Olsaperf tools: Open perf.data with O_CLOEXEC flag
Commit-ID: cd6379ebb55ae53e77f17e22ce830bf3fe826736 Gitweb: http://git.kernel.org/tip/cd6379ebb55ae53e77f17e22ce830bf3fe826736 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 8 Sep 2017 10:46:20 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/perf/util/data.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tools/perf/util/data.c +12 -1
@@ -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,
Jiri Olsa
reviewerPATCH 3/3 perf tools: Add python-clean target
In reply to Jiri OlsaTo be able to cleanup only python related binaries.
--- tools/perf/Makefile.perf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/perf/Makefile.perf +5 -3
@@ -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)
Signature · 1 line
2.9.5
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Add python-clean target
perf tools: Add python-clean target
Commit-ID: 80f873557112fc163f011cd131d4cfe4959100a6 Gitweb: http://git.kernel.org/tip/80f873557112fc163f011cd131d4cfe4959100a6 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 8 Sep 2017 10:46:21 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 13 Sep 2017 09:49:15 -0300
perf tools: Add python-clean target
To be able to cleanup only python related binaries.
--- tools/perf/Makefile.perf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/perf/Makefile.perf +5 -3
@@ -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)
Em Fri, Sep 08, 2017 at 10:46:19AM +0200, Jiri Olsa escreveu:
Quoted 4 lines
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
tip-bot for Jiri Olsa
merge bottools lib api: Fix make DEBUG=1 build
Commit-ID: 58b79186c34306f4a14e98119afc10744a42fa40 Gitweb: http://git.kernel.org/tip/58b79186c34306f4a14e98119afc10744a42fa40 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 8 Sep 2017 10:46:19 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> 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/.
--- tools/lib/api/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/lib/api/Makefile +7 -1
@@ -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)