From patchwork Tue Sep 21 20:48:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12508765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C55BC433EF for ; Tue, 21 Sep 2021 20:48:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F1DD61156 for ; Tue, 21 Sep 2021 20:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235093AbhIUUuU (ORCPT ); Tue, 21 Sep 2021 16:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234573AbhIUUuU (ORCPT ); Tue, 21 Sep 2021 16:50:20 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89C3BC061575 for ; Tue, 21 Sep 2021 13:48:51 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id 13-20020ac8560d000000b0029f69548889so3609087qtr.3 for ; Tue, 21 Sep 2021 13:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=SS8p382b/+MpzDEKHFqeki4mKVdeQdYY0H5NNgwH11A=; b=X3Fii41kydfo469RvTRIPRGu6D4NahUVyM1IpsOidXGdWldWHkUvhW2Vo9lN/LfOOd QFbtEMYXDNsaAbZM2qqgsULT4RqKHX6euBQPSLKnOjBwHjSeKYQp0oBHxRZUw63622BM AH+RbuQq3XuvOdajQxiR3SOys/l38Gkm/LKv+msY6QMovpYDxS6sv+JqTo2qS/BkOdc2 6CUPke8MWARLJrNS2u/gOutk7TS6gL6EPCxRlDkkR8KOHxOl7R6quAGJZhIUJhpIRhWo S59HIYRLPLwOhnGUpMVrfMItPtQm4H+hdSrFSmU+XMCP3PNvuM9L8E1I/ZHAmLArzmdf L3qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=SS8p382b/+MpzDEKHFqeki4mKVdeQdYY0H5NNgwH11A=; b=1iZcxXiJi8DTiWgdfXvOtNgyb81FiL9W5d/rTUSF4r6RvPNPxtNItINs+Q0RolyTw4 BiDauLwoh6mLMC2v0abrSCmtT59CmcuF/RVkoWgqCpl8zhWBn29DqHu1leMGjaaZP3WB 1QfuHz3LdoVkWRbVTsrgGlWKEtA2yXfG/gDtoxIOsJre3ucHRgz1rFMYu6zulDDEJXte G+nsborsRKlFdrztmCATyV430dk+Cec7eam+B5rziTjxuG6JLatHzSFjBTAJG6loXn66 f8Fro/99XDKpictNntu8vkbjd+Mwi3TuR96EhZGp8DCb5hVH6fS37YyIXrQaTAX4/RHc RYxg== X-Gm-Message-State: AOAM5322t7COi/jmyR8Z2b/4UbL2ojh72oB9udFYxwBXfNyNHNXzUBNI zwL6PKPFQwS5oRBlHzR6hzM9R9PeDb86 X-Google-Smtp-Source: ABdhPJzcwyxZUGyLCqvEi6klZbQxxfa2zzSLXp8Z7ILqpWhvTXUEbxebpLk0txplencstN7nXLnwlS/+CzjX X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:dffa:819a:f0e2:47e]) (user=irogers job=sendgmr) by 2002:a05:6214:13a3:: with SMTP id h3mr32949438qvz.26.1632257330641; Tue, 21 Sep 2021 13:48:50 -0700 (PDT) Date: Tue, 21 Sep 2021 13:48:36 -0700 Message-Id: <20210921204839.236840-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v2 1/4] perf: Enable libtracefs dynamic linking From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tzvetomir Stoyanov , Steven Rostedt Cc: eranian@google.com, Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Currently libtracefs isn't used by perf, but there are potential improvements by using it as identified Steven Rostedt's e-mail: https://lore.kernel.org/lkml/20210610154759.1ef958f0@oasis.local.home/ This change is modelled on the dynamic libtraceevent patch by Michael Petlan: https://lore.kernel.org/linux-perf-users/20210428092023.4009-1-mpetlan@redhat.com/ Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 1 + tools/build/feature/Makefile | 4 ++++ tools/perf/Makefile.config | 9 +++++++++ tools/perf/Makefile.perf | 2 ++ 4 files changed, 16 insertions(+) diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 3dd2f68366f9..45a9a59828c3 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -52,6 +52,7 @@ FEATURE_TESTS_BASIC := \ libslang \ libslang-include-subdir \ libtraceevent \ + libtracefs \ libcrypto \ libunwind \ pthread-attr-setaffinity-np \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index eff55d287db1..d024b5204ba0 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -36,6 +36,7 @@ FILES= \ test-libslang.bin \ test-libslang-include-subdir.bin \ test-libtraceevent.bin \ + test-libtracefs.bin \ test-libcrypto.bin \ test-libunwind.bin \ test-libunwind-debug-frame.bin \ @@ -199,6 +200,9 @@ $(OUTPUT)test-libslang-include-subdir.bin: $(OUTPUT)test-libtraceevent.bin: $(BUILD) -ltraceevent +$(OUTPUT)test-libtracefs.bin: + $(BUILD) -ltracefs + $(OUTPUT)test-libcrypto.bin: $(BUILD) -lcrypto diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 446180401e26..00ec900ddbca 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -1098,6 +1098,15 @@ ifdef LIBTRACEEVENT_DYNAMIC endif endif +ifdef LIBTRACEFS_DYNAMIC + $(call feature_check,libtracefs) + ifeq ($(feature-libtracefs), 1) + EXTLIBS += -ltracefs + else + dummy := $(error Error: No libtracefs devel library found, please install libtracefs-dev); + endif +endif + # Among the variables below, these: # perfexecdir # perf_include_dir diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index e04313c4d840..7df13e74450c 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -130,6 +130,8 @@ include ../scripts/utilities.mak # # Define LIBTRACEEVENT_DYNAMIC to enable libtraceevent dynamic linking # +# Define LIBTRACEFS_DYNAMIC to enable libtracefs dynamic linking +# # As per kernel Makefile, avoid funny character set dependencies unexport LC_ALL From patchwork Tue Sep 21 20:48:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12508767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E48AC433F5 for ; Tue, 21 Sep 2021 20:48:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5741B61156 for ; Tue, 21 Sep 2021 20:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235113AbhIUUuX (ORCPT ); Tue, 21 Sep 2021 16:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234574AbhIUUuW (ORCPT ); Tue, 21 Sep 2021 16:50:22 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE060C061574 for ; Tue, 21 Sep 2021 13:48:53 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id e6-20020a0cb446000000b0037eeb9851dfso4898354qvf.17 for ; Tue, 21 Sep 2021 13:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=1rELxei1Th/UNLZ4fkAjYBbAjk1Yskkc5Wgg+H/lMdA=; b=GnkocixvmprRCEOB9amal+qdaykKMMJQVDyDyGGWvWI+dLE+fzvpyTpgX7ASVzVryX 1OuK3P8+KXJ6Hx4eyh0NMm8v9PsGuMX3KWkVhJInNzSrceUFEp6tLIrxb0qiiDHvFViX Y+sYLtXLIJ3Xsy9JU1k52hA6C25FOawWHb0JzphBgm4Xk3tgYEpCVsX/YvhpnM8CIDjQ bOdTFGvqV3x1IHYS85kqIQG6W6T/a7of9M2HDoa7NSaZDQvFRC/kphsYksY2uculVhB3 gigbMIBwwUfzDcd1NapB7iHL0AYQa4wusx4NqKE7foCQnPWxz4Mwd0Ti03IvAqlKJvEu /bsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=1rELxei1Th/UNLZ4fkAjYBbAjk1Yskkc5Wgg+H/lMdA=; b=B7Sssp4/mG120Fwwpw/aPu1zr7/x+FCGnZExrtUI0+RyapJKmhV0r9lBYmmVXoqm4G fHvYMif5rQEyLVWFWz+tNSzwoHMRq5TANJOnSxqW2crOAgwm3W77YtvEykpVfXJAoS9s tjvvasKOat953fV2xcTLsYkaK9Ebtps/R87sOVx97DCJQDmAxqfL1zbLUXL5RUs8ZhR5 11AtaVQI4z/El2eZLvPfX1+MMf52m/qrYJMQ2fko0JP5SI+FHCP3uakkLqppQ4Te+Tef Qgfwa5K1kTilRXmGMyAbcRB7f4y/l7sByDAraytmSb0pByDoP1KScbxgvTp7QKeFiISB z6OA== X-Gm-Message-State: AOAM533jQ5q/f9oe04fcNFAOBjHidaKHaC1AgfKYtVT2bW0r4n6E6MEE TJEsZ5hU+f7bgsAWEbFIrXl48ccA365F X-Google-Smtp-Source: ABdhPJxuEgFTXuFUCiRjLUb+WWg7xJJwRQJxL602S3UXwkh9eZag0QeZpZoAVYIEoyjtP6ua+lXtHohXYh6x X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:dffa:819a:f0e2:47e]) (user=irogers job=sendgmr) by 2002:a05:6214:1505:: with SMTP id e5mr10470735qvy.13.1632257332982; Tue, 21 Sep 2021 13:48:52 -0700 (PDT) Date: Tue, 21 Sep 2021 13:48:37 -0700 In-Reply-To: <20210921204839.236840-1-irogers@google.com> Message-Id: <20210921204839.236840-2-irogers@google.com> Mime-Version: 1.0 References: <20210921204839.236840-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v2 2/4] perf: Add define for libtraceevent version From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tzvetomir Stoyanov , Steven Rostedt Cc: eranian@google.com, Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org The definition is derived from pkg-config as discussed in: https://lore.kernel.org/lkml/20210610155915.20a252d3@oasis.local.home/ The definition is computed using expr rather than passed to be computed in C code, this avoids complications with quote in the variable expansions. For example see the target python/perf.so in Makefile.perf. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 00ec900ddbca..2001c315f0db 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -1093,6 +1093,12 @@ ifdef LIBTRACEEVENT_DYNAMIC $(call feature_check,libtraceevent) ifeq ($(feature-libtraceevent), 1) EXTLIBS += -ltraceevent + LIBTRACEEVENT_VERSION := $(shell $(PKG_CONFIG) --modversion libtraceevent) + LIBTRACEEVENT_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEEVENT_VERSION))) + LIBTRACEEVENT_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEEVENT_VERSION))) + LIBTRACEEVENT_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEEVENT_VERSION))) + LIBTRACEEVENT_VERSION_CPP := $(shell expr $(LIBTRACEEVENT_VERSION_1) \* 255 \* 255 + $(LIBTRACEEVENT_VERSION_2) \* 255 + $(LIBTRACEEVENT_VERSION_3)) + CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP) else dummy := $(error Error: No libtraceevent devel library found, please install libtraceevent-devel); endif From patchwork Tue Sep 21 20:48:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12508769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B0C7C433FE for ; Tue, 21 Sep 2021 20:48:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F04161156 for ; Tue, 21 Sep 2021 20:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235129AbhIUUu0 (ORCPT ); Tue, 21 Sep 2021 16:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235121AbhIUUuZ (ORCPT ); Tue, 21 Sep 2021 16:50:25 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BF8DC061757 for ; Tue, 21 Sep 2021 13:48:56 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id w2-20020a3794020000b02903b54f40b442so4341770qkd.0 for ; Tue, 21 Sep 2021 13:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=0fQ8TCUq2nIKYsU5pQLtTTkuNxp/JAtlPHlUXR9S+Vg=; b=M8rUSoyqhCE2pVWw+XCFo9eKV4+oKAaS77hyjuGwvD6X6Hm2OwL6HvrL6ERj+CKLSs LSNAUJUgR27wTDCNyU5/vDnSeMfa0nqXs5RItXkwcGn+V8RRcFl30F1aGJXXQWE7PCR5 4tIHLWzubEHJ5D1cmOTmebr+F9bvxls+Sim2gCdFGsOYqfKIi3zbLKvQ6hxEAkMU1K4r 3Z22Nkdp2XloJZKFsPIjYZr7xCdFo/m1UVe6DcMZDrwJIsiqbsMGBXPi5IhfHn1BxGBO nbBzpjdz18jsU+HSSvYYHRFuEL+O6y/tqsL4dCHi9hhu6+YR6m6vu0l5vG5Y1ScQY/US 6eRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0fQ8TCUq2nIKYsU5pQLtTTkuNxp/JAtlPHlUXR9S+Vg=; b=f0DI1ccVeWf3VPH1+Y2FtsXOccxpd6p4e8SuDahQaj5ElWv6iyyDYQ85HL9Zstn+le +ZSc4OGSxVCDx+nkF9QOVBH4OOhb4EG3uH86rrJRd/54/NrQUGIMZZY1CY98whUW+zMb BYEh8kjXCY+VWcA0qZLxwSjPXgHcBopLjL5roTVY1pI8vYtqWrhn9f0kcy4OwTf3OlCX P6mgioOit+8BbK6VteHQR76hSD4voifv7o8A4qOM8R2LjGQzy3amD60wOEx6+L1grJxT K4kP15wZnNJePkYVddq9QVQ9EHEwvSYgQTN4KU90sd4koTHordwDxcH5jefMgykz1lmO FXQw== X-Gm-Message-State: AOAM532XQFZ0gFbNhJgHzNXG8fimjYeRTK8Jrwzgk9QSvDi/84L8fagM KompQEFbRqTKEkcUg1PQH9SlmWm+30Fy X-Google-Smtp-Source: ABdhPJz+hk6+WNO8Dibbg6BJwFS1NpCW9OBNqbDVONr+XMUqVUf0sWNtnDo8Z6fJaiV9wdVLa0MEDShjVnSh X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:dffa:819a:f0e2:47e]) (user=irogers job=sendgmr) by 2002:a05:6902:1107:: with SMTP id o7mr40185706ybu.454.1632257335328; Tue, 21 Sep 2021 13:48:55 -0700 (PDT) Date: Tue, 21 Sep 2021 13:48:38 -0700 In-Reply-To: <20210921204839.236840-1-irogers@google.com> Message-Id: <20210921204839.236840-3-irogers@google.com> Mime-Version: 1.0 References: <20210921204839.236840-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v2 3/4] perf: Add define for libtracefs version From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tzvetomir Stoyanov , Steven Rostedt Cc: eranian@google.com, Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org This will allow version specific support of libtracefs. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 2001c315f0db..0ae2e3d8b832 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -1108,6 +1108,12 @@ ifdef LIBTRACEFS_DYNAMIC $(call feature_check,libtracefs) ifeq ($(feature-libtracefs), 1) EXTLIBS += -ltracefs + LIBTRACEFS_VERSION := $(shell $(PKG_CONFIG) --modversion libtracefs) + LIBTRACEFS_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEFS_VERSION))) + LIBTRACEFS_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEFS_VERSION))) + LIBTRACEFS_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEFS_VERSION))) + LIBTRACEFS_VERSION_CPP := $(shell expr $(LIBTRACEFS_VERSION_1) \* 255 \* 255 + $(LIBTRACEFS_VERSION_2) \* 255 + $(LIBTRACEFS_VERSION_3)) + CFLAGS += -DLIBTRACEFS_VERSION=$(LIBTRACEFS_VERSION_CPP) else dummy := $(error Error: No libtracefs devel library found, please install libtracefs-dev); endif From patchwork Tue Sep 21 20:48:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12508771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FA6FC433FE for ; Tue, 21 Sep 2021 20:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4760260F6E for ; Tue, 21 Sep 2021 20:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235145AbhIUUu2 (ORCPT ); Tue, 21 Sep 2021 16:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235101AbhIUUu1 (ORCPT ); Tue, 21 Sep 2021 16:50:27 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A9EC061574 for ; Tue, 21 Sep 2021 13:48:58 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id j4-20020ad454c4000000b0037a900dda7aso5205878qvx.14 for ; Tue, 21 Sep 2021 13:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=YRlcwai5LvG85hd6NJ2+esADNJKAvO1QJ6LOzStIvoc=; b=cx4RaPiuNKucS5+fY05v1LAUQYp712Amt429aLOtH8a8ka46KPAEKxfwsXrsL6yLW1 m+WlfS1neH18WD5ARNcB41n/PG0idYcgGY6G69i1KXY30wVDHCIFAXMmIvsSkPs8bpAc CiIYizrE/d4PhAc6ucG7SIHrWLJMhQHCED2E787XVwR28fHMLp1zFtSNzm6HmdvOFyrn ZKUqynWRefx2fM+ICY+L52VT8kiqkuRp5iY9jjdvly4xxZ2Q3nFgGufOHjwM3Qo3OGN2 xhW9N+0HcXXmglPNPqfd0C7uf16O+m6qf0FxOw8MXch1B0Zr2JXRCEdcPVXzT25mhbVF KUsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=YRlcwai5LvG85hd6NJ2+esADNJKAvO1QJ6LOzStIvoc=; b=qoUVY9j2skpjaW4gOYwZ9DD6gqELpEVd5oxjCqCoed8J08gE9joDrZuqpGWzgNIRgc MI4Q2hG39bKn6gS/d+uI+y96fvQLk57GvOuoblSb0k3ydWbXX31QOkKksZoPLPfMp/89 qU0pNKOvGP1iXaMla3g3D9MBDFlkV6kmftJLV2ZpNUDHPEDuPbb6tI5whvS4UsScCsIC YkdxDFmxAvkJezx/SSdY4pH4Sjjlo0o1Spl6Cvk4NcC2rFcRvEYeQZ/EP+DKwJvYyNm9 gII6mWC69qpnMjku8c60ivECgPhkkvyzpJKwCHwwiX3Aq5NcVhQxe36zCAZvXZzt8rSW 5hUA== X-Gm-Message-State: AOAM532wWudJFyVn5NJMPhpiR1gXVPaijAnzBOGQULvgnCL6vDiicJbJ wjWm9C9Te7qb3SGZm9HWjK3qXijv+NfT X-Google-Smtp-Source: ABdhPJy7pzI+58A/rFxsyE7qXX7Ruf8kuENwAlDeUpw1b6W37wfBiWGzDyGN2PwEYrHoXS953LTY0nQ6B+Z6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:dffa:819a:f0e2:47e]) (user=irogers job=sendgmr) by 2002:a0c:ef04:: with SMTP id t4mr2006399qvr.61.1632257337601; Tue, 21 Sep 2021 13:48:57 -0700 (PDT) Date: Tue, 21 Sep 2021 13:48:39 -0700 In-Reply-To: <20210921204839.236840-1-irogers@google.com> Message-Id: <20210921204839.236840-4-irogers@google.com> Mime-Version: 1.0 References: <20210921204839.236840-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v2 4/4] libtraceevent: Increase libtraceevent logging when verbose From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tzvetomir Stoyanov , Steven Rostedt Cc: eranian@google.com, Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org libtraceevent has added more levels of debug printout and with changes like: https://lore.kernel.org/linux-trace-devel/20210507095022.1079364-3-tz.stoyanov@gmail.com previously generated output like "registering plugin" is no longer displayed. This change makes it so that if perf's verbose debug output is enabled then the debug and info libtraceevent messages can be displayed. The code is conditionally enabled based on the libtraceevent version as discussed in the RFC: https://lore.kernel.org/lkml/20210610060643.595673-1-irogers@google.com/ v2. Is a rebase and handles the case of building without LIBTRACEEVENT_DYNAMIC. Signed-off-by: Ian Rogers --- tools/perf/util/debug.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 2c06abf6dcd2..c7a9fa0ffae9 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -24,6 +24,16 @@ #include "util/parse-sublevel-options.h" #include +#include + +#define MAKE_LIBTRACEEVENT_VERSION(a, b, c) ((a)*255*255+(b)*255+(c)) +#ifndef LIBTRACEEVENT_VERSION +/* + * If LIBTRACEEVENT_VERSION wasn't computed then set to version 1.1.0 that ships + * with the Linux kernel tools. + */ +#define LIBTRACEEVENT_VERSION MAKE_LIBTRACEEVENT_VERSION(1, 1, 0) +#endif int verbose; int debug_peo_args; @@ -228,6 +238,15 @@ int perf_debug_option(const char *str) /* Allow only verbose value in range (0, 10), otherwise set 0. */ verbose = (verbose < 0) || (verbose > 10) ? 0 : verbose; +#if MAKE_LIBTRACEEVENT_VERSION(1, 3, 0) <= LIBTRACEEVENT_VERSION + if (verbose == 1) + tep_set_loglevel(TEP_LOG_INFO); + else if (verbose == 2) + tep_set_loglevel(TEP_LOG_DEBUG); + else if (verbose >= 3) + tep_set_loglevel(TEP_LOG_ALL); +#endif + return 0; }