* [PATCH 1/2] tools/perf/build: Fix detection of non-core features
@ 2013-10-29 16:43 David Ahern
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: David Ahern @ 2013-10-29 16:43 UTC (permalink / raw)
To: acme, linux-kernel
Cc: David Ahern, Ingo Molnar, Peter Zijlstra, Namhyung Kim, Jiri Olsa
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.
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/config/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 543aa953bab1..c82772207e6e 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -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
--
1.7.12.4 (Apple Git-37)
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported
2013-10-29 16:43 [PATCH 1/2] tools/perf/build: Fix detection of non-core features David Ahern
@ 2013-10-29 16:43 ` David Ahern
2013-10-29 17:29 ` Jiri Olsa
` (2 more replies)
2013-10-29 17:29 ` [PATCH 1/2] tools/perf/build: Fix detection of non-core features Jiri Olsa
` (2 subsequent siblings)
3 siblings, 3 replies; 9+ messages in thread
From: David Ahern @ 2013-10-29 16:43 UTC (permalink / raw)
To: acme, linux-kernel
Cc: David Ahern, Ingo Molnar, Peter Zijlstra, Namhyung Kim, Jiri Olsa
If the OS does not have timerfd support (e.g., older OS'es like RHEL5)
disable perf kvm stat live.
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
---
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
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index cb05f39d8a77..cd9f92078aba 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -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);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c82772207e6e..afe4945e3e84 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -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
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index 452b67cc4d7b..a4d4173c576e 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -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
###############################
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 50d431892a0c..59e7a705e146 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -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;
}
diff --git a/tools/perf/config/feature-checks/test-timerfd.c b/tools/perf/config/feature-checks/test-timerfd.c
new file mode 100644
index 000000000000..8c5c083b4d3c
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-timerfd.c
@@ -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;
+}
--
1.7.12.4 (Apple Git-37)
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] tools/perf/build: Fix detection of non-core features
2013-10-29 16:43 [PATCH 1/2] tools/perf/build: Fix detection of non-core features David Ahern
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
@ 2013-10-29 17:29 ` Jiri Olsa
2013-10-31 8:50 ` Ingo Molnar
2013-11-05 4:59 ` David Ahern
2013-11-06 5:43 ` [tip:perf/core] " tip-bot for David Ahern
3 siblings, 1 reply; 9+ messages in thread
From: Jiri Olsa @ 2013-10-29 17:29 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel, Ingo Molnar, Peter Zijlstra, Namhyung Kim
On Tue, Oct 29, 2013 at 10:43:15AM -0600, David Ahern wrote:
> 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
>
> Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving
> me nuts with the upcoming timerfd feature detection.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
Reviewed-and-tested-by: Jiri Olsa <jolsa@redhat.com>
jirka
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
@ 2013-10-29 17:29 ` Jiri Olsa
2013-11-05 5:00 ` David Ahern
2013-11-06 5:43 ` [tip:perf/core] " tip-bot for David Ahern
2 siblings, 0 replies; 9+ messages in thread
From: Jiri Olsa @ 2013-10-29 17:29 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel, Ingo Molnar, Peter Zijlstra, Namhyung Kim
On Tue, Oct 29, 2013 at 10:43:16AM -0600, David Ahern wrote:
> If the OS does not have timerfd support (e.g., older OS'es like RHEL5)
> disable perf kvm stat live.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
looks ok,
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
jirka
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] tools/perf/build: Fix detection of non-core features
2013-10-29 17:29 ` [PATCH 1/2] tools/perf/build: Fix detection of non-core features Jiri Olsa
@ 2013-10-31 8:50 ` Ingo Molnar
0 siblings, 0 replies; 9+ messages in thread
From: Ingo Molnar @ 2013-10-31 8:50 UTC (permalink / raw)
To: Jiri Olsa; +Cc: David Ahern, acme, linux-kernel, Peter Zijlstra, Namhyung Kim
* Jiri Olsa <jolsa@redhat.com> wrote:
> On Tue, Oct 29, 2013 at 10:43:15AM -0600, David Ahern wrote:
> > 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.
> > Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving
> > me nuts with the upcoming timerfd feature detection.
> >
> > Signed-off-by: David Ahern <dsahern@gmail.com>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Jiri Olsa <jolsa@redhat.com>
>
> Reviewed-and-tested-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Thanks,
Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] tools/perf/build: Fix detection of non-core features
2013-10-29 16:43 [PATCH 1/2] tools/perf/build: Fix detection of non-core features David Ahern
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
2013-10-29 17:29 ` [PATCH 1/2] tools/perf/build: Fix detection of non-core features Jiri Olsa
@ 2013-11-05 4:59 ` David Ahern
2013-11-06 5:43 ` [tip:perf/core] " tip-bot for David Ahern
3 siblings, 0 replies; 9+ messages in thread
From: David Ahern @ 2013-11-05 4:59 UTC (permalink / raw)
To: acme, linux-kernel
Cc: David Ahern, Ingo Molnar, Peter Zijlstra, Namhyung Kim, Jiri Olsa
ping. did not see this one in your last push to Ingo.
On 10/29/13, 10:43 AM, David Ahern wrote:
> 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.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
> tools/perf/config/Makefile | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> index 543aa953bab1..c82772207e6e 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
2013-10-29 17:29 ` Jiri Olsa
@ 2013-11-05 5:00 ` David Ahern
2013-11-06 5:43 ` [tip:perf/core] " tip-bot for David Ahern
2 siblings, 0 replies; 9+ messages in thread
From: David Ahern @ 2013-11-05 5:00 UTC (permalink / raw)
To: acme, linux-kernel
Cc: David Ahern, Ingo Molnar, Peter Zijlstra, Namhyung Kim, Jiri Olsa
ditto
On 10/29/13, 10:43 AM, David Ahern wrote:
> If the OS does not have timerfd support (e.g., older OS'es like RHEL5)
> disable perf kvm stat live.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
> 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
>
> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
> index cb05f39d8a77..cd9f92078aba 100644
> --- a/tools/perf/builtin-kvm.c
> +++ b/tools/perf/builtin-kvm.c
> @@ -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);
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> index c82772207e6e..afe4945e3e84 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -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
> diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
> index 452b67cc4d7b..a4d4173c576e 100644
> --- a/tools/perf/config/feature-checks/Makefile
> +++ b/tools/perf/config/feature-checks/Makefile
> @@ -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
>
> ###############################
> diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
> index 50d431892a0c..59e7a705e146 100644
> --- a/tools/perf/config/feature-checks/test-all.c
> +++ b/tools/perf/config/feature-checks/test-all.c
> @@ -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;
> }
> diff --git a/tools/perf/config/feature-checks/test-timerfd.c b/tools/perf/config/feature-checks/test-timerfd.c
> new file mode 100644
> index 000000000000..8c5c083b4d3c
> --- /dev/null
> +++ b/tools/perf/config/feature-checks/test-timerfd.c
> @@ -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;
> +}
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip:perf/core] perf kvm: Disable live command if timerfd is not supported
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
2013-10-29 17:29 ` Jiri Olsa
2013-11-05 5:00 ` David Ahern
@ 2013-11-06 5:43 ` tip-bot for David Ahern
2 siblings, 0 replies; 9+ messages in thread
From: tip-bot for David Ahern @ 2013-11-06 5:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, a.p.zijlstra, namhyung, jolsa,
dsahern, tglx
Commit-ID: 87419c9afff1431d4b62b388baf6bfa07e0b14ff
Gitweb: http://git.kernel.org/tip/87419c9afff1431d4b62b388baf6bfa07e0b14ff
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 29 Oct 2013 10:43:16 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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.
Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1383064996-20933-2-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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(-)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index cb05f39..cd9f920 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -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);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index ffb5f55..be8bb9a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -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
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index d37d58d..c803f17 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -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
###############################
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 50d4318..59e7a70 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -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;
}
diff --git a/tools/perf/config/feature-checks/test-timerfd.c b/tools/perf/config/feature-checks/test-timerfd.c
new file mode 100644
index 0000000..8c5c083
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-timerfd.c
@@ -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;
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] tools/perf/build: Fix detection of non-core features
2013-10-29 16:43 [PATCH 1/2] tools/perf/build: Fix detection of non-core features David Ahern
` (2 preceding siblings ...)
2013-11-05 4:59 ` David Ahern
@ 2013-11-06 5:43 ` tip-bot for David Ahern
3 siblings, 0 replies; 9+ messages in thread
From: tip-bot for David Ahern @ 2013-11-06 5:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, a.p.zijlstra, namhyung, jolsa,
dsahern, tglx
Commit-ID: 5febff0066b8111785d58903b54d414e9ec6a3d0
Gitweb: http://git.kernel.org/tip/5febff0066b8111785d58903b54d414e9ec6a3d0
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 29 Oct 2013 10:43:15 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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.
Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1383064996-20933-1-git-send-email-dsahern@gmail.com
[ Fixed conflict with 8a0c4c2843d3 ("perf tools: Fix libunwind build and feature detection for 32-bit build") ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/config/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index be8bb9a..58b2d37 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -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
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-11-06 5:43 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29 16:43 [PATCH 1/2] tools/perf/build: Fix detection of non-core features David Ahern
2013-10-29 16:43 ` [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported David Ahern
2013-10-29 17:29 ` Jiri Olsa
2013-11-05 5:00 ` David Ahern
2013-11-06 5:43 ` [tip:perf/core] " tip-bot for David Ahern
2013-10-29 17:29 ` [PATCH 1/2] tools/perf/build: Fix detection of non-core features Jiri Olsa
2013-10-31 8:50 ` Ingo Molnar
2013-11-05 4:59 ` David Ahern
2013-11-06 5:43 ` [tip:perf/core] " tip-bot for David Ahern
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.