Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa6292f4 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Arnaldo Carvalho de Melo
Browse files

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: default avatarMathieu 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5b50758c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
+6 −1
Original line number Diff line number Diff line
@@ -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
+5 −0
Original line number Diff line number Diff line
@@ -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;
}
+8 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <opencsd/c_api/opencsd_c_api.h>

int main(void)
{
	(void)ocsd_get_version();
	return 0;
}
+25 −0
Original line number Diff line number Diff line
@@ -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
Loading