Skip to contentSkip to conversation

tools/perf/build: Fix detection of non-core features

PATCH In review David Ahern 4 participants 9 messages Oct 29, 2013 – Nov 6, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 tools/perf/build: Fix detection of non-core features

feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.

Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
---
 tools/perf/config/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/config/Makefile +5 -5
index 543aa953bab1..c82772207e6e 100644
@@ -96,7 +96,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS="$(LDFLAGS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -233,7 +233,7 @@ CFLAGS += -I$(LIB_INCLUDE)
 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 ifndef NO_BIONIC
-  $(feature_check,bionic)
+  $(call feature_check,bionic)
   ifeq ($(feature-bionic), 1)
     BIONIC := 1
     EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
@@ -470,15 +470,15 @@ else
     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
   else
     ifneq ($(feature-libbfd), 1)
-      $(feature_check,liberty)
+      $(call feature_check,liberty)
       ifeq ($(feature-liberty), 1)
         EXTLIBS += -lbfd -liberty
       else
-        $(feature_check,liberty-z)
+        $(call feature_check,liberty-z)
         ifeq ($(feature-liberty-z), 1)
           EXTLIBS += -lbfd -liberty -lz
         else
-          $(feature_check,cplus-demangle)
+          $(call feature_check,cplus-demangle)
           ifeq ($(feature-cplus-demangle), 1)
             EXTLIBS += -liberty
             CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
Signature · 1 line
1.7.12.4 (Apple Git-37)
#1 lore raw

PATCH 2/2 perf kvm: Disable live command if timerfd is not supported

If the OS does not have timerfd support (e.g., older OS'es like RHEL5) disable perf kvm stat live.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
---
 tools/perf/builtin-kvm.c                        | 12 ++++++++++++
 tools/perf/config/Makefile                      |  7 +++++++
 tools/perf/config/feature-checks/Makefile       |  6 +++++-
 tools/perf/config/feature-checks/test-all.c     |  5 +++++
 tools/perf/config/feature-checks/test-timerfd.c | 18 ++++++++++++++++++
 5 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/config/feature-checks/test-timerfd.c
tools/perf/builtin-kvm.c +12 -0
index cb05f39d8a77..cd9f92078aba 100644
@@ -20,7 +20,9 @@
 #include "util/data.h"
 
 #include <sys/prctl.h>
+#ifdef HAVE_TIMERFD_SUPPORT
 #include <sys/timerfd.h>
+#endif
 
 #include <termios.h>
 #include <semaphore.h>
@@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
 		INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 static void clear_events_cache_stats(struct list_head *kvm_events_cache)
 {
 	struct list_head *head;
@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache)
 		}
 	}
 }
+#endif
 
 static int kvm_events_hash_fn(u64 key)
 {
@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)
 		pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 static int process_lost_event(struct perf_tool *tool,
 			      union perf_event *event __maybe_unused,
 			      struct perf_sample *sample __maybe_unused,
@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool,
 	kvm->lost_events++;
 	return 0;
 }
+#endif
 
 static bool skip_sample(struct perf_kvm_stat *kvm,
 			struct perf_sample *sample)
@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)
 	return true;
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 /* keeping the max events to a modest level to keep
  * the processing of samples per mmap smooth.
  */
@@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
 out:
 	return rc;
 }
+#endif
 
 static int read_events(struct perf_kvm_stat *kvm)
 {
@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
 	return kvm_events_report_vcpu(kvm);
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 static struct perf_evlist *kvm_live_event_list(void)
 {
 	struct perf_evlist *evlist;
@@ -1566,6 +1575,7 @@ out:
 
 	return err;
 }
+#endif
 
 static void print_kvm_stat_usage(void)
 {
@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
 	if (!strncmp(argv[1], "rep", 3))
 		return kvm_events_report(&kvm, argc - 1 , argv + 1);
 
+#ifdef HAVE_TIMERFD_SUPPORT
 	if (!strncmp(argv[1], "live", 4))
 		return kvm_events_live(&kvm, argc - 1 , argv + 1);
+#endif
 
 perf_stat:
 	return cmd_stat(argc, argv, NULL);
tools/perf/config/Makefile +7 -0
index c82772207e6e..afe4945e3e84 100644
@@ -395,6 +395,13 @@ else
   endif
 endif
 
+$(call feature_check,timerfd)
+ifeq ($(feature-timerfd), 1)
+  CFLAGS += -DHAVE_TIMERFD_SUPPORT
+else
+  msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+endif
+
 disable-python = $(eval $(disable-python_code))
 define disable-python_code
   CFLAGS += -DNO_LIBPYTHON
tools/perf/config/feature-checks/Makefile +5 -1
index 452b67cc4d7b..a4d4173c576e 100644
@@ -25,7 +25,8 @@ FILES=					\
 	test-libunwind			\
 	test-on-exit			\
 	test-stackprotector-all		\
-	test-stackprotector
+	test-stackprotector		\
+	test-timerfd
 
 CC := $(CC) -MD
 
@@ -136,6 +137,9 @@ test-on-exit:
 test-backtrace:
 	$(BUILD)
 
+test-timerfd:
+	$(BUILD)
+
 -include *.d
 
 ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
index 50d431892a0c..59e7a705e146 100644
@@ -81,6 +81,10 @@
 # include "test-libnuma.c"
 #undef main
 
+#define main main_test_timerfd
+# include "test-timerfd.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -101,6 +105,7 @@ int main(int argc, char *argv[])
 	main_test_on_exit();
 	main_test_backtrace();
 	main_test_libnuma();
+	main_test_timerfd();
 
 	return 0;
 }
tools/perf/config/feature-checks/test-timerfd.c new file +18 -0
new file mode 100644
index 000000000000..8c5c083b4d3c
@@ -0,0 +1,18 @@
+/*
+ * test for timerfd functions used by perf-kvm-stat-live
+ */
+#include <sys/timerfd.h>
+
+int main(void)
+{
+	struct itimerspec new_value;
+
+	int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
+	if (fd < 0)
+		return 1;
+
+	if (timerfd_settime(fd, 0, &new_value, NULL) != 0)
+		return 1;
+
+	return 0;
+}
Signature · 1 line
1.7.12.4 (Apple Git-37)
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported

Quoted 8 lines · David Ahern

If the OS does not have timerfd support (e.g., older OS'es like RHEL5) disable perf kvm stat live.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>

looks ok,

jirka

#3 lore raw

Re: [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported

In reply to David Ahern

ditto

Quoted 196 lines · David Ahern

If the OS does not have timerfd support (e.g., older OS'es like RHEL5) disable perf kvm stat live.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
---
  tools/perf/builtin-kvm.c                        | 12 ++++++++++++
  tools/perf/config/Makefile                      |  7 +++++++
  tools/perf/config/feature-checks/Makefile       |  6 +++++-
  tools/perf/config/feature-checks/test-all.c     |  5 +++++
  tools/perf/config/feature-checks/test-timerfd.c | 18 ++++++++++++++++++
  5 files changed, 47 insertions(+), 1 deletion(-)

create mode 100644 tools/perf/config/feature-checks/test-timerfd.c

tools/perf/builtin-kvm.c +12 -0
index cb05f39d8a77..cd9f92078aba 100644
@@ -20,7 +20,9 @@
  #include "util/data.h"
 
  #include <sys/prctl.h>
+#ifdef HAVE_TIMERFD_SUPPORT
  #include <sys/timerfd.h>
+#endif
 
  #include <termios.h>
  #include <semaphore.h>
@@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
  		INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
  }
 
+#ifdef HAVE_TIMERFD_SUPPORT
  static void clear_events_cache_stats(struct list_head *kvm_events_cache)
  {
  	struct list_head *head;
@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache)
  		}
  	}
  }
+#endif
 
  static int kvm_events_hash_fn(u64 key)
  {
@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)
  		pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
  }
 
+#ifdef HAVE_TIMERFD_SUPPORT
  static int process_lost_event(struct perf_tool *tool,
  			      union perf_event *event __maybe_unused,
  			      struct perf_sample *sample __maybe_unused,
@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool,
  	kvm->lost_events++;
  	return 0;
  }
+#endif
 
  static bool skip_sample(struct perf_kvm_stat *kvm,
  			struct perf_sample *sample)
@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)
  	return true;
  }
 
+#ifdef HAVE_TIMERFD_SUPPORT
  /* keeping the max events to a modest level to keep
   * the processing of samples per mmap smooth.
   */
@@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
  out:
  	return rc;
  }
+#endif
 
  static int read_events(struct perf_kvm_stat *kvm)
  {
@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
  	return kvm_events_report_vcpu(kvm);
  }
 
+#ifdef HAVE_TIMERFD_SUPPORT
  static struct perf_evlist *kvm_live_event_list(void)
  {
  	struct perf_evlist *evlist;
@@ -1566,6 +1575,7 @@ out:
 
  	return err;
  }
+#endif
 
  static void print_kvm_stat_usage(void)
  {
@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
  	if (!strncmp(argv[1], "rep", 3))
  		return kvm_events_report(&kvm, argc - 1 , argv + 1);
 
+#ifdef HAVE_TIMERFD_SUPPORT
  	if (!strncmp(argv[1], "live", 4))
  		return kvm_events_live(&kvm, argc - 1 , argv + 1);
+#endif
 
  perf_stat:
  	return cmd_stat(argc, argv, NULL);
tools/perf/config/Makefile +7 -0
index c82772207e6e..afe4945e3e84 100644
@@ -395,6 +395,13 @@ else
    endif
  endif
 
+$(call feature_check,timerfd)
+ifeq ($(feature-timerfd), 1)
+  CFLAGS += -DHAVE_TIMERFD_SUPPORT
+else
+  msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+endif
+
  disable-python = $(eval $(disable-python_code))
  define disable-python_code
    CFLAGS += -DNO_LIBPYTHON
tools/perf/config/feature-checks/Makefile +5 -1
index 452b67cc4d7b..a4d4173c576e 100644
@@ -25,7 +25,8 @@ FILES=					\
  	test-libunwind			\
  	test-on-exit			\
  	test-stackprotector-all		\
-	test-stackprotector
+	test-stackprotector		\
+	test-timerfd
 
  CC := $(CC) -MD
 
@@ -136,6 +137,9 @@ test-on-exit:
  test-backtrace:
  	$(BUILD)
 
+test-timerfd:
+	$(BUILD)
+
  -include *.d
 
  ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
index 50d431892a0c..59e7a705e146 100644
@@ -81,6 +81,10 @@
  # include "test-libnuma.c"
  #undef main
 
+#define main main_test_timerfd
+# include "test-timerfd.c"
+#undef main
+
  int main(int argc, char *argv[])
  {
  	main_test_libpython();
@@ -101,6 +105,7 @@ int main(int argc, char *argv[])
  	main_test_on_exit();
  	main_test_backtrace();
  	main_test_libnuma();
+	main_test_timerfd();
 
  	return 0;
  }
tools/perf/config/feature-checks/test-timerfd.c new file +18 -0
new file mode 100644
index 000000000000..8c5c083b4d3c
@@ -0,0 +1,18 @@
+/*
+ * test for timerfd functions used by perf-kvm-stat-live
+ */
+#include <sys/timerfd.h>
+
+int main(void)
+{
+	struct itimerspec new_value;
+
+	int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
+	if (fd < 0)
+		return 1;
+
+	if (timerfd_settime(fd, 0, &new_value, NULL) != 0)
+		return 1;
+
+	return 0;
+}
#4 lore raw

[tip:perf/core] perf kvm: Disable live command if timerfd is not supported

In reply to David Ahern
perf kvm: Disable live command if timerfd is not supported
Commit-ID:  87419c9afff1431d4b62b388baf6bfa07e0b14ff
Gitweb:     http://git.kernel.org/tip/87419c9afff1431d4b62b388baf6bfa07e0b14ff
Author:     David Ahern <[email protected]>
AuthorDate: Tue, 29 Oct 2013 10:43:16 -0600
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 5 Nov 2013 10:03:22 -0300

perf kvm: Disable live command if timerfd is not supported

If the OS does not have timerfd support (e.g., older OS'es like RHEL5) disable perf kvm stat live.

---
 tools/perf/builtin-kvm.c                        | 12 ++++++++++++
 tools/perf/config/Makefile                      |  7 +++++++
 tools/perf/config/feature-checks/Makefile       |  6 +++++-
 tools/perf/config/feature-checks/test-all.c     |  5 +++++
 tools/perf/config/feature-checks/test-timerfd.c | 18 ++++++++++++++++++
 5 files changed, 47 insertions(+), 1 deletion(-)
tools/perf/builtin-kvm.c +12 -0
index cb05f39..cd9f920 100644
@@ -20,7 +20,9 @@
 #include "util/data.h"
 
 #include <sys/prctl.h>
+#ifdef HAVE_TIMERFD_SUPPORT
 #include <sys/timerfd.h>
+#endif
 
 #include <termios.h>
 #include <semaphore.h>
@@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
 		INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 static void clear_events_cache_stats(struct list_head *kvm_events_cache)
 {
 	struct list_head *head;
@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache)
 		}
 	}
 }
+#endif
 
 static int kvm_events_hash_fn(u64 key)
 {
@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)
 		pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 static int process_lost_event(struct perf_tool *tool,
 			      union perf_event *event __maybe_unused,
 			      struct perf_sample *sample __maybe_unused,
@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool,
 	kvm->lost_events++;
 	return 0;
 }
+#endif
 
 static bool skip_sample(struct perf_kvm_stat *kvm,
 			struct perf_sample *sample)
@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)
 	return true;
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 /* keeping the max events to a modest level to keep
  * the processing of samples per mmap smooth.
  */
@@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
 out:
 	return rc;
 }
+#endif
 
 static int read_events(struct perf_kvm_stat *kvm)
 {
@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
 	return kvm_events_report_vcpu(kvm);
 }
 
+#ifdef HAVE_TIMERFD_SUPPORT
 static struct perf_evlist *kvm_live_event_list(void)
 {
 	struct perf_evlist *evlist;
@@ -1566,6 +1575,7 @@ out:
 
 	return err;
 }
+#endif
 
 static void print_kvm_stat_usage(void)
 {
@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
 	if (!strncmp(argv[1], "rep", 3))
 		return kvm_events_report(&kvm, argc - 1 , argv + 1);
 
+#ifdef HAVE_TIMERFD_SUPPORT
 	if (!strncmp(argv[1], "live", 4))
 		return kvm_events_live(&kvm, argc - 1 , argv + 1);
+#endif
 
 perf_stat:
 	return cmd_stat(argc, argv, NULL);
tools/perf/config/Makefile +7 -0
index ffb5f55..be8bb9a 100644
@@ -397,6 +397,13 @@ else
   endif
 endif
 
+$(call feature_check,timerfd)
+ifeq ($(feature-timerfd), 1)
+  CFLAGS += -DHAVE_TIMERFD_SUPPORT
+else
+  msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+endif
+
 disable-python = $(eval $(disable-python_code))
 define disable-python_code
   CFLAGS += -DNO_LIBPYTHON
tools/perf/config/feature-checks/Makefile +5 -1
index d37d58d..c803f17 100644
@@ -25,7 +25,8 @@ FILES=					\
 	test-libunwind			\
 	test-on-exit			\
 	test-stackprotector-all		\
-	test-stackprotector
+	test-stackprotector		\
+	test-timerfd
 
 CC := $(CC) -MD
 
@@ -136,6 +137,9 @@ test-on-exit:
 test-backtrace:
 	$(BUILD)
 
+test-timerfd:
+	$(BUILD)
+
 -include *.d
 
 ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
index 50d4318..59e7a70 100644
@@ -81,6 +81,10 @@
 # include "test-libnuma.c"
 #undef main
 
+#define main main_test_timerfd
+# include "test-timerfd.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -101,6 +105,7 @@ int main(int argc, char *argv[])
 	main_test_on_exit();
 	main_test_backtrace();
 	main_test_libnuma();
+	main_test_timerfd();
 
 	return 0;
 }
tools/perf/config/feature-checks/test-timerfd.c new file +18 -0
new file mode 100644
index 0000000..8c5c083
@@ -0,0 +1,18 @@
+/*
+ * test for timerfd functions used by perf-kvm-stat-live
+ */
+#include <sys/timerfd.h>
+
+int main(void)
+{
+	struct itimerspec new_value;
+
+	int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
+	if (fd < 0)
+		return 1;
+
+	if (timerfd_settime(fd, 0, &new_value, NULL) != 0)
+		return 1;
+
+	return 0;
+}
#5 lore raw
In reply to David Ahern
Quoted 2 lines · David Ahern

feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.

and the problem is also when there's more than one option in LDFLAGS

Quoted 9 lines

Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
Reviewed-and-tested-by Jiri Olsa <[email protected]>

jirka

Acked-by
#6 lore raw
Quoted 5 lines · Jiri Olsa
Quoted 2 lines · David Ahern

feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.

and the problem is also when there's more than one option in LDFLAGS

yeah.

Quoted 10 lines
Quoted 8 lines

Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
Reviewed-and-tested-by Jiri Olsa <[email protected]>

Thanks,

Ingo

#7 lore raw
In reply to David Ahern

ping. did not see this one in your last push to Ingo.

Quoted 57 lines · David Ahern

feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.

Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
---
  tools/perf/config/Makefile | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/config/Makefile +5 -5
index 543aa953bab1..c82772207e6e 100644
@@ -96,7 +96,7 @@ endif
 
  feature_check = $(eval $(feature_check_code))
  define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS="$(LDFLAGS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
  endef
 
  feature_set = $(eval $(feature_set_code))
@@ -233,7 +233,7 @@ CFLAGS += -I$(LIB_INCLUDE)
  CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
  ifndef NO_BIONIC
-  $(feature_check,bionic)
+  $(call feature_check,bionic)
    ifeq ($(feature-bionic), 1)
      BIONIC := 1
      EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
@@ -470,15 +470,15 @@ else
      CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
    else
      ifneq ($(feature-libbfd), 1)
-      $(feature_check,liberty)
+      $(call feature_check,liberty)
        ifeq ($(feature-liberty), 1)
          EXTLIBS += -lbfd -liberty
        else
-        $(feature_check,liberty-z)
+        $(call feature_check,liberty-z)
          ifeq ($(feature-liberty-z), 1)
            EXTLIBS += -lbfd -liberty -lz
          else
-          $(feature_check,cplus-demangle)
+          $(call feature_check,cplus-demangle)
            ifeq ($(feature-cplus-demangle), 1)
              EXTLIBS += -liberty
              CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
#8 lore raw
In reply to David Ahern
tools/perf/build: Fix detection of non-core features
Commit-ID:  5febff0066b8111785d58903b54d414e9ec6a3d0
Gitweb:     http://git.kernel.org/tip/5febff0066b8111785d58903b54d414e9ec6a3d0
Author:     David Ahern <[email protected]>
AuthorDate: Tue, 29 Oct 2013 10:43:15 -0600
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 5 Nov 2013 10:08:03 -0300

tools/perf/build: Fix detection of non-core features

feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.

Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
[ Fixed conflict with 8a0c4c2843d3 ("perf tools: Fix libunwind build and feature detection for 32-bit build") ]
---
 tools/perf/config/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/config/Makefile +5 -5
index be8bb9a..58b2d37 100644
@@ -98,7 +98,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -235,7 +235,7 @@ CFLAGS += -I$(LIB_INCLUDE)
 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 ifndef NO_BIONIC
-  $(feature_check,bionic)
+  $(call feature_check,bionic)
   ifeq ($(feature-bionic), 1)
     BIONIC := 1
     EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
@@ -479,15 +479,15 @@ else
     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
   else
     ifneq ($(feature-libbfd), 1)
-      $(feature_check,liberty)
+      $(call feature_check,liberty)
       ifeq ($(feature-liberty), 1)
         EXTLIBS += -lbfd -liberty
       else
-        $(feature_check,liberty-z)
+        $(call feature_check,liberty-z)
         ifeq ($(feature-liberty-z), 1)
           EXTLIBS += -lbfd -liberty -lz
         else
-          $(feature_check,cplus-demangle)
+          $(call feature_check,cplus-demangle)
           ifeq ($(feature-cplus-demangle), 1)
             EXTLIBS += -liberty
             CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT