From patchwork Mon Jan 15 18:13:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 124556 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp752574lje; Mon, 15 Jan 2018 10:16:31 -0800 (PST) X-Google-Smtp-Source: ACJfBouM6SpkOpY5zIubJKL9BrbOHIaLAOwZTgYbgwKlR3VAEeL1CQwJ3j3DBbNbHPuTc55FzjWA X-Received: by 10.159.230.14 with SMTP id u14mr15434255plq.35.1516040191555; Mon, 15 Jan 2018 10:16:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516040191; cv=none; d=google.com; s=arc-20160816; b=cg5Xxjq4SfO2zv4Bv7gfSgVQwRg8XCdNyMbt9yzg9z4Ddl9wVWeFq0Wp28U7kanhf3 RufZIsw/suRDKGZSYWFDVz3sa57M+aS725pkYK8kiJeou23tyKxhZARz1e4xwZ8ECNWF 99qM3/2NMbLZCpz/6KcG9oaP96/TF4XO/+yFLqHDAlVDEn9908w0+Arg1i8wQ/iifBCX gUYsOaD/kUADXRXxlCIUL/Zi4/xTOPTjO2/znUco7CSwesnBsFV9XR3jBITv5kCTEP24 I54ebBRBrNSsstDPktx/BnyCZOaPEeGMddzVG26YkE7bBCak7j9ajbmTBmfvplnVLATK F2Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=gbkybZ9dJPG5EiwO9Tl9VAvdLd6G3zuKa9jh8789U3Q=; b=YePi8Y0+IY+cxBy5ZKSw9aek3pMAwtPUeEF3NK685HYs2GNZIGrZwpp7hqYWhCOAyT wfuHF8MkvBogRwMmGIBDZsDlAqrmTME+IsSPy0KoW1Bby5FD/vobZ+i8eLzElpbsd0f8 gSWoEEg0DcDdz5RYEq4agtl/rCq0o4cGBB6AuXNciqvsWDn3X+n3Faf+8ByJ7rF2NjV/ EMEEwbZfFWju9G0x1IckAA8mG2BFPEt4qTfKmWwy6bi55lF0oKDVjo/Df++2QY83we+o OpXQWF/y3XgrJO8WLKb8lGoCvFHiJOQVQZGVygFRjnrTCOqIbkJapub6hojtTvpIRxtV VGug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CQqr8R+D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si182038plr.14.2018.01.15.10.16.31; Mon, 15 Jan 2018 10:16:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CQqr8R+D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751426AbeAOSQa (ORCPT + 28 others); Mon, 15 Jan 2018 13:16:30 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:37484 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbeAOSNU (ORCPT ); Mon, 15 Jan 2018 13:13:20 -0500 Received: by mail-it0-f67.google.com with SMTP id q8so1847053itb.2 for ; Mon, 15 Jan 2018 10:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gbkybZ9dJPG5EiwO9Tl9VAvdLd6G3zuKa9jh8789U3Q=; b=CQqr8R+DROnqEKrcuWP/eiXBszYebAn8Tyh9tYusgd0Nz0g1KzsUAetQi8ZaPaURt7 YnQXksad1JxPlsgiqH6ING2Wo4ml+4OeSK7MteXKntW90eE5s3b2yq8bMz5jl0XlVoB7 ONuL6RJkZVA7nXZTgzAFCRVH9Dj+75JH+I2pE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gbkybZ9dJPG5EiwO9Tl9VAvdLd6G3zuKa9jh8789U3Q=; b=lfxgYCRF9MTVVxLkELrlZlqmg18zy0xXDilKM9YEYs/D18dJtqGBDF74CQQXfXj+v7 weynX2w5GYUdMZSraz8o1N85dfadd91Dt5cAUOyh+5SFcXC87fSryydkn9Ad9stzV4D1 HvmKvlYP/TQlK/PuD2Rj2yamYsltYnPDFdFRuB+TxH7JOWpkVy7P0IYYxpv+AR3eoHpR 7LtGVHIX/wmfCwfslen5lGC131zqPi/3egOd/KlIlzFwe4ZFVPNOAWQZrjuV6SRd4SI1 w7jFy1N5mhzVanOt04KNB71rxiy3wBVUWKubEmnAGgJZ86cQ9T/FnJKH0XUgNyEoy2Oq fYgA== X-Gm-Message-State: AKwxytfPemaduWtBYt6CqT/Rfm1gbJ+u53i0bU7bGaZYhEDmsaA6IPGs g3r61w7RkhtTM1y0iNwoM63tQA== X-Received: by 10.36.170.7 with SMTP id b7mr1199168itf.147.1516039999985; Mon, 15 Jan 2018 10:13:19 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id w142sm231480ita.25.2018.01.15.10.13.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Jan 2018 10:13:18 -0800 (PST) From: Mathieu Poirier 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 v2 01/10] perf tools: Integrating the CoreSight decoding library Date: Mon, 15 Jan 2018 11:13:05 -0700 Message-Id: <1516039994-314-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516039994-314-1-git-send-email-mathieu.poirier@linaro.org> References: <1516039994-314-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- tools/build/Makefile.feature | 6 ++++-- tools/build/feature/Makefile | 7 ++++++- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-libopencsd.c | 8 ++++++++ tools/perf/Makefile.config | 25 +++++++++++++++++++++++++ tools/perf/Makefile.perf | 2 ++ 6 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 tools/build/feature/test-libopencsd.c -- 2.7.4 diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index e52fcefee379..dc3d97b248ab 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 @@ -108,7 +109,8 @@ FEATURE_DISPLAY ?= \ zlib \ lzma \ get_cpuid \ - bpf + bpf \ + libopencsd # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. # If in the future we need per-feature checks/flags for features not diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index cff38f342283..2b108a6cfac3 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..38ab0fd7a74c 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_setns +# 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/build/feature/test-libopencsd.c b/tools/build/feature/test-libopencsd.c new file mode 100644 index 000000000000..cd4fb99eb9d3 --- /dev/null +++ b/tools/build/feature/test-libopencsd.c @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include + +int main(void) +{ + (void)ocsd_get_version(); + 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