Skip to content

Commit aa6292f

Browse files
mathieupoirieracmel
authored andcommitted
perf tools: Integrating the CoreSight decoding library
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> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kim Phillips <kim.phillips@arm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: Mike Leach <mike.leach@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Link: http://lkml.kernel.org/r/1516211539-5166-2-git-send-email-mathieu.poirier@linaro.org Link: http://lkml.kernel.org/r/1516635644-24819-1-git-send-email-mathieu.poirier@linaro.org [ Merged missing test-libopencsd.c file, provided later by Mathieu ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 5b50758 commit aa6292f

6 files changed

Lines changed: 48 additions & 2 deletions

File tree

‎tools/build/Makefile.feature‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ FEATURE_TESTS_BASIC := \
6666
bpf \
6767
sched_getcpu \
6868
sdt \
69-
setns
69+
setns \
70+
libopencsd
7071

7172
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
7273
# of all feature tests

‎tools/build/feature/Makefile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ FILES= \
5252
test-cxx.bin \
5353
test-jvmti.bin \
5454
test-sched_getcpu.bin \
55-
test-setns.bin
55+
test-setns.bin \
56+
test-libopencsd.bin
5657

5758
FILES := $(addprefix $(OUTPUT),$(FILES))
5859

@@ -104,6 +105,10 @@ $(OUTPUT)test-sched_getcpu.bin:
104105
$(OUTPUT)test-setns.bin:
105106
$(BUILD)
106107

108+
$(OUTPUT)test-libopencsd.bin:
109+
$(BUILD) # -lopencsd_c_api -lopencsd provided by
110+
# $(FEATURE_CHECK_LDFLAGS-libopencsd)
111+
107112
DWARFLIBS := -ldw
108113
ifeq ($(findstring -static,${LDFLAGS}),-static)
109114
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2

‎tools/build/feature/test-all.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
# include "test-setns.c"
163163
#undef main
164164

165+
#define main main_test_libopencsd
166+
# include "test-libopencsd.c"
167+
#undef main
168+
165169
int main(int argc, char *argv[])
166170
{
167171
main_test_libpython();
@@ -199,6 +203,7 @@ int main(int argc, char *argv[])
199203
main_test_sched_getcpu();
200204
main_test_sdt();
201205
main_test_setns();
206+
main_test_libopencsd();
202207

203208
return 0;
204209
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include <opencsd/c_api/opencsd_c_api.h>
3+
4+
int main(void)
5+
{
6+
(void)ocsd_get_version();
7+
return 0;
8+
}

‎tools/perf/Makefile.config‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
105105
FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
106106
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
107107

108+
ifdef CSINCLUDES
109+
LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
110+
endif
111+
OPENCSDLIBS := -lopencsd_c_api -lopencsd
112+
ifdef CSLIBS
113+
LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
114+
endif
115+
FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
116+
FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
117+
108118
ifeq ($(NO_PERF_REGS),0)
109119
CFLAGS += -DHAVE_PERF_REGS_SUPPORT
110120
endif
@@ -353,6 +363,21 @@ ifeq ($(feature-setns), 1)
353363
$(call detected,CONFIG_SETNS)
354364
endif
355365

366+
ifndef NO_CORESIGHT
367+
ifeq ($(feature-libopencsd), 1)
368+
CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
369+
LDFLAGS += $(LIBOPENCSD_LDFLAGS)
370+
EXTLIBS += $(OPENCSDLIBS)
371+
$(call detected,CONFIG_LIBOPENCSD)
372+
ifdef CSTRACE_RAW
373+
CFLAGS += -DCS_DEBUG_RAW
374+
ifeq (${CSTRACE_RAW}, packed)
375+
CFLAGS += -DCS_RAW_PACKED
376+
endif
377+
endif
378+
endif
379+
endif
380+
356381
ifndef NO_LIBELF
357382
CFLAGS += -DHAVE_LIBELF_SUPPORT
358383
EXTLIBS += -lelf

‎tools/perf/Makefile.perf‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ include ../scripts/utilities.mak
9898
# When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if
9999
# llvm-config is not in $PATH.
100100

101+
# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding.
102+
101103
# As per kernel Makefile, avoid funny character set dependencies
102104
unexport LC_ALL
103105
LC_COLLATE=C

0 commit comments

Comments
 (0)