From patchwork Wed Jan 17 17:52:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 124901 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp132185lja; Wed, 17 Jan 2018 09:54:51 -0800 (PST) X-Google-Smtp-Source: ACJfBovPIVFP3y77mNdrjwFqO0yivIQahwm1Rgz6/qSzAAvBcalpCFe15hW32NTI7u4lvFHwT+yO X-Received: by 10.98.107.71 with SMTP id g68mr16278609pfc.96.1516211691174; Wed, 17 Jan 2018 09:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516211691; cv=none; d=google.com; s=arc-20160816; b=mnflZRr1MwzbRwXcZlV5rAUIS6ltY4LIN4G8Sr60jMUgq67bLdBVsCfdDH+n/+YQki P3r8MWZ4BI4Z9AUbsjGXUYPc+xK3w6w+W3/3qtw3zM51SF4qt7M8GTRQaG6r2Dqp7tQW K4pkgmLJJ1zOKCCVQCpmFgmK/slsyVwi56zzt3MGLdnn7L8rHmE3x1kez7OOU6RB4vjD JdBCIhJFJ4JJWi2PDIApP6FFW4eYMqbDALIhJ1DqdryLbpiu3yTWMNVn53BVjkgOrreL lvJMODxu3AzeVSa3gQJxz/rEPoFKzfNSvundfERkOPEFcNTT+aozv5T1lnH6f5aq5/19 EV1w== 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=Yhw3DrebPPpm6qW/sB4u+tJBc4LEz89K65qZ47eikhw=; b=I1NHn80QEElQTQXpr3Rl4EMUZx2nAuFSvJMJJSRoGMla5osPNFb4G8o178+QwlIGvP WUQDnVgXZUITx/3R/1+tSHUrTZ3fNbo7OHP4aQJ9BOEuGKsn/epyjIqe+2vVAZYVxV3k 5z6bTej+sO4foufYFgyH+4AvIQt8cQ4RgmcbxICu/VmJabkOsAG47N/3XogIpn0rN2G3 eScYcPrBX0LGehgjaF2LMhJE3J0aVATHRed7jBTcUYIhppkdIyg/nUp1M0n3/04dGpNy Ar11APnCqZRuHe9NjLpC86w1+xieTS/J+hgU8A1AARajZQVgSbWIR8AkNNo8zdK7I99A QB0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGedUN2l; 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 h1si4588318pfg.412.2018.01.17.09.54.50; Wed, 17 Jan 2018 09:54:51 -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=EGedUN2l; 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 S1754641AbeAQRyt (ORCPT + 28 others); Wed, 17 Jan 2018 12:54:49 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:40260 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754278AbeAQRw0 (ORCPT ); Wed, 17 Jan 2018 12:52:26 -0500 Received: by mail-it0-f66.google.com with SMTP id 196so10239688iti.5 for ; Wed, 17 Jan 2018 09:52:25 -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=Yhw3DrebPPpm6qW/sB4u+tJBc4LEz89K65qZ47eikhw=; b=EGedUN2luWnwfswL/wTHQj4AfL6LPoXy/cKOHSQagqSo3lEgb/+x1yCrUsUWMc2/mg mYY8L9Eqk45t7ZnJN4yFGfKrgMrSPNT6ZDVrP70F0mHBom+xSyjuRVSaSEgFNgSNzZON sykJCnWjtR5BdJ8x+PoQ/xYUn3JA9AnPl2+Y4= 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=Yhw3DrebPPpm6qW/sB4u+tJBc4LEz89K65qZ47eikhw=; b=Sdv5RZcitoI6CvN0OfBIw7HKlKPwm8USeZtozxkNQepUyB1njCLCRvHLAOqDISHgGg LRNMmoDla0M6ODrNcB80Z6W0APt+o7yUEBdc3MKXZLnQmkb7g4LA+C7nCBXi/dDAlzeq G7cKqvwwPPhvl4R2dp1/L0re4CxMydLXhJuFKQlnt0tvq3ApIhr+nX6XanZs4aNSQ9eW jiRlhz71o13cyBgtgtVdFjoMzgazBOdSq2Y+pLkihiGGNKHbt34IvHJ2w1mxt/VZwzcp G0eSQUC1PEoKt/x7/UvMk2VBdPHPjTNRR18/sCzEN24Qoa3BhjNmeDevxtA+ajxgfwmd OcVA== X-Gm-Message-State: AKwxytd5lwUtsYctdh7o5ZWmszOC5qGwtcqewqMYGLY1Y7Jea8ulWMvf FNHnPajG63UWOuo3WELauL2JgQ== X-Received: by 10.36.146.196 with SMTP id l187mr14365805itd.115.1516211545219; Wed, 17 Jan 2018 09:52:25 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id h72sm2694392ioe.61.2018.01.17.09.52.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Jan 2018 09:52:23 -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 v3 01/10] perf tools: Integrating the CoreSight decoding library Date: Wed, 17 Jan 2018 10:52:10 -0700 Message-Id: <1516211539-5166-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516211539-5166-1-git-send-email-mathieu.poirier@linaro.org> References: <1516211539-5166-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 | 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(-) -- 2.7.4 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