* [PATCH 2/2] perf: Make -lnuma optional
@ 2013-01-29 10:48 Borislav Petkov
2013-01-29 10:49 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov @ 2013-01-29 10:48 UTC (permalink / raw)
To: Ingo Molnar, Arnaldo Carvalho de Melo; +Cc: LKML, Borislav Petkov
From: Borislav Petkov <bp@suse.de>
a0c17eadf3bf9 ("perf: Add 'perf bench numa mem' NUMA performance
measurement suite") added -lnuma to the EXTLIBS but we use those when
checking for other libraries like libelf, libunwind, etc and the checks
failed even when the dev libraries are installed on the system:
CHK libelf
/usr/bin/ld: cannot find -lnuma
collect2: error: ld returned 1 exit status
CHK glibc
Makefile:552: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
CHK libunwind
/usr/bin/ld: cannot find -lnuma
collect2: error: ld returned 1 exit status
Makefile:586: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99
...
So, add glue to detect the presence of -lnuma and build perf bench numa
only then.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
tools/perf/Makefile | 7 +++++++
tools/perf/builtin-bench.c | 4 ++++
tools/perf/config/feature-tests.mak | 9 +++++++++
3 files changed, 20 insertions(+)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b62dbc0d974a..2f6558404620 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -533,6 +533,13 @@ ifneq ($(MAKECMDGOALS),tags)
# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If
# we had "elif" things would have been much nicer...
+#
+FLAGS_NUMA=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifneq ($(call try-cc,$(SOURCE_NUMA),$(FLAGS_NUMA),libnuma),y)
+ BASIC_CFLAGS += -DNO_NUMA
+ EXTLIBS := $(filter-out -lnuma,$(EXTLIBS))
+ BUILTIN_OBJS := $(filter-out $(OUTPUT)bench/numa.o,$(BUILTIN_OBJS))
+endif # NUMA
ifdef NO_LIBELF
NO_DWARF := 1
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index e5d514bf5365..b4ec5af42ada 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -35,6 +35,7 @@ struct bench_suite {
/* sentinel: easy for help */
#define suite_all { "all", "Test all benchmark suites", NULL }
+#ifndef NO_NUMA
static struct bench_suite numa_suites[] = {
{ "mem",
"Benchmark for NUMA workloads",
@@ -44,6 +45,7 @@ static struct bench_suite numa_suites[] = {
NULL,
NULL }
};
+#endif
static struct bench_suite sched_suites[] = {
{ "messaging",
@@ -78,9 +80,11 @@ struct bench_subsys {
};
static struct bench_subsys subsystems[] = {
+#ifndef NO_NUMA
{ "numa",
"NUMA scheduling and MM behavior",
numa_suites },
+#endif
{ "sched",
"scheduler and IPC mechanism",
sched_suites },
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index f5ac77485a4f..a47684b4fe1e 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -225,3 +225,12 @@ int main(void)
return on_exit(NULL, NULL);
}
endef
+
+define SOURCE_NUMA
+#include <numa.h>
+
+int main(void)
+{
+ return numa_available();
+}
+endef
--
1.8.1.rc3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] perf: Make -lnuma optional
2013-01-29 10:48 [PATCH 2/2] perf: Make -lnuma optional Borislav Petkov
@ 2013-01-29 10:49 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2013-01-29 10:49 UTC (permalink / raw)
To: Ingo Molnar, Arnaldo Carvalho de Melo; +Cc: LKML, Borislav Petkov
On Tue, Jan 29, 2013 at 11:48:12AM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> a0c17eadf3bf9 ("perf: Add 'perf bench numa mem' NUMA performance
> measurement suite") added -lnuma to the EXTLIBS but we use those when
> checking for other libraries like libelf, libunwind, etc and the checks
> failed even when the dev libraries are installed on the system:
>
> CHK libelf
> /usr/bin/ld: cannot find -lnuma
> collect2: error: ld returned 1 exit status
> CHK glibc
> Makefile:552: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
> CHK libunwind
> /usr/bin/ld: cannot find -lnuma
> collect2: error: ld returned 1 exit status
> Makefile:586: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99
> ...
>
> So, add glue to detect the presence of -lnuma and build perf bench numa
> only then.
While at it, I noticed another annoyance: if FLEX and BISON are needed
unconditionally for the build, this needs to be checked at the beginning
of the makefile and make shouldn't fail in-between. Oh well, I'll let
someone beat me to it with a fix since I'm lazy :).
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-29 10:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29 10:48 [PATCH 2/2] perf: Make -lnuma optional Borislav Petkov
2013-01-29 10:49 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox