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: 10170313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E228603ED for ; Wed, 17 Jan 2018 17:52:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4578728688 for ; Wed, 17 Jan 2018 17:52:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39C2C2868B; Wed, 17 Jan 2018 17:52:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9EB7A28689 for ; Wed, 17 Jan 2018 17:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jUyuik3voIm+M5gYRargyz4ddoHpu504WokukchDmD8=; b=HNGB1Kzux5M+oz36VmMU9+O7lS 89zFKqfV32ewK4DFBU6s/TRjaGYh9h4AQKIHVTmkFDHk+ksnzFgTz7L2MBP2WJAyBRiWSHjePBAYI qzcFxvF6p7VJx2XlZ/x2yiPVZXxM/SHaDGFRcCRR15kLx22QUjmfQ85qLZNivNHr/iwYcT+EZMNqy MGOAjbDQuIakOkymQ10VC6Id+ckvMLb2ZMRHbvbCPIBVTQQ3hYOQTtV+LN6DoeePnfuYLIrDj3rDD +sgNUT3UVwahfx1hiD/9aeE32u5iWO+q+HiC04DjgTA3z6CwSXGnk8MkVf0Bn/NbM1PTeoHNQJFv8 n0WcPpQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ebrt7-0000tF-Dn; Wed, 17 Jan 2018 17:52:37 +0000 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebrt3-0000g7-RG for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2018 17:52:35 +0000 Received: by mail-it0-x243.google.com with SMTP id c16so10186684itc.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=EzswKBvqCh6GTeP+2xiU7m1UmbmbHp0GsgG/SUx30Uc/XBM284stfWmJgH8wgRhZDz 1g6F1k7EH5FuRKSDfdGC/7tBcKZwyHffAo4Z5/u5TgYbtSfSpLHIA2Qnkb2ODmjKFxS4 aQ8R+OxcR4dFwGCVgRp8jAUncYG7/ImY7g+TKyIZ0mA9vEEwZG+RkIhBEGuqpNdE0Ac1 Spip0xqmZqNEbjOIAZoVkq//e6+hNBXpNW/IIHpgYN21oIGVHoVUN0QpZvfAx1vPKXaP KV/biIOhYKdZyFCcoGthUm1jR5acB7Nm3DRT8K+4RU4L3TVr/Jo3BPv5bXXz4sTtzX7B I6fA== X-Gm-Message-State: AKwxytesDTBWodknnY7YV1QwDTnxvWSOnyIZLbbQQj+oItC0WfTzmSXh 5vX1+mlvpzpnbRcQIXX3zDSnGw== X-Google-Smtp-Source: ACJfBoumQyBEbZ2NIcGNoCwY7nk3YSST/RFu6KX64VEKDVKhRnq2GVup6jiG/bl/RKWlbh4mAzUysg== 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 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> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kim.phillips@arm.com, peterz@infradead.org, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, mike.leach@arm.com, namhyung@kernel.org, suzuki.poulosi@arm.com, jolsa@redhat.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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