linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: acme@kernel.org
Cc: peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, namhyung@kernel.org,
	adrian.hunter@intel.com, mike.leach@arm.com,
	suzuki.poulosi@arm.com, jolsa@redhat.com, kim.phillips@arm.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/10] perf tools: Integrating the CoreSight decoding library
Date: Wed, 17 Jan 2018 10:52:10 -0700	[thread overview]
Message-ID: <1516211539-5166-2-git-send-email-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <1516211539-5166-1-git-send-email-mathieu.poirier@linaro.org>

The Open CoreSight Decoding Library (openCSD) is a free and open
library to decode traces collected by the CoreSight hardware
infrastructure.

This patch adds the required mechanic to recognise the presence
of the openCSD library on a system and set up miscellaneous flags
to be used in the compilation of the trace decoding feature.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/build/Makefile.feature   |  3 ++-
 tools/build/feature/Makefile   |  7 ++++++-
 tools/build/feature/test-all.c |  5 +++++
 tools/perf/Makefile.config     | 25 +++++++++++++++++++++++++
 tools/perf/Makefile.perf       |  2 ++
 5 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index e52fcefee379..c378f003b007 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -66,7 +66,8 @@ FEATURE_TESTS_BASIC :=                  \
         bpf                             \
         sched_getcpu			\
         sdt				\
-        setns
+        setns				\
+        libopencsd
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index cff38f342283..59585fe20221 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -52,7 +52,8 @@ FILES=                                          \
          test-cxx.bin                           \
          test-jvmti.bin				\
          test-sched_getcpu.bin			\
-         test-setns.bin
+         test-setns.bin				\
+         test-libopencsd.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -104,6 +105,10 @@ $(OUTPUT)test-sched_getcpu.bin:
 $(OUTPUT)test-setns.bin:
 	$(BUILD)
 
+$(OUTPUT)test-libopencsd.bin:
+	$(BUILD) # -lopencsd_c_api -lopencsd provided by
+		 # $(FEATURE_CHECK_LDFLAGS-libopencsd)
+
 DWARFLIBS := -ldw
 ifeq ($(findstring -static,${LDFLAGS}),-static)
 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 6fdf83263ab7..8dc20a61341f 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -162,6 +162,10 @@
 # include "test-setns.c"
 #undef main
 
+#define main main_test_libopencsd
+# include "test-libopencsd.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -199,6 +203,7 @@ int main(int argc, char *argv[])
 	main_test_sched_getcpu();
 	main_test_sdt();
 	main_test_setns();
+	main_test_libopencsd();
 
 	return 0;
 }
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 12dec6ea5ed2..15ef1e55c7d0 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -105,6 +105,16 @@ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
 
+ifdef CSINCLUDES
+  LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
+endif
+OPENCSDLIBS := -lopencsd_c_api -lopencsd
+ifdef CSLIBS
+  LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
+endif
+FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
+
 ifeq ($(NO_PERF_REGS),0)
   CFLAGS += -DHAVE_PERF_REGS_SUPPORT
 endif
@@ -353,6 +363,21 @@ ifeq ($(feature-setns), 1)
   $(call detected,CONFIG_SETNS)
 endif
 
+ifndef NO_CORESIGHT
+  ifeq ($(feature-libopencsd), 1)
+    CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
+    LDFLAGS += $(LIBOPENCSD_LDFLAGS)
+    EXTLIBS += $(OPENCSDLIBS)
+    $(call detected,CONFIG_LIBOPENCSD)
+    ifdef CSTRACE_RAW
+      CFLAGS += -DCS_DEBUG_RAW
+      ifeq (${CSTRACE_RAW}, packed)
+        CFLAGS += -DCS_RAW_PACKED
+      endif
+    endif
+  endif
+endif
+
 ifndef NO_LIBELF
   CFLAGS += -DHAVE_LIBELF_SUPPORT
   EXTLIBS += -lelf
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9fdefd748e2e..92dfa9580eab 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -98,6 +98,8 @@ include ../scripts/utilities.mak
 # When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if
 # llvm-config is not in $PATH.
 
+# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding.
+
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL
 LC_COLLATE=C
-- 
2.7.4

  reply	other threads:[~2018-01-17 17:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 17:52 [PATCH v3 00/10] perf tools: Add support for CoreSight trace decoding Mathieu Poirier
2018-01-17 17:52 ` Mathieu Poirier [this message]
2018-01-22 15:40   ` [PATCH] perf tools: Adding missing test file for libopencsd Mathieu Poirier
2018-01-22 16:34     ` Arnaldo Carvalho de Melo
2018-01-24 11:32     ` [tip:perf/core] perf tools: Integrating the CoreSight decoding library tip-bot for Mathieu Poirier
2018-01-28 21:16     ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 02/10] perf tools: Add initial entry point for decoder CoreSight traces Mathieu Poirier
2018-01-24 11:32   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:16   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 03/10] perf tools: Add processing of coresight metadata Mathieu Poirier
2018-01-24 11:33   ` [tip:perf/core] " tip-bot for Tor Jeremiassen
2018-01-28 21:17   ` tip-bot for Tor Jeremiassen
2018-01-17 17:52 ` [PATCH v3 04/10] perf tools: Add decoder mechanic to support dumping trace data Mathieu Poirier
2018-01-24 11:33   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:17   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 05/10] perf tools: Add support for decoding CoreSight " Mathieu Poirier
2018-01-24 11:34   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:17   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 06/10] perf tools: Add functionality to communicate with the openCSD decoder Mathieu Poirier
2018-01-24 11:34   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:18   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 07/10] pert tools: Add queue management functionality Mathieu Poirier
2018-01-22 17:25   ` Robert Walker
2018-01-22 20:14     ` Mathieu Poirier
2018-01-24 11:34   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:18   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 08/10] perf tools: Add full support for CoreSight trace decoding Mathieu Poirier
2018-01-24 11:35   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:19   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 09/10] perf tools: Add mechanic to synthesise CoreSight trace packets Mathieu Poirier
2018-01-24 11:35   ` [tip:perf/core] " tip-bot for Mathieu Poirier
2018-01-28 21:19   ` tip-bot for Mathieu Poirier
2018-01-17 17:52 ` [PATCH v3 10/10] MAINTAINERS: Adding entry for CoreSight trace decoding Mathieu Poirier
2018-01-24 11:36   ` [tip:perf/core] " tip-bot for Tor Jeremiassen
2018-01-28 21:20   ` tip-bot for Tor Jeremiassen
2018-01-17 20:04 ` [PATCH v3 00/10] perf tools: Add support " Arnaldo Carvalho de Melo
2018-01-18 13:36   ` Arnaldo Carvalho de Melo
2018-01-19 15:01 ` Arnaldo Carvalho de Melo

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=1516211539-5166-2-git-send-email-mathieu.poirier@linaro.org \
    --to=mathieu.poirier@linaro.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=kim.phillips@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=suzuki.poulosi@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).