From patchwork Fri Dec 15 16:44:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 122130 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp708365qgn; Fri, 15 Dec 2017 08:47:23 -0800 (PST) X-Google-Smtp-Source: ACJfBou1k5j2wiW76BsU2w0247qx4xwqxB9mIAMP2BB1XXUQ2VljtoJA8/otFFnqYMysitg3KVyr X-Received: by 10.84.235.68 with SMTP id g4mr13936760plt.155.1513356443630; Fri, 15 Dec 2017 08:47:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513356443; cv=none; d=google.com; s=arc-20160816; b=SPbzqRGEiDPWqZUAao4S6MCBu9s2ww1X6YcOzOn7D1dR7aCoBT3IpNYWQsOXiAHOpS 5lY7Og0S7zlvGC3ZX9UiV87HDIy/ih2HpS+Jw+49mwFdEg6GOFOwMu3M3+jRqSGlxmbQ 2MDqa/MgV7nu9HKizGYcdKHTbbZXreTsZN57XiOe8bV8PHzAfUqgb0yL+5SSfU7+zCE7 6atGrCKrAbchHQm/o/ymp6ox/jcdjgr7GF9EQswAf/lovS3E/2Fka5PHhZiaBvUoFut3 +e2UwAKXRCCv9f1rPIIvi1H4Mxhd8LFYAUqdTKFn6ZrNZbOXbdiwbTQpofxZXM+cnYDT oDHQ== 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=byjRUUBzvWyWoP6gwtL9rkjKaybG1ECLzyqFZQQ9zNo=; b=ymhisTc7p6fIuf6SoKEDE7gGkTiZsXWOw3ZpruwZPNQuVNnkBtpLES00zSDo29JkJP 0uzb3S1zcaQZnW7b+wEfCnkYvEg7D4jX4omDff9bnTwcHxAMeIfrOBQADC9UCKkMMFXU 46CL+g6AJ02nW4UmItOZ5TMVo+/PtHbw0ZcUss83BB8C3L/dVirX6Qv7T/Tf/XzpnEjA ZqycMPnj8nipYr8uHBnd3SXrmruuGEcR3+4VBc9QCszjF8PGThWH08ckTaA9ut/PR9S6 iPPwzVPOy9o/t5NGOeYvAewCvMQKh4fZRPSbwLJkPhcJlCq0dSXVndQyX858mETbUiHE WNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZqJJmWK+; 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 34si5232768plz.598.2017.12.15.08.47.23; Fri, 15 Dec 2017 08:47:23 -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=ZqJJmWK+; 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 S932638AbdLOQrT (ORCPT + 24 others); Fri, 15 Dec 2017 11:47:19 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:35177 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756697AbdLOQpF (ORCPT ); Fri, 15 Dec 2017 11:45:05 -0500 Received: by mail-it0-f67.google.com with SMTP id f143so20370523itb.0 for ; Fri, 15 Dec 2017 08:45:05 -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=byjRUUBzvWyWoP6gwtL9rkjKaybG1ECLzyqFZQQ9zNo=; b=ZqJJmWK+TZ1jQIG2mLRfHzpgJEeIeNSB3z45voskGftAtBfnW+Y9imsUNPguuWbeSu InfykC41oVo1/N4SMV/E21jqY8bDp48ULcVzqu9o37uWJQVQPCNiZH/V8uGElzbBlKZV cC+RL1++c97TisKmfGsptUxKVRCHnmIBGwEj4= 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=byjRUUBzvWyWoP6gwtL9rkjKaybG1ECLzyqFZQQ9zNo=; b=gUluDsnAOXy3k/AKZAzg3sgxEOrfAEEHRgRNioBRjLEKFT++Qzp3G7HLpyG42z9mRP k6mUiajgFcAZ1y3dZlZ/B9t87rmP0l+JYtWmnRF85aNWwKzLiIe9ZZC5v2bcd//0NxfE j6L9SUZBd7jRjLKumq6qtYO84tkNUSwbrXfvDNNzd9oBrqmOOAHTfimQcdICQftnA37r 6M3dudFdSdb2rg9QtyHnKIT2sktEVzf2Xap2O/VHO8cU47R+H+IewM/1ZoY28994W+5M +E5cKUa7SsCWe+rFdxrAz3zpXV1nRS6slHv/3BGmlMZBtj3GbWS/DiqyppqmSKnO/kaa dNxw== X-Gm-Message-State: AKGB3mIiAlUeshtcbSet6uK5jwBao0Gcq7b9CvuNel0KJObwINp7eLoR Yik3KeJn1OKAqdObb7RA/LoKRA== X-Received: by 10.36.145.216 with SMTP id i207mr9048352ite.73.1513356305186; Fri, 15 Dec 2017 08:45:05 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id q132sm3631732iod.26.2017.12.15.08.45.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 08:45:03 -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, tor@ti.com, jolsa@redhat.com, mathieu.poirier@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/10] perf tools: Integrating the CoreSight decoding library Date: Fri, 15 Dec 2017 09:44:50 -0700 Message-Id: <1513356299-26274-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513356299-26274-1-git-send-email-mathieu.poirier@linaro.org> References: <1513356299-26274-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 | 6 +++++- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-libopencsd.c | 8 ++++++++ tools/perf/Makefile.config | 13 +++++++++++++ 5 files changed, 35 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..2aae2d3fb5f6 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,9 @@ $(OUTPUT)test-sched_getcpu.bin: $(OUTPUT)test-setns.bin: $(BUILD) +$(OUTPUT)test-libopencsd.bin: + $(BUILD) -lopencsd_c_api + 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 79b117a03fd7..2d0b99f7b4e7 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -346,6 +346,19 @@ ifeq ($(feature-setns), 1) $(call detected,CONFIG_SETNS) endif +ifeq ($(feature-libopencsd), 1) + CFLAGS += -DHAVE_CSTRACE_SUPPORT + LIBCSTRACE = -lopencsd_c_api -lopencsd + EXTLIBS += $(LIBCSTRACE) + $(call detected,CONFIG_LIBOPENCSD) + ifdef CSTRACE_RAW + CFLAGS += -DCS_DEBUG_RAW + ifeq (${CSTRACE_RAW}, packed) + CFLAGS += -DCS_RAW_PACKED + endif + endif +endif + ifndef NO_LIBELF CFLAGS += -DHAVE_LIBELF_SUPPORT EXTLIBS += -lelf