public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Borislav Petkov <bp@suse.de>
Subject: [PATCH 2/2] perf: Make -lnuma optional
Date: Tue, 29 Jan 2013 11:48:12 +0100	[thread overview]
Message-ID: <1359456492-22156-2-git-send-email-bp@alien8.de> (raw)

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


             reply	other threads:[~2013-01-29 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 10:48 Borislav Petkov [this message]
2013-01-29 10:49 ` [PATCH 2/2] perf: Make -lnuma optional Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359456492-22156-2-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=acme@redhat.com \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox