Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp190316yba; Fri, 5 Apr 2019 04:53:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLNmPJCpUNEKb5D0sCtW6SSHLZyIE0iA5CmDwfn1hzD3ZA2oB6iDUCf5wVR+qzn3APkGKm X-Received: by 2002:a62:305:: with SMTP id 5mr11928805pfd.65.1554465234320; Fri, 05 Apr 2019 04:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554465234; cv=none; d=google.com; s=arc-20160816; b=zUbHvjO5RLK3ko5nCanuEuiSJMAIG5LRoqLJUXqC393EpgQAn7qpfTQMWCm9nMfNh1 5WltUpILny1xRVVHJQYJQgAHYpEbez+Ve/0ioI3K5+xu+xaOPjB/YU/y6fdw/rVCJ2Re 1gTPpqenNjYiyMCRSWWIKRBW7RM1NjYUzSqBHF54x4ebGP/26TwnK9Y5A3a/xGSQzpSR GDjo1iOg7Ir1y3sxetuTyE6qhxqjAckiYV9NNGrbUVMnWtSAiszxNTmloJV5AusWiLaS kb5uakQHdDDLzP56xR/DXOQrg0zWjChaT43T8Vvo/2zo1e2IAru1utOaduVC/2Uyl5hl s80Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=2c6BnbV2XJuAqYbbpOtR8iu8PCBXgdf0OQKf84D0ajI=; b=lgn9cVv6VpcUxhhBbw4ReY6fXnC/dLScoCjpaZjOS3VOGTAIz6ABVCD5KEWGmpAGz1 /r08qBu06kVtKy3VqlmJrW6A5K3Sfds/dkaJ3IYDhVqPcHQ8Y7FPAA76g5DXmN+TVo7s t8IQqrwzDh+3W0bBJXvUmm06zr7J/wWci/fae8BKo1Rrh/vb1J4DCu3mPnu1REUQ00zU Hfncdsv7V5edFjB0kXJVJc1X8Qgf8wSizzl6RMGqer5PoclqNlY4kt4SFsG2NnuNZcKJ KTzn7hgQde0fcGk1YuSv6z7tTjqm00Xa6wC+oY+RWIqn0tpH+85MhThqYgNZaK1XGx4U CpJA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j187si2757193pge.507.2019.04.05.04.53.39; Fri, 05 Apr 2019 04:53:54 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731342AbfDELwO (ORCPT + 99 others); Fri, 5 Apr 2019 07:52:14 -0400 Received: from terminus.zytor.com ([198.137.202.136]:35413 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730487AbfDELwN (ORCPT ); Fri, 5 Apr 2019 07:52:13 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x35BpsS32738534 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 5 Apr 2019 04:51:54 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x35Bpr8B2738527; Fri, 5 Apr 2019 04:51:53 -0700 Date: Fri, 5 Apr 2019 04:51:53 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Alexey Budankov Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, acme@redhat.com, tglx@linutronix.de, ak@linux.intel.com, alexey.budankov@linux.intel.com, mingo@kernel.org, namhyung@kernel.org Reply-To: acme@redhat.com, jolsa@kernel.org, tglx@linutronix.de, peterz@infradead.org, ak@linux.intel.com, hpa@zytor.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, alexey.budankov@linux.intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <9b4cd8b0-10a3-1f1e-8d6b-5922a7ca216b@linux.intel.com> References: <9b4cd8b0-10a3-1f1e-8d6b-5922a7ca216b@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines Git-Commit-ID: 3b1c5d9659718263c7f9c93af82f98221c58f171 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3b1c5d9659718263c7f9c93af82f98221c58f171 Gitweb: https://git.kernel.org/tip/3b1c5d9659718263c7f9c93af82f98221c58f171 Author: Alexey Budankov AuthorDate: Mon, 18 Mar 2019 20:39:49 +0300 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 1 Apr 2019 15:18:10 -0300 tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines Implement libzstd feature check, NO_LIBZSTD and LIBZSTD_DIR defines to override Zstd library sources or disable the feature from the command line: $ make -C tools/perf LIBZSTD_DIR=/path/to/zstd/sources/ clean all $ make -C tools/perf NO_LIBZSTD=1 clean all Auto detection feature status is reported just before compilation starts. If your system has some version of the zstd library preinstalled then the build system finds and uses it during the build. If you still prefer to compile with some other version of zstd library you have capability to refer the compilation to that version using LIBZSTD_DIR define. Signed-off-by: Alexey Budankov Reviewed-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/9b4cd8b0-10a3-1f1e-8d6b-5922a7ca216b@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/build/Makefile.feature | 2 ++ tools/build/feature/Makefile | 6 +++++- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-libzstd.c | 12 ++++++++++++ tools/perf/Makefile.config | 20 ++++++++++++++++++++ tools/perf/Makefile.perf | 3 +++ tools/perf/builtin-version.c | 2 ++ 7 files changed, 49 insertions(+), 1 deletion(-) diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 8d3864b061f3..361207387b1b 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -67,6 +67,7 @@ FEATURE_TESTS_BASIC := \ sdt \ setns \ libaio \ + libzstd \ disassembler-four-args # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list @@ -120,6 +121,7 @@ FEATURE_DISPLAY ?= \ get_cpuid \ bpf \ libaio \ + libzstd \ disassembler-four-args # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 7ceb4441b627..4b8244ee65ce 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -62,7 +62,8 @@ FILES= \ test-clang.bin \ test-llvm.bin \ test-llvm-version.bin \ - test-libaio.bin + test-libaio.bin \ + test-libzstd.bin FILES := $(addprefix $(OUTPUT),$(FILES)) @@ -301,6 +302,9 @@ $(OUTPUT)test-clang.bin: $(OUTPUT)test-libaio.bin: $(BUILD) -lrt +$(OUTPUT)test-libzstd.bin: + $(BUILD) -lzstd + ############################### clean: diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 7853e6d91090..a59c53705093 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -182,6 +182,10 @@ # include "test-disassembler-four-args.c" #undef main +#define main main_test_zstd +# include "test-libzstd.c" +#undef main + int main(int argc, char *argv[]) { main_test_libpython(); @@ -224,6 +228,7 @@ int main(int argc, char *argv[]) main_test_libaio(); main_test_reallocarray(); main_test_disassembler_four_args(); + main_test_libzstd(); return 0; } diff --git a/tools/build/feature/test-libzstd.c b/tools/build/feature/test-libzstd.c new file mode 100644 index 000000000000..55268c01b84d --- /dev/null +++ b/tools/build/feature/test-libzstd.c @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +int main(void) +{ + ZSTD_CStream *cstream; + + cstream = ZSTD_createCStream(); + ZSTD_freeCStream(cstream); + + return 0; +} diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index fe3f97e342fa..beb8b48b44e6 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -152,6 +152,13 @@ endif FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf +ifdef LIBZSTD_DIR + LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib + LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib +endif +FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) +FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) + FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi # include ARCH specific config -include $(src-perf)/arch/$(SRCARCH)/Makefile @@ -787,6 +794,19 @@ ifndef NO_LZMA endif endif +ifndef NO_LIBZSTD + ifeq ($(feature-libzstd), 1) + CFLAGS += -DHAVE_ZSTD_SUPPORT + CFLAGS += $(LIBZSTD_CFLAGS) + LDFLAGS += $(LIBZSTD_LDFLAGS) + EXTLIBS += -lzstd + $(call detected,CONFIG_ZSTD) + else + msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR); + NO_LIBZSTD := 1 + endif +endif + ifndef NO_BACKTRACE ifeq ($(feature-backtrace), 1) CFLAGS += -DHAVE_BACKTRACE_SUPPORT diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index e8c9f77e9010..c706548d5b10 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -108,6 +108,9 @@ include ../scripts/utilities.mak # streaming for record mode. Currently Posix AIO trace streaming is # supported only when linking with glibc. # +# Define NO_LIBZSTD if you do not want support of Zstandard based runtime +# trace compression in record mode. +# # As per kernel Makefile, avoid funny character set dependencies unexport LC_ALL diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c index 50df168be326..f470144d1a70 100644 --- a/tools/perf/builtin-version.c +++ b/tools/perf/builtin-version.c @@ -78,6 +78,8 @@ static void library_status(void) STATUS(HAVE_LZMA_SUPPORT, lzma); STATUS(HAVE_AUXTRACE_SUPPORT, get_cpuid); STATUS(HAVE_LIBBPF_SUPPORT, bpf); + STATUS(HAVE_AIO_SUPPORT, aio); + STATUS(HAVE_ZSTD_SUPPORT, zstd); } int cmd_version(int argc, const char **argv)