From patchwork Thu Sep 23 00:10:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12511679 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 E1602C433F5 for ; Thu, 23 Sep 2021 00:10:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0AA6611CA for ; Thu, 23 Sep 2021 00:10:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234042AbhIWAMD (ORCPT ); Wed, 22 Sep 2021 20:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234487AbhIWAMD (ORCPT ); Wed, 22 Sep 2021 20:12:03 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4E48C061756 for ; Wed, 22 Sep 2021 17:10:32 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id m10-20020a05620a290a00b004334bcdf1f4so15014494qkp.2 for ; Wed, 22 Sep 2021 17:10:32 -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=BCJvCUMu8cEQCM2npj9/T23V8EuGaCj9MUTMMJSKFhI=; b=LZ0AxlxdL6Ab/URwRSHoF3DLo4ESAnLaBJPa9wEXL0iC1dwX3oH7QqT2MM96O7iyqU W+3DAz6Hk8cOdOD3KMLBMclBagw+aGoMP3k4gupw98S4YVGsy08LH2tBu6kGw3HvUqxE 3zyB0eXQnIYBUTPqaLFL3PvdF0kp9XxPfh+Y1wDK+4RMeG6D/Pf0xHGaDZ1tHyXlXH27 +tTzU9l72JbEwYgTW8weT/GdadDIphtKCt7I8ap7/R8/jmtzk3txYIgTmsWOkMmhnL4E 2rou2vBy44pYeB7d3ggdTv6cmmYTXSh4IIHUOiMhmbpcXVPCYG2AEG+ts+iGo0A0LNJZ jFPg== 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=BCJvCUMu8cEQCM2npj9/T23V8EuGaCj9MUTMMJSKFhI=; b=P+MbDvi+jj3ORerFJWKp3/a1s3HKa444EnLd0Ov4yUtiHJCcQiEDwFwNioM4TJsb+e U9qno8NouxJEz8q+soPTKJ27gM1W8n+c0xVkYoYM00Wr/KpmS8AeLGYRW4S/cEJ6tN1D H57fCig8aGXi7x01NPs9yEaS8G0gPnRwOjPDdCDzJfubYjN4IiiN95cpsiulRUx9SlIg PlYXYiSRDyxz2K5SY+L2RQwZGdoYuyxtiBzfooN+htZmVznYCVexbLVVIjSLrWhjO1Sc XOcJEQuS5hxMaOJgVku3HyiOtNzagJOz83NwZUPBv9IWDH89wda1H3RdrM1Qa3Ulce7k EeVw== X-Gm-Message-State: AOAM530WzgNMNhAY+n7XXyn1TedlpBxqn72XZ5+HB/jCTN9xSHXfpq4M ZUNPK288YtNeObL+h0zELyQXBjw2GHvT X-Google-Smtp-Source: ABdhPJxKICrY5ejeu7qNYQ3l+App5+TxEUjjBS6BCcRlyBztcTHnImyVmezywBvXj6+kJkj8Ch5lDy/q6gSH X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:d3ff:e8f7:11f4:c738]) (user=irogers job=sendgmr) by 2002:a25:6b4d:: with SMTP id o13mr2111544ybm.241.1632355831884; Wed, 22 Sep 2021 17:10:31 -0700 (PDT) Date: Wed, 22 Sep 2021 17:10:21 -0700 Message-Id: <20210923001024.550263-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v3 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/ v3. Adds file missed in v1 and v2 spotted by Jiri Olsa. Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 1 + tools/build/feature/Makefile | 4 ++++ tools/build/feature/test-libtracefs.c | 10 ++++++++++ tools/perf/Makefile.config | 9 +++++++++ tools/perf/Makefile.perf | 2 ++ 5 files changed, 26 insertions(+) create mode 100644 tools/build/feature/test-libtracefs.c 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/build/feature/test-libtracefs.c b/tools/build/feature/test-libtracefs.c new file mode 100644 index 000000000000..8eff16c0c10b --- /dev/null +++ b/tools/build/feature/test-libtracefs.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +int main(void) +{ + struct tracefs_instance *inst = tracefs_instance_create("dummy"); + + tracefs_instance_destroy(inst); + return 0; +} 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 Thu Sep 23 00:10:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12511681 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, URIBL_BLOCKED,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 C7C4BC433EF for ; Thu, 23 Sep 2021 00:10:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD05860F4C for ; Thu, 23 Sep 2021 00:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238656AbhIWAMI (ORCPT ); Wed, 22 Sep 2021 20:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238638AbhIWAMF (ORCPT ); Wed, 22 Sep 2021 20:12:05 -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 30D24C061756 for ; Wed, 22 Sep 2021 17:10:35 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id ay30-20020a05620a179e00b00433294fbf97so14885805qkb.3 for ; Wed, 22 Sep 2021 17:10:35 -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=aj4ITEB5JceytWBHfNcVZcASLLTMUoHYYe1f328a7S6X2W14GhzWC+8Mra/X1zSFRa MG1KY3dnyQaUOROahD5evtsUwd93Q9oyYa7LxIgVCI0v3BcL2Ha1n9w9ITYAkgxRLBb6 uR5I5IBH1aWELGFZJuqZDwHXEzm4ELAmcdTca5mj2vTOFa/U1KEVAL7YgHckmJECMW1t 7joH10yxt5VFm9/If55eNRR9OLShFbUYZsHeWFrO6VD/8MRYNrmS/Ris1LvTRZplZMpj mJHdLZWBGrx9PysOlu0H3JJzEW1VXEZbtQW+7ZydG/QwFX6TBRL2GLW4T0hInJYjb6h3 tgJQ== 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=yHK59p8BsT8iY1HgiCVnk6c3pcAYwglCKCrZvb5d1xZ6FYk/9wOCAefcG1+riTXGNI HgOV3NTqhbqjz9Xntwv8KID2FKwb1Kq7erkiIo22MSx83FDnM34GMkpjhNPMR1Po8ICl 3QwAl8hKm2TbsJCNbtpJVs363cTRTdqpKdycw9a9xwwlN8hYc6WtPuzZnm6PVsn5Rx1T +nJkZ8hGA42UVqo76lrYJDbqQ+4aVAI1/54tn0nhdSvlNlUqbwBsxZh8yPQij3UPhqI0 fEnhptoeoXrw3m2SsG1d14Y+6PITUJ0G5O6PYTxFJ95YTX2c4mI6McKcfiPUOtEJYPX0 Ambw== X-Gm-Message-State: AOAM530qdYJlbelzWn0eecVwrq1ViQIoafnUlmNPQBvTsljUCgUcCpjW ZlnhWcJyDH/1m57zqcZIUjZaIgvgYz5W X-Google-Smtp-Source: ABdhPJzjm/4Mi5fc7Pf8x7huJqqqC5yilO3pfA3yu3xyN3RxlPlH2FRCHiesTjDAl2F3JrJhR3PfOJ7Jw7/l X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:d3ff:e8f7:11f4:c738]) (user=irogers job=sendgmr) by 2002:a25:ae97:: with SMTP id b23mr2412310ybj.50.1632355834372; Wed, 22 Sep 2021 17:10:34 -0700 (PDT) Date: Wed, 22 Sep 2021 17:10:22 -0700 In-Reply-To: <20210923001024.550263-1-irogers@google.com> Message-Id: <20210923001024.550263-2-irogers@google.com> Mime-Version: 1.0 References: <20210923001024.550263-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v3 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 Thu Sep 23 00:10:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12511683 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 AD65AC4332F for ; Thu, 23 Sep 2021 00:10:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95E2B61215 for ; Thu, 23 Sep 2021 00:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238663AbhIWAMJ (ORCPT ); Wed, 22 Sep 2021 20:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238639AbhIWAMI (ORCPT ); Wed, 22 Sep 2021 20:12:08 -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 6FF95C061757 for ; Wed, 22 Sep 2021 17:10:37 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id e6-20020a0cb446000000b0037eeb9851dfso15236806qvf.17 for ; Wed, 22 Sep 2021 17:10:37 -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=iI7qtmAmICkCCgLQogFaAY+iqk/g0Dx4kqDujqKKmXN0v1JFPQUul3NCyww0gCz+bh soWX/aTviRUIArTACFx4jx2YDtC/FS+VH3xG3lrhqQKz3eDY/Sf/na5CMpzHV3Jp6p+S vmwGIU1AFGE3XDfVSQi8SR+UxDkFdXWtVTTPHUsQziKUCV3Dxz7MnHRmmpsJ4yOsl5Nv e7G4Jco/RdvVPH/WvqiK+eu0wuw79xzZu6/fWm9FtXX38e3qGYteTYv37xU2cugbDrLf Fvl+PiIY7HA+F+tjRhBEA2R330mEZqzv0HZLdyulB7WvxnDh2bArBW9ZPsjbmHAaFuH8 0Sbg== 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=2qKfa6qEXO2eVJtswhb5Y4gY1PckFukQVjA5pw9b9HJDEeaJMi5Qf9s4qaIqmRrIat Se40pL+DjifNwcvQoeeNF459emc2Dhoj6gtKolo6R2OwDG5tDmP3MXt9tC2ftmyKxOuO EjGCMunBYpo/36QzcIdgrTVjuHT4iEMzOZPyFl1BdbPxroqq+ZY94iF6Sowd/0f14Vtg nQifDQ0Gufhh4ioHab8mwGNJQvrbfoXYLNCblXKnByN1lebgereAuBuBUE0OS/CHZfNz zX0AHmAgZgfI27VBusN4a0GXuxQRo8a9e2FmamAqNf14kECU56e/ys99rVlgw+pEqfE4 02Jw== X-Gm-Message-State: AOAM530BCoj8vMf0vsWVBeP2vYlBSofgNJevrPOPHxLlRgY91DnYd03/ kr8vAs5kTWvwU/QQ7+jTZxnxsHIyUgyo X-Google-Smtp-Source: ABdhPJy3RyfRfsylWhaJSckwnbpuVOrAcbDqdc5Kw2u184AKjwVFqJK7ZhO8wo5+A2EsARnq9Dm++Cv3pPH7 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:d3ff:e8f7:11f4:c738]) (user=irogers job=sendgmr) by 2002:a05:6214:6a7:: with SMTP id s7mr1648022qvz.34.1632355836614; Wed, 22 Sep 2021 17:10:36 -0700 (PDT) Date: Wed, 22 Sep 2021 17:10:23 -0700 In-Reply-To: <20210923001024.550263-1-irogers@google.com> Message-Id: <20210923001024.550263-3-irogers@google.com> Mime-Version: 1.0 References: <20210923001024.550263-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v3 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 Thu Sep 23 00:10:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12511685 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 004E3C433FE for ; Thu, 23 Sep 2021 00:10:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9CC161214 for ; Thu, 23 Sep 2021 00:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238664AbhIWAML (ORCPT ); Wed, 22 Sep 2021 20:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238658AbhIWAMK (ORCPT ); Wed, 22 Sep 2021 20:12:10 -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 E13EEC061574 for ; Wed, 22 Sep 2021 17:10:39 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id r18-20020a056214069200b0037a291a6081so15228342qvz.18 for ; Wed, 22 Sep 2021 17:10:39 -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=p252v6Wfpx8DGvA+HzHHCPRF+lJWWWCmAe1/SZMy6BXvM1IyvVvqGdtufi1WHFibmo WqaxM9Og4Do+U5Vw8hiDpFc9CapNZJgkJrJvrAM6vsXxiDRM/7Hn6XtdvLEPuxY9cnaA xbSjJ0fKtcFH76RCl1iU7SoisYq24wfzicjqEg7Dx1ormNIXgGy7bjX1in8wNSmIlyNv Mz/ypvRleSOiOaPo2pMA3/DojrbK7YUoD1oV/j92cHxR4Si+Jhhg+cRXftOiv7YuV1Zh AREFbGTzRoG6cBLCQmv6zr5jQnk6fY5nqnf2thY0vAP7ICv+Cbw1v70719X4L5CrWPt4 0dHQ== 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=MMIw6KHeK5XrWWlNperjcHj/PoTWiGmJOc8GSTDX32O930OSIztVb9epeXctJdLNRK cknN8dG+et2SJNlrcDnFsv2f9bzeWrJfJtXcHRt7PkImRSgfYEqHpRxFGPwj/pu6WZXf y96PZPF5d/qVfSUfDVwWN2dhaLPbhBpUAWDdnbcnVN8D5sxX2wzNJjppWg5PVIjH/R1T YXT7i19ZUMEra9gp2drO75mjZOYvh2cvTIfKkJqa6CARurLA0FbmPkEog80R1NaLsqyn P3ukGqmpPjxd4y3v4WhDQY0ZuTInmsN1dT7wwv0F8gel51GknXfgOAmqxdlIXRfwbXSS przA== X-Gm-Message-State: AOAM530Si2JX2k27kSGkrlxwwoRpNEoAkqFR1aaLVvDVCCwFzcZbHJb1 YXHXa6xmARufLm0TRbfolwNNquD9d/Ng X-Google-Smtp-Source: ABdhPJzb1ZGvPQkb6oTpQF8xtPVzUnFzvsxJMqG6jaDXT7A0xrZH7l9cDotjiUgPDMC4euU8V1MJJf2g8Wn5 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:d3ff:e8f7:11f4:c738]) (user=irogers job=sendgmr) by 2002:a25:adc6:: with SMTP id d6mr2226777ybe.463.1632355839083; Wed, 22 Sep 2021 17:10:39 -0700 (PDT) Date: Wed, 22 Sep 2021 17:10:24 -0700 In-Reply-To: <20210923001024.550263-1-irogers@google.com> Message-Id: <20210923001024.550263-4-irogers@google.com> Mime-Version: 1.0 References: <20210923001024.550263-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v3 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; }