From patchwork Thu Jun 13 18:32:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697312 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D7C1C27C6E for ; Thu, 13 Jun 2024 18:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=V/kpGWnzSj08M0eS2UZ+9iezKaMPSRzfgemhRYU3g18=; b=St8V/FC1t9+8Vv fHvNX4jBFjlXYeZLFvF+qwRM9KR8fqTe5ozLMHqoa5BvNA+8ratJMkXNZqJJB40Bm0Vxdv11+c5QB 1Gc/pdfqkZJF1530RAGBIrbjnE7j8h5UqMoGM0DASQuMkcEC+pb2cqHB2E1xNfK5xUxtT3tfNKkLl 9cx+P+JEqP1JgD4/MnhuOFHs93jp6St61GM0yNKWPoH2jiE7a5xAzQSnMJbgT/iwMaZHjgxuf3thx 9jIxOZn1WHQVGhS4gKU5uj1N/Luv8FYPuqq12nNRAZuQTG3+4MUCwC2NySk6bf/43bdr71ta3B6X7 1edAmZ/R4UQifU6q+8Gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFe-00000000631-46KM; Thu, 13 Jun 2024 18:32:47 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFW-000000005vn-47rT for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:40 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-62fd1655e12so27174257b3.1 for ; Thu, 13 Jun 2024 11:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303555; x=1718908355; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=qbSOB/P6de3ygMIG7fdBTW+eS92Yyh1ZhXc/HewO9bA=; b=fpPg/e5uV2NKQP9CmCPdEMIxU11LQLCMYvl3RaxkrBf4NFLapcLcMYxrqNmxWqclqK bNtQiQFNWihdAZY3yI6m75GRJk3U1/BBLgXKNDygw94/XDHH5VGYjlNWkjVUyha3GFVo gE9du+erFBiYF93whZSHCLLMbbgfYequBZtvvECE8O5b5z5gvTBjgzQGhphlKXWXnwO+ IJCaJJw4ViTjAbjs90qHq9+LlgEZ7sGlW/urtIsYS2qDxKr+uAb1jCgw6IXFbwCcKk/E C3IAkU1fg6u2DI7FQ/5u925YfdJKhe42uxpn2CSYNnUxSwv1NyNqeRyrPcoBNxkLZEwr PHJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303555; x=1718908355; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qbSOB/P6de3ygMIG7fdBTW+eS92Yyh1ZhXc/HewO9bA=; b=CahSs6xDHDcQLeupizJNH/o0GcbEMwenvwxAbkB1ujEdTyys/zDrR6iqxqXfqLvDyw NHbELPAtA70JF6HLbJPNeZVWekg2P+Rlh1+nuGumqcibIZpdHpZGWXPZEtYmLSJmxtsi MstuQMfMdgHEEyNHoN8D9uvmxU7bk71VrmqV2eCawqpBEwi9CVtmdoWMGI60vaPZ7NF8 sMfwD0a7fQuboUFN0kbnhjV1KNnEd3RqGawjtS8ZhmWshrOCZ8M/qKhbMKdPcY5hXqlx cHQf/kBRxBp452xX+cQHIqRXeJyAIy+zrp5fHyd9SCQTYlr9/Ri5OlQbwF0jOxa0xJmi N4Mw== X-Forwarded-Encrypted: i=1; AJvYcCUdRLruJcPmo4xZoYd8at+9vdfvps0SkPBfn+LjZ/qA9ecFjNL8EGP8WdzHCQsqSzMtjcWjEwPabf2Hnt9ny0UF4SKRfCXHKlFzlWfvurru X-Gm-Message-State: AOJu0YzFSHPXM8g46OcqnqxRrehMrqF2Y3Xy5mhArVL7s7qDV8L7jkLq BDwEFAS9KyyhNIWuBGeX9Bcm29Gh9wSWpDZkc7F3u8Pn2IhAAGzWYYiHDvTL8zoXcCa52pW+v4+ H/N/ByA== X-Google-Smtp-Source: AGHT+IHR1scoIW55qliDELzglhq+h7GtaX1D0jX494oPWXs5CmbGdmJdYrWJGCRevzbvrgaTOluk5cR4Bd5S X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:690c:6c8d:b0:62c:f6fd:5414 with SMTP id 00721157ae682-6322265d4e6mr673687b3.3.1718303554917; Thu, 13 Jun 2024 11:32:34 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:17 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-2-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 1/8] perf build: Add '*.a' to clean targets From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113239_063827_257C9677 X-CRM114-Status: GOOD ( 10.17 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Fix some excessively long lines by deploying '\'. Signed-off-by: Ian Rogers --- tools/perf/Makefile.perf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 5c35c0d89306..acc41a6717db 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -1201,12 +1201,19 @@ endif # CONFIG_PERF_BPF_SKEL bpf-skel-clean: $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) $(SKEL_OUT)/vmlinux.h -clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean - $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS) - $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete +clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \ + arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \ + tests-coresight-targets-clean + $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \ + $(OUTPUT)perf-iostat $(LANG_BINDINGS) + $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \ + -name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete $(Q)$(RM) $(OUTPUT).config-detected - $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so - $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \ + $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 \ + perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so + $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo \ + $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE \ + $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \ $(OUTPUT)util/intel-pt-decoder/inat-tables.c \ $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \ $(OUTPUT)pmu-events/pmu-events.c \ From patchwork Thu Jun 13 18:32:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E140C27C4F for ; Thu, 13 Jun 2024 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=im/T5bx3d886GB1Dobx8OXEMt/lUNL/NQA1h1GjmXIA=; b=qIIpkpgRtIrHud omNjRYzIp5UM8LrkNIkpcL0nNz+fMRIl1Uw54KKBe13LSKF7NbQveKNEth/yvvpcubwNfQZzmoMP2 bVAwWoWa5OKx+DoH5fTItty3J2FrmwO1m5EFQyMLAyASS9unu2OyJwIyRTiqBs/nlBz2JzZVCZ2Kn wifpJgWp8ZFL/GsZF8w6UY1tlw2ToXnV7nm0aBBn6ciKG5GdjFiMb7clcXmfCKAyF8Uzxs3lHF8Sy gwvC7lZPv1rrCArG8zIoTfP2ObFLafmgjX4NScX2/gN4OrMv4+BCG2Q2ewUzhoPZwHlGwsYaAUCfi udF6qx5BGG7Yd/sz9N5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFg-0000000064O-2Np9; Thu, 13 Jun 2024 18:32:48 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFY-000000005wW-0Iqk for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:42 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-62a3dec382eso14768147b3.1 for ; Thu, 13 Jun 2024 11:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303557; x=1718908357; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=r+7hNL7GU/EnUYuEiQpshzYvHRCk9RdYS1NEyctZDl4=; b=JsfIPdxA0FNLWpYWljJQXb3pXBm8l+a4q0+40Kacw/xgx01AQa/+dWQZH4s45qBieb 8RRzS5doLCfA/sB0s59XF9LWTzdyECv/KkLSOi+j7M7CzICxj1q4mFQKautV2tWsOmuQ C70QOw3oJ2LaVZ9Syn3xSbDbI/RSsWTnmlYpgrbEJE7ErqmbnfnreM2SH3ysCROP5R71 gSVu25NMyg1q/2bxCK2J/bedKCSy1OUPsGvHz8MXzVI8hT99oonti89anY/kTyemRra+ gef8DX76O6TBEl5+w4UwxVePaK8SPrqvDCrUkrnRaT0d4nE+75zTJUbRcBRAiMoIDncW TCJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303557; x=1718908357; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r+7hNL7GU/EnUYuEiQpshzYvHRCk9RdYS1NEyctZDl4=; b=bPQtmCX+JLE87aJWs1c5dDYeKPxz8LgCgcXN/QhXaYggc1gN6mAveRhqK/U3s0apws T/EAz1nhggYzBkPKNgo1zzKCeQJ8HzE4V+aJpkawVm05cVfyrE72dlae9HpKqR6/h3eV /ikBWFEpILzhuQjwQO7ZTdRPLM7DUbqHKkDs+SCBPCYToajJiyMa2YxFbqbPWas/j1pl S84g8wmHXD/6lmmp3PHka/apIgrOmCaKmpF+PEiisIJEa0cjMUb12ehc88SG0o55SKAl Qq8hlpkhwnK1edaOKOLmFQQp2JdUWL5oQrA/MPt9Yn25Aspk81SegNkYn4K1nWU7qKNj jnzw== X-Forwarded-Encrypted: i=1; AJvYcCUEI8+41uz2uRWaeFKxb/l8cem9hmYGDxgpCYajoN2EaT4nRHid1jasydFYEpUckiEBm2s+Fv2BnhTFD+tKBvHbWbFXafsIna4nzDQgLSWa X-Gm-Message-State: AOJu0YzEe62NWkwzBhn6f438KqOj7JiXMubAUITuQRvzSR2PL1yN6M6e WmtMnDh6lXlgvRpZLeWloi/31OrY1DkfU0XfqfOJn8SilEKati7iX86nNaO8wdey3+ejNbR/RKq 2Fdh/CA== X-Google-Smtp-Source: AGHT+IFCwGZJ+MHw847shQCnxjAbFvUrO2l5A8duAsKiZMntbbdsMkpz9t0sclkdJolpJxOeRJ4x/wM7S3qu X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a0d:ea92:0:b0:630:47e8:f406 with SMTP id 00721157ae682-630be505814mr6038677b3.1.1718303556929; Thu, 13 Jun 2024 11:32:36 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:18 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-3-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 2/8] perf ui: Make ui its own library From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113240_155597_DEC3060E X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Make the ui code its own library. This is done to avoid compiling code twice, once for the perf tool and once for the perf python module. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Build | 2 +- tools/perf/Makefile.perf | 10 ++++++++++ tools/perf/ui/Build | 18 +++++++++--------- tools/perf/ui/browsers/Build | 14 +++++++------- tools/perf/ui/tui/Build | 8 ++++---- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/tools/perf/Build b/tools/perf/Build index b0cb7ad8e6ac..16ed1357202b 100644 --- a/tools/perf/Build +++ b/tools/perf/Build @@ -55,7 +55,7 @@ CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)" perf-y += util/ perf-y += arch/ -perf-y += ui/ +perf-ui-y += ui/ perf-y += scripts/ gtk-y += ui/gtk/ diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index acc41a6717db..c5a027381c55 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -425,10 +425,14 @@ endif export PERL_PATH +LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o +LIBPERF_UI := $(OUTPUT)libperf-ui.a + PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif +PERFLIBS += $(LIBPERF_UI) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -729,6 +733,12 @@ $(PERF_IN): prepare FORCE $(PMU_EVENTS_IN): FORCE prepare $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events +$(LIBPERF_UI_IN): FORCE prepare + $(Q)$(MAKE) $(build)=perf-ui + +$(LIBPERF_UI): $(LIBPERF_UI_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(PMU_EVENTS_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ $(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@ diff --git a/tools/perf/ui/Build b/tools/perf/ui/Build index 6b6d7143a37b..d2ecd9290600 100644 --- a/tools/perf/ui/Build +++ b/tools/perf/ui/Build @@ -1,12 +1,12 @@ -perf-y += setup.o -perf-y += helpline.o -perf-y += progress.o -perf-y += util.o -perf-y += hist.o -perf-y += stdio/hist.o +perf-ui-y += setup.o +perf-ui-y += helpline.o +perf-ui-y += progress.o +perf-ui-y += util.o +perf-ui-y += hist.o +perf-ui-y += stdio/hist.o CFLAGS_setup.o += -DLIBDIR="BUILD_STR($(LIBDIR))" -perf-$(CONFIG_SLANG) += browser.o -perf-$(CONFIG_SLANG) += browsers/ -perf-$(CONFIG_SLANG) += tui/ +perf-ui-$(CONFIG_SLANG) += browser.o +perf-ui-$(CONFIG_SLANG) += browsers/ +perf-ui-$(CONFIG_SLANG) += tui/ diff --git a/tools/perf/ui/browsers/Build b/tools/perf/ui/browsers/Build index 2608b5da3167..a07489e44765 100644 --- a/tools/perf/ui/browsers/Build +++ b/tools/perf/ui/browsers/Build @@ -1,7 +1,7 @@ -perf-y += annotate.o -perf-y += annotate-data.o -perf-y += hists.o -perf-y += map.o -perf-y += scripts.o -perf-y += header.o -perf-y += res_sample.o +perf-ui-y += annotate.o +perf-ui-y += annotate-data.o +perf-ui-y += hists.o +perf-ui-y += map.o +perf-ui-y += scripts.o +perf-ui-y += header.o +perf-ui-y += res_sample.o diff --git a/tools/perf/ui/tui/Build b/tools/perf/ui/tui/Build index f916df33a1a7..2ac058ad1a61 100644 --- a/tools/perf/ui/tui/Build +++ b/tools/perf/ui/tui/Build @@ -1,4 +1,4 @@ -perf-y += setup.o -perf-y += util.o -perf-y += helpline.o -perf-y += progress.o +perf-ui-y += setup.o +perf-ui-y += util.o +perf-ui-y += helpline.o +perf-ui-y += progress.o From patchwork Thu Jun 13 18:32:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6D05C27C4F for ; Thu, 13 Jun 2024 18:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UF7kNtTb5+rRsKOi10UfljbLURklM9ibV6c1EsVvfsc=; b=vBfoJazYRrd9GJ xMjpPDdob2zVARjI7ZHpLMLUcLgNwZPtvHpWs81HLsWoSWdGMC3ZMpBaoL2XHuHQaYf39cPdmwTHy I7s2i+72NNNKwwsqInNx8pIpPoFJ2IkxCI0GqhMNM8IdU9TmiLe6D4Ua3f6WqTYz+aF6Q0BnFGPZT xgclLBKUrPvvl2ZawhRzI5g20l7wAe/Q4zcB3tdjgHjlVzRyXNNxaSJvD+dTtMrJUu3ZogUFOBGUS dZuRLUVo9suTZM+3eLXiXf+FWN2UswxQTqZrihYrN6JO9OjdswTnDIVXkstLiZK8koSpOpjlm5Mcs jjPpK+23d/3OYtehuYpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFu-000000006Ep-0kSa; Thu, 13 Jun 2024 18:33:02 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFa-000000005xk-3GIb for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:44 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-dfa5743655eso2436815276.1 for ; Thu, 13 Jun 2024 11:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303559; x=1718908359; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=CxA/uxqQnuEGimdVVLwjMbl2Ju2kVgaw0AA0enSCOv4=; b=2q+yJgbtVnwF/ThHuZ85cVEBQ9CRVN4La9V5oBuxU8K02Bo7ZguUGdwTCRsT3ZYePX oq+4hH+3iKjtgTm3kD8pMnULQedbweuxKpIexKiYCzwsqUfZojrK13hkKBcQEweHF3BG mbeI9FfWIw7LWJbwMItb8662Yv0dCOeP5KYuKXoSj5e5adulXqiI7fAWpbdC0AA1gycV 6PnlFLQD4+hT/Vm/ao3rXIdhcbfLjti8QA9VkyazK6ZWzAqEJt2DBAT1sinpglf5XQhx Z/Jw4HZ3wSeyO7TXiTq54LhNtKO/9Sebv+JTatmjHGdECm44V8FqK7+S5Yk2KTNWp7dO o20Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303559; x=1718908359; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CxA/uxqQnuEGimdVVLwjMbl2Ju2kVgaw0AA0enSCOv4=; b=YdRHlwcvIqvwwAbxvVljqGFk5KfPEDLE+utTRZI0ES8Gx/gH78sDZJRIQUsAh5Q8H+ ME3o8lglkF7oO+EBOe7BWTxRny++jn0/MXL7BRdXZOyOljUFKx9pPxB/LLP15tfirJvS DmtvJcdG4kOiTZ19mypN33bJu0w8OWCyYcVhm5dESsLRTe0F5j71wDLzkI8TSFqTvQaP eitIXwrNWGjqkZ1qnwU03rfoSj34Nr3XLj0xT6ZT4CPlI2uAHQKAnV8PVGzkxLECvHeu Azv9FgVtD+j0cbLNp2bDXTBKFPJQRz8/dQAcjqdfq8hlYoCM0fhBnBJegBepuPAOi204 XQZw== X-Forwarded-Encrypted: i=1; AJvYcCXMVFRBt7cLnVfdKEJqxma2QgTkqpjNQ5i5n3XDgrwzFgPlgLhpf9BlSnsMDPccCATXhE/4LV2XGiiLZ4066elj8zPlozGGlMl/UskMGzGC X-Gm-Message-State: AOJu0YwoVrkueFScD2bgYbN4Noj3ejaUWE+xV2jDWSKbd759zUBKRqQh sGSMDoj7nNjN2eLZnYRaphZUhfM/U8nNbxqKXTWKty3tXMC1uSUqiQqcDW6ZLAQHHEQCix9Qf38 TBnLddQ== X-Google-Smtp-Source: AGHT+IGAZ1ZgG57wyEl3hAgidkrUPAgXgRKQMEY99fAI3aVfJqxlfcnLYdCjeTpkCSQlE8nj6I8g7s5cWbGz X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:6902:1082:b0:dff:12d0:207d with SMTP id 3f1490d57ef6-dff150dc3c9mr98556276.0.1718303559074; Thu, 13 Jun 2024 11:32:39 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:19 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-4-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 3/8] perf pmu-events: Make pmu-events a library From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113242_943720_C21024A6 X-CRM114-Status: GOOD ( 10.86 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Make pmu-events into a library so it may be linked against things like the python module and not built from source. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Makefile.perf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index c5a027381c55..9640c6ae1837 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -428,11 +428,14 @@ export PERL_PATH LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o LIBPERF_UI := $(OUTPUT)libperf-ui.a +LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o +LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a + PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif -PERFLIBS += $(LIBPERF_UI) +PERFLIBS += $(LIBPERF_UI) $(LIBPMU_EVENTS) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -721,8 +724,6 @@ strip: $(PROGRAMS) $(OUTPUT)perf $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf PERF_IN := $(OUTPUT)perf-in.o - -PMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o export NO_JEVENTS build := -f $(srctree)/tools/build/Makefile.build dir=. obj @@ -730,18 +731,21 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj $(PERF_IN): prepare FORCE $(Q)$(MAKE) $(build)=perf -$(PMU_EVENTS_IN): FORCE prepare +$(LIBPMU_EVENTS_IN): FORCE prepare $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events +$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(LIBPERF_UI_IN): FORCE prepare $(Q)$(MAKE) $(build)=perf-ui $(LIBPERF_UI): $(LIBPERF_UI_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< -$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(PMU_EVENTS_IN) +$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ - $(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@ + $(PERF_IN) $(LIBS) -o $@ $(GTK_IN): FORCE prepare $(Q)$(MAKE) $(build)=gtk From patchwork Thu Jun 13 18:32:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A79FAC27C4F for ; Thu, 13 Jun 2024 18:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BQy5VDNXlLpjBr4Gc+vyQzI694SaYCfURTayO4WRujk=; b=MiTX67GCn4RV+W AfdJEe/FXGyL0nceFj9C2wz2LVSzONr1A1SbymxHlv9ZL/Rq5qAYWLKlkaVNx9Y0rvp0FYtsAxhmr cdUL2cx80qCSc4qxTeo3d3D5NfYThTgY0LbOQxKECwBQGuERIXde1pYl2AZUznjqUbdvTV1xf7LZK po6QLtWJnqpt1K+YgFaT1wSY8T7oebatvWUJPHo7/z0WcUqYVccjeDv+OnYjRoGAvVlIP6jtIky98 Qpv1W/TVjF3ZPvnBrtg5bn3pTA3u+sXnPDKmphrUi9QyBvEaxPzNFt91YaAUiERKBNodR/j2X66lS Vj31yZ6zwHqbA/3UdBMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpG4-000000006Ke-0lQF; Thu, 13 Jun 2024 18:33:12 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFd-000000005zT-18nk for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:47 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-62ff8aff966so23361717b3.2 for ; Thu, 13 Jun 2024 11:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303562; x=1718908362; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=tZz9GimlctQ26ar42jVbROZvfuJkuQBTvjgjDoz9ZEU=; b=DMwo/9+sCsqzPVRk+cSoI1VoNC6pveqkVjXP++xVPzGZvsnN2AW1IeLc1Vi0cX01x4 SY0dMOzucU1xX5EUzKVSYLMWbGsmF6v0WIStBHJUQc168dCDNJ3XjwDr0bUWDWPYXUgI 5n8xr+SlQskZBPe8eZAD59i8KqoS5ioZrx9TUv0Q1jZWCnMkMZhac8ppblBdrDUmg9ov 9k188Mz9utTHdIa5PPMrtdOC3I1SvP8JWibIywWC6JQJ2xmpFbTvFh6MXz8DaekxEyzx Je1cFn2HHXou0/alE0/bP5lLglJMZIW22Irx7NA+e/X3+590KQxZMQ/kpJYAIy0g32fm 1A0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303562; x=1718908362; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tZz9GimlctQ26ar42jVbROZvfuJkuQBTvjgjDoz9ZEU=; b=mOReB28ACurgs8x907luEkC8s5j3Spd6zZtjS0dlEEY1h9cdmiTfoUGGsFpzUQRyv1 9n8+1jo1XfVepiNt5Y0uNW46prFah2pjg4wwLKJGEdUIHRr+PGWQ2JsVFw4pG2EqzV65 ZOM8c175sA6s+E7PN2MNvmVd/eYd3UhfhwvN452gLw+YN4A6z5MyBCTZIqaZ9k9CLAuH TnckdNX3tnP1ZCCvd4ajkYFrLJ8GyABP3KSpKiH12hFLF9oA3OEOWjIXPfJAui2shbuO r4l9PvmAo27v3sfg1SKXGZr+++tiFqr33umcitjaB2OwAr3rNeELmXasr5jCoY0FDGAd 1/eg== X-Forwarded-Encrypted: i=1; AJvYcCXO8dc2xigk8PwlIFdACW9DXpYbwROvTfK9Sz2JuBMnP1ei457pPUZHq/hVTf3yBAleplhTBYNdZCq+CRygsCv11r9DWnvpWmn7xo/nRK5T X-Gm-Message-State: AOJu0YyNbuLvYLpUkxlguNLE+CFEgD91H4Uilxn7Maa38yBt4L3KEdcJ U5XAMBR/SnMckrZVTHN4yNl97mXW8L7+YghCBWYbJOzy5Cd0t/YrNV/7d3zhgw6FeTVZzVRHSNE 1iblpYA== X-Google-Smtp-Source: AGHT+IH7+oDRiDCGkBHQjZw4T8wV5aoh3otWrQx/wva0y0NN7X4C1eaRXKWV8UyYzeSM+fx9EuOEkQwjtHMG X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a25:aaa6:0:b0:dfe:fdde:a583 with SMTP id 3f1490d57ef6-dff1540839dmr13774276.7.1718303561394; Thu, 13 Jun 2024 11:32:41 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:20 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-5-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 4/8] perf test: Make tests its own library From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113245_370285_807CD1EE X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Make the tests code its own library. This is done to avoid compiling code twice, once for the perf tool and once for the perf python module. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Build | 3 +- tools/perf/Makefile.perf | 11 ++- tools/perf/arch/Build | 1 + tools/perf/arch/arm/Build | 2 +- tools/perf/arch/arm/tests/Build | 8 +- tools/perf/arch/arm64/Build | 2 +- tools/perf/arch/arm64/tests/Build | 8 +- tools/perf/arch/powerpc/Build | 2 +- tools/perf/arch/powerpc/tests/Build | 6 +- tools/perf/arch/x86/Build | 4 +- tools/perf/arch/x86/tests/Build | 20 ++-- tools/perf/tests/Build | 140 ++++++++++++++-------------- tools/perf/tests/workloads/Build | 12 +-- 13 files changed, 115 insertions(+), 104 deletions(-) diff --git a/tools/perf/Build b/tools/perf/Build index 16ed1357202b..fddd45ab35b4 100644 --- a/tools/perf/Build +++ b/tools/perf/Build @@ -36,7 +36,7 @@ endif perf-$(CONFIG_LIBELF) += builtin-probe.o perf-y += bench/ -perf-y += tests/ +perf-test-y += tests/ perf-y += perf.o @@ -55,6 +55,7 @@ CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)" perf-y += util/ perf-y += arch/ +perf-test-y += arch/ perf-ui-y += ui/ perf-y += scripts/ diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 9640c6ae1837..9fa69dd0b472 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -425,6 +425,9 @@ endif export PERL_PATH +LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o +LIBPERF_TEST := $(OUTPUT)libperf-test.a + LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o LIBPERF_UI := $(OUTPUT)libperf-ui.a @@ -435,7 +438,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif -PERFLIBS += $(LIBPERF_UI) $(LIBPMU_EVENTS) +PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -737,6 +740,12 @@ $(LIBPMU_EVENTS_IN): FORCE prepare $(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< +$(LIBPERF_TEST_IN): FORCE prepare + $(Q)$(MAKE) $(build)=perf-test + +$(LIBPERF_TEST): $(LIBPERF_TEST_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(LIBPERF_UI_IN): FORCE prepare $(Q)$(MAKE) $(build)=perf-ui diff --git a/tools/perf/arch/Build b/tools/perf/arch/Build index 688818844c11..6dd68c17924c 100644 --- a/tools/perf/arch/Build +++ b/tools/perf/arch/Build @@ -1,2 +1,3 @@ perf-y += common.o perf-y += $(SRCARCH)/ +perf-test-y += $(SRCARCH)/ diff --git a/tools/perf/arch/arm/Build b/tools/perf/arch/arm/Build index 36222e64bbf7..6b4fdec52122 100644 --- a/tools/perf/arch/arm/Build +++ b/tools/perf/arch/arm/Build @@ -1,2 +1,2 @@ perf-y += util/ -perf-$(CONFIG_DWARF_UNWIND) += tests/ +perf-test-$(CONFIG_DWARF_UNWIND) += tests/ diff --git a/tools/perf/arch/arm/tests/Build b/tools/perf/arch/arm/tests/Build index bc8e97380c82..599efa545727 100644 --- a/tools/perf/arch/arm/tests/Build +++ b/tools/perf/arch/arm/tests/Build @@ -1,5 +1,5 @@ -perf-y += regs_load.o -perf-y += dwarf-unwind.o -perf-y += vectors-page.o +perf-test-y += regs_load.o +perf-test-y += dwarf-unwind.o +perf-test-y += vectors-page.o -perf-y += arch-tests.o +perf-test-y += arch-tests.o diff --git a/tools/perf/arch/arm64/Build b/tools/perf/arch/arm64/Build index a7dd46a5b678..58b2d965ed86 100644 --- a/tools/perf/arch/arm64/Build +++ b/tools/perf/arch/arm64/Build @@ -1,2 +1,2 @@ perf-y += util/ -perf-y += tests/ +perf-test-y += tests/ diff --git a/tools/perf/arch/arm64/tests/Build b/tools/perf/arch/arm64/tests/Build index e337c09e7f56..d44c9de92d42 100644 --- a/tools/perf/arch/arm64/tests/Build +++ b/tools/perf/arch/arm64/tests/Build @@ -1,5 +1,5 @@ -perf-y += regs_load.o -perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o +perf-test-y += regs_load.o +perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o -perf-y += arch-tests.o -perf-y += cpuid-match.o +perf-test-y += arch-tests.o +perf-test-y += cpuid-match.o diff --git a/tools/perf/arch/powerpc/Build b/tools/perf/arch/powerpc/Build index a7dd46a5b678..58b2d965ed86 100644 --- a/tools/perf/arch/powerpc/Build +++ b/tools/perf/arch/powerpc/Build @@ -1,2 +1,2 @@ perf-y += util/ -perf-y += tests/ +perf-test-y += tests/ diff --git a/tools/perf/arch/powerpc/tests/Build b/tools/perf/arch/powerpc/tests/Build index 3526ab0af9f9..275026950645 100644 --- a/tools/perf/arch/powerpc/tests/Build +++ b/tools/perf/arch/powerpc/tests/Build @@ -1,4 +1,4 @@ -perf-$(CONFIG_DWARF_UNWIND) += regs_load.o -perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o +perf-test-$(CONFIG_DWARF_UNWIND) += regs_load.o +perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o -perf-y += arch-tests.o +perf-test-y += arch-tests.o diff --git a/tools/perf/arch/x86/Build b/tools/perf/arch/x86/Build index ed37013b4289..132cf8beaca2 100644 --- a/tools/perf/arch/x86/Build +++ b/tools/perf/arch/x86/Build @@ -1,5 +1,5 @@ perf-y += util/ -perf-y += tests/ +perf-test-y += tests/ ifdef SHELLCHECK SHELL_TESTS := entry/syscalls/syscalltbl.sh @@ -13,4 +13,4 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(TEST_LOGS) +perf-test-y += $(TEST_LOGS) diff --git a/tools/perf/arch/x86/tests/Build b/tools/perf/arch/x86/tests/Build index c1e3b7d39554..3227053f3355 100644 --- a/tools/perf/arch/x86/tests/Build +++ b/tools/perf/arch/x86/tests/Build @@ -1,15 +1,15 @@ -perf-$(CONFIG_DWARF_UNWIND) += regs_load.o -perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o +perf-test-$(CONFIG_DWARF_UNWIND) += regs_load.o +perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o -perf-y += arch-tests.o -perf-y += sample-parsing.o -perf-y += hybrid.o -perf-$(CONFIG_AUXTRACE) += intel-pt-test.o +perf-test-y += arch-tests.o +perf-test-y += sample-parsing.o +perf-test-y += hybrid.o +perf-test-$(CONFIG_AUXTRACE) += intel-pt-test.o ifeq ($(CONFIG_EXTRA_TESTS),y) -perf-$(CONFIG_AUXTRACE) += insn-x86.o +perf-test-$(CONFIG_AUXTRACE) += insn-x86.o endif -perf-$(CONFIG_X86_64) += bp-modify.o -perf-y += amd-ibs-via-core-pmu.o +perf-test-$(CONFIG_X86_64) += bp-modify.o +perf-test-y += amd-ibs-via-core-pmu.o ifdef SHELLCHECK SHELL_TESTS := gen-insn-x86-dat.sh @@ -23,4 +23,4 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(TEST_LOGS) +perf-test-y += $(TEST_LOGS) diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build index c7f9d9676095..5671ee530019 100644 --- a/tools/perf/tests/Build +++ b/tools/perf/tests/Build @@ -1,82 +1,82 @@ # SPDX-License-Identifier: GPL-2.0 -perf-y += builtin-test.o -perf-y += tests-scripts.o -perf-y += parse-events.o -perf-y += dso-data.o -perf-y += attr.o -perf-y += vmlinux-kallsyms.o -perf-$(CONFIG_LIBTRACEEVENT) += openat-syscall.o -perf-$(CONFIG_LIBTRACEEVENT) += openat-syscall-all-cpus.o -perf-$(CONFIG_LIBTRACEEVENT) += openat-syscall-tp-fields.o -perf-$(CONFIG_LIBTRACEEVENT) += mmap-basic.o -perf-y += perf-record.o -perf-y += evsel-roundtrip-name.o -perf-$(CONFIG_LIBTRACEEVENT) += evsel-tp-sched.o -perf-y += fdarray.o -perf-y += pmu.o -perf-y += pmu-events.o -perf-y += hists_common.o -perf-y += hists_link.o -perf-y += hists_filter.o -perf-y += hists_output.o -perf-y += hists_cumulate.o -perf-y += python-use.o -perf-y += bp_signal.o -perf-y += bp_signal_overflow.o -perf-y += bp_account.o -perf-y += wp.o -perf-y += task-exit.o -perf-y += sw-clock.o -perf-y += mmap-thread-lookup.o -perf-y += thread-maps-share.o -perf-$(CONFIG_LIBTRACEEVENT) += switch-tracking.o -perf-y += keep-tracking.o -perf-y += code-reading.o -perf-y += sample-parsing.o -perf-y += parse-no-sample-id-all.o -perf-y += kmod-path.o -perf-y += thread-map.o -perf-y += topology.o -perf-y += mem.o -perf-y += cpumap.o -perf-y += stat.o -perf-y += event_update.o -perf-y += event-times.o -perf-y += expr.o -perf-y += backward-ring-buffer.o -perf-y += sdt.o -perf-y += is_printable_array.o -perf-y += bitmap.o -perf-y += perf-hooks.o -perf-y += unit_number__scnprintf.o -perf-y += mem2node.o -perf-y += maps.o -perf-y += time-utils-test.o -perf-y += genelf.o -perf-y += api-io.o -perf-y += demangle-java-test.o -perf-y += demangle-ocaml-test.o -perf-y += pfm.o -perf-y += parse-metric.o -perf-y += pe-file-parsing.o -perf-y += expand-cgroup.o -perf-y += perf-time-to-tsc.o -perf-y += dlfilter-test.o -perf-y += sigtrap.o -perf-y += event_groups.o -perf-y += symbols.o -perf-y += util.o +perf-test-y += builtin-test.o +perf-test-y += tests-scripts.o +perf-test-y += parse-events.o +perf-test-y += dso-data.o +perf-test-y += attr.o +perf-test-y += vmlinux-kallsyms.o +perf-test-$(CONFIG_LIBTRACEEVENT) += openat-syscall.o +perf-test-$(CONFIG_LIBTRACEEVENT) += openat-syscall-all-cpus.o +perf-test-$(CONFIG_LIBTRACEEVENT) += openat-syscall-tp-fields.o +perf-test-$(CONFIG_LIBTRACEEVENT) += mmap-basic.o +perf-test-y += perf-record.o +perf-test-y += evsel-roundtrip-name.o +perf-test-$(CONFIG_LIBTRACEEVENT) += evsel-tp-sched.o +perf-test-y += fdarray.o +perf-test-y += pmu.o +perf-test-y += pmu-events.o +perf-test-y += hists_common.o +perf-test-y += hists_link.o +perf-test-y += hists_filter.o +perf-test-y += hists_output.o +perf-test-y += hists_cumulate.o +perf-test-y += python-use.o +perf-test-y += bp_signal.o +perf-test-y += bp_signal_overflow.o +perf-test-y += bp_account.o +perf-test-y += wp.o +perf-test-y += task-exit.o +perf-test-y += sw-clock.o +perf-test-y += mmap-thread-lookup.o +perf-test-y += thread-maps-share.o +perf-test-$(CONFIG_LIBTRACEEVENT) += switch-tracking.o +perf-test-y += keep-tracking.o +perf-test-y += code-reading.o +perf-test-y += sample-parsing.o +perf-test-y += parse-no-sample-id-all.o +perf-test-y += kmod-path.o +perf-test-y += thread-map.o +perf-test-y += topology.o +perf-test-y += mem.o +perf-test-y += cpumap.o +perf-test-y += stat.o +perf-test-y += event_update.o +perf-test-y += event-times.o +perf-test-y += expr.o +perf-test-y += backward-ring-buffer.o +perf-test-y += sdt.o +perf-test-y += is_printable_array.o +perf-test-y += bitmap.o +perf-test-y += perf-hooks.o +perf-test-y += unit_number__scnprintf.o +perf-test-y += mem2node.o +perf-test-y += maps.o +perf-test-y += time-utils-test.o +perf-test-y += genelf.o +perf-test-y += api-io.o +perf-test-y += demangle-java-test.o +perf-test-y += demangle-ocaml-test.o +perf-test-y += pfm.o +perf-test-y += parse-metric.o +perf-test-y += pe-file-parsing.o +perf-test-y += expand-cgroup.o +perf-test-y += perf-time-to-tsc.o +perf-test-y += dlfilter-test.o +perf-test-y += sigtrap.o +perf-test-y += event_groups.o +perf-test-y += symbols.o +perf-test-y += util.o ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc)) -perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o +perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o endif CFLAGS_attr.o += -DBINDIR="BUILD_STR($(bindir_SQ))" -DPYTHON="BUILD_STR($(PYTHON_WORD))" CFLAGS_python-use.o += -DPYTHONPATH="BUILD_STR($(OUTPUT)python)" -DPYTHON="BUILD_STR($(PYTHON_WORD))" CFLAGS_dwarf-unwind.o += -fno-optimize-sibling-calls -perf-y += workloads/ +perf-test-y += workloads/ ifdef SHELLCHECK SHELL_TESTS := $(shell find tests/shell -executable -type f -name '*.sh') @@ -90,4 +90,4 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(TEST_LOGS) +perf-test-y += $(TEST_LOGS) diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build index a1f34d5861e3..48bf0d3b0f3d 100644 --- a/tools/perf/tests/workloads/Build +++ b/tools/perf/tests/workloads/Build @@ -1,11 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 -perf-y += noploop.o -perf-y += thloop.o -perf-y += leafloop.o -perf-y += sqrtloop.o -perf-y += brstack.o -perf-y += datasym.o +perf-test-y += noploop.o +perf-test-y += thloop.o +perf-test-y += leafloop.o +perf-test-y += sqrtloop.o +perf-test-y += brstack.o +perf-test-y += datasym.o CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE From patchwork Thu Jun 13 18:32:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D752C27C75 for ; Thu, 13 Jun 2024 18:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oLpMaZksARAhpFcS+lUhE3il9t9yj51yP4CfS5sz5/M=; b=doZjBQK/GzK0xX I7WzT44BlsY5fEAM5iJ7VTKkkOR9WdtSd5T4ex9SC0a4Ot8RpbFL/+UuU+8/9KDNW5/IuXbIScrvc aSAyihV5OrifVYuEFeTHKG1hx8Q3tkwFmN9uY1z4zVH1mVteDIDGnEZPweYa8ua5Bw/fo7MDmq+l+ i3WSVXjEy1TqV3J+RD5JP0dSpcc1mEjxyYdcfAo7bqfnJSIA5xpW78ZRLeL6JwJkDFLZFp5+BUN8D hbDlCvRA5ZTU5mglf7e00kKGclI7GyXnx+d0XvQQe4/QoZ/3U+dFwrGkvGBChthl6NfQUsQwfkCIl tkfCndaYAV4QGk3RVueQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpG8-000000006O2-0S4P; Thu, 13 Jun 2024 18:33:16 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFg-0000000061P-0kPV for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:50 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-62fd1655e12so27177407b3.1 for ; Thu, 13 Jun 2024 11:32:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303564; x=1718908364; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VsC80hpqUOVrh72YOJDioHn4WeJ5/uS/HucL7CDuoyM=; b=Gw5XeWZOg7hPFHW2g5eTleCp1eQ6jhe3TSaM3DedUCJalzlmiUaJ+YVCBp3VZXU7+U woWCDd8oXS4YoeVqAybibJI+2CTcLjNajyGFIy+depLxfIzjc/XQFksLZriWvjpk9HEu 10IfI26cNSjn/m0MHCPDsOhukAWvhlo70AZpvjplXe3zBOzl6vfrbu4N1gANJ9Tg2XGS tfxL0nyARLVEirHM0bYEGwpCjcqF812o+5nIu7Aezq2W5dNdlmk+dUyBRB+X826ur0TK tApUEBwy4pRvo0ql95/CrG0SO02xW0Wm3PiePmLpMrKWjKSTqllj3656IsrXdo1amsIY ATHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303564; x=1718908364; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VsC80hpqUOVrh72YOJDioHn4WeJ5/uS/HucL7CDuoyM=; b=KsO71bDPgUUeFuwnEipzKQwBczUkHHJnjWi/kUMj1djUHwWb2rd33NOwE2cz+VjK0I PRD8gknG2MNZUaQBl04mbxS9OK9lkmuXk72GsRR8c/7rSrj4I8npMx7SLezsCxjTugc5 Bi+DY+le0+wzjMHN4XTxk4ycpc7MHDt2B9F2oie2JaV+Sx5h29Gol5gMuxlUQN36TWX+ SASfeqF1qASuOroQMzfLhNe2c1tTOXa4hu5pNIc+l7Vpr68O1ZLnHk+llUVA2EOW4Xai xplEYwfFuctqu41mptveQ8l89W83gyzVNhEgw1Jw3KHq8Q7TpXm0SyxMNSPwXeq3vHHP fizw== X-Forwarded-Encrypted: i=1; AJvYcCXfwnz1cAM60uNB/hj5y3bW3NGiloi3uB//GDuDOu/248NqASZoAKU7XMUVIAZqj40RawhR+O8w41qE07SRDl3UkaEkwbFcMJWgfs+S3ed8 X-Gm-Message-State: AOJu0YybjwcqJRFZp2t6GXL4N5a4dbQ6C59eHNw0ee+f/8Rqj5MKLW1/ TyH8a/YAmz3LdbfCAFJAb7StR/wAiLUTz13F3JzkpyeHGv5jWRmLhmQTZUp/1lFXZkoPPZVuucy voxxbyg== X-Google-Smtp-Source: AGHT+IEdqa6Cq2DjAQ1hydcxNB6Fk+xXGdzWy6Gy93AqEv1pt5Ye/DroFSzoO6amfQnl0ylP95kficGysIqg X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:690c:6ac8:b0:622:d1d3:124 with SMTP id 00721157ae682-632248126c8mr799617b3.10.1718303563655; Thu, 13 Jun 2024 11:32:43 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:21 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-6-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 5/8] perf bench: Make bench its own library From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113248_401632_AFA4B0D9 X-CRM114-Status: GOOD ( 12.51 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Make the benchmark code into a library so it may be linked against things like the python module to avoid compiling code twice. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Build | 4 ++-- tools/perf/Makefile.perf | 11 +++++++++- tools/perf/bench/Build | 46 ++++++++++++++++++++-------------------- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/tools/perf/Build b/tools/perf/Build index fddd45ab35b4..2787f5630ff7 100644 --- a/tools/perf/Build +++ b/tools/perf/Build @@ -1,4 +1,4 @@ -perf-y += builtin-bench.o +perf-bench-y += builtin-bench.o perf-y += builtin-annotate.o perf-y += builtin-config.o perf-y += builtin-diff.o @@ -35,7 +35,7 @@ endif perf-$(CONFIG_LIBELF) += builtin-probe.o -perf-y += bench/ +perf-bench-y += bench/ perf-test-y += tests/ perf-y += perf.o diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 9fa69dd0b472..4a3c000b9845 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -425,6 +425,9 @@ endif export PERL_PATH +LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o +LIBPERF_BENCH := $(OUTPUT)libperf-bench.a + LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o LIBPERF_TEST := $(OUTPUT)libperf-test.a @@ -438,7 +441,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif -PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS) +PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -740,6 +743,12 @@ $(LIBPMU_EVENTS_IN): FORCE prepare $(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< +$(LIBPERF_BENCH_IN): FORCE prepare + $(Q)$(MAKE) $(build)=perf-bench + +$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(LIBPERF_TEST_IN): FORCE prepare $(Q)$(MAKE) $(build)=perf-test diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build index c2ab30907ae7..279ab2ab4abe 100644 --- a/tools/perf/bench/Build +++ b/tools/perf/bench/Build @@ -1,25 +1,25 @@ -perf-y += sched-messaging.o -perf-y += sched-pipe.o -perf-y += sched-seccomp-notify.o -perf-y += syscall.o -perf-y += mem-functions.o -perf-y += futex-hash.o -perf-y += futex-wake.o -perf-y += futex-wake-parallel.o -perf-y += futex-requeue.o -perf-y += futex-lock-pi.o -perf-y += epoll-wait.o -perf-y += epoll-ctl.o -perf-y += synthesize.o -perf-y += kallsyms-parse.o -perf-y += find-bit-bench.o -perf-y += inject-buildid.o -perf-y += evlist-open-close.o -perf-y += breakpoint.o -perf-y += pmu-scan.o -perf-y += uprobe.o +perf-bench-y += sched-messaging.o +perf-bench-y += sched-pipe.o +perf-bench-y += sched-seccomp-notify.o +perf-bench-y += syscall.o +perf-bench-y += mem-functions.o +perf-bench-y += futex-hash.o +perf-bench-y += futex-wake.o +perf-bench-y += futex-wake-parallel.o +perf-bench-y += futex-requeue.o +perf-bench-y += futex-lock-pi.o +perf-bench-y += epoll-wait.o +perf-bench-y += epoll-ctl.o +perf-bench-y += synthesize.o +perf-bench-y += kallsyms-parse.o +perf-bench-y += find-bit-bench.o +perf-bench-y += inject-buildid.o +perf-bench-y += evlist-open-close.o +perf-bench-y += breakpoint.o +perf-bench-y += pmu-scan.o +perf-bench-y += uprobe.o -perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o -perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o +perf-bench-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o +perf-bench-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o -perf-$(CONFIG_NUMA) += numa.o +perf-bench-$(CONFIG_NUMA) += numa.o From patchwork Thu Jun 13 18:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15287C27C4F for ; Thu, 13 Jun 2024 19:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HPlK76fvRJJ/EXhvv8/9Fz3smvJxIgs4DIaWiCpp/uY=; b=UUOgNwKgXo+8Md A39GIzGcgYVn7oI3Mnw/QCGDB6YgN62VVoVQoH69HBlwD+ojO6XrMlMrXmmazdURPgpa1lS49qJpV GDoYNwjQ3RuR+Ydh7F4zr/yfSH5IRh8IdVaUj2Xk7v18xJ7B8fR1EM3qbfizgeYJRmug1isJlhToR QLFd4V5m2MLVUcBiaj+Un6cAPxazyoBu0Efa3TirS0M/CwBaQOzYF1c+xOmeW8qMDTBCUhNcBKpFJ OzylNKeCmK3jThrl7xGIhiuoHX2HtXx7cCeZUcq14YvR/2SWLkx0dlRyZwCNGp3+NVujRNDeUBlI2 OX/ipbqBGW4EGsVqNlkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHqCp-00000000I2M-1oaR; Thu, 13 Jun 2024 19:33:55 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFh-00000000630-49u2 for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:33:00 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-62fa71fbfc4so23876997b3.2 for ; Thu, 13 Jun 2024 11:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303566; x=1718908366; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=dpV6pP3JjzbyLLSMj8oAyRWJWaCKTD9TeIuIUuIgyB0=; b=qHql38Uklb1/aBXeYcDXmwWW/NagjguGVjQWMyPizTBQoLBH2sC3uOzypqY4Mzfsiv RDIy2hK1zgpPa8gKqc7T1ACuMBIvt7QGessjlC0eOXhnOVEd1OrBqJdn4UGAQ+ttDS2q 2RPvzNyLvDDKohE1/+NqPiyxRgCq72XHSW/Y+pnAU6DAL2trmrRAk52RjmaUfy84tvtV h+hbm+mEtobr4s49yzIxZ7JuBy4y9Z0a36lshJf3cPJK3ELCbVtWqmr6VmnDDZ3GAF9L nlgEp0+srBf9KKRBvrdYCUIwTZp4lbffNCvOvKJR6jR1I7p+yDuIEIChwspDrc7zN0O6 HkLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303566; x=1718908366; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dpV6pP3JjzbyLLSMj8oAyRWJWaCKTD9TeIuIUuIgyB0=; b=Negjl3KhNvxzGLRgF6ZeaUUVRmhuc8x7Bfyt8b0TB9tXmYi32jzkdqpsGBK3cjnxXA XvEYK+Bkoa4XC0wxB8FZQfPAxxRyarE6CGJ7HA4sBYEWHu3rq2ybsVQaz4VFHDkIwHIJ naw4nC1sQP4CdH9hBqxBSNvR0PZSHMwRsLMtdtYT0cr1C6oZ3hcW89OTfDgy9B75POQm /FDbCMDtuiViWsUw5gWYG3LMd3LTUHCYaUtcD+K94vq91497mUTtG5IHZ1oAxaMjNgf/ ypjKFooeUjMU8NBomtqmTKspPY1RDeN+m6EDCSMEVtjxJlM7GutEt6px9EVDJsp/ODD1 Xl8g== X-Forwarded-Encrypted: i=1; AJvYcCWdgQ2e70Djwy3srnOx5LM+NA11Z3b9yoamdtMnfnNmMbfmoL9KQcSW1fV+cjt2doFz3ZFqBMbCx64DLJCrx2Yjdhj7tRxye88t8bufHIjn X-Gm-Message-State: AOJu0YyO72pSMhszLXMWu3IwV7kpM88LwxjpgZmKt4pdJ3olJUqBNL8p WbJwD9qM2hzN7iByNDB2ncGeCgkPxnxcqRKdZvKb568quQFAnhu65B8QiLpxh0nIZ5GEB4zIuO8 0TY9Dyg== X-Google-Smtp-Source: AGHT+IHxxGHFnZbGRJOj5pbPEN5j3alf5RGMsd1N+QgWecNmZ8YZqaF74kdm+E9dowdNjcGbbuCb7UzESS0R X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:690c:90:b0:62c:67f4:4c4 with SMTP id 00721157ae682-63224519561mr768417b3.7.1718303565979; Thu, 13 Jun 2024 11:32:45 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:22 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-7-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 6/8] perf util: Make util its own library From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113250_469649_378C5A8C X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Make the util directory into its own library. This is done to avoid compiling code twice, once for the perf tool and once for the perf python module. For convenience: arch/common.c scripts/perl/Perf-Trace-Util/Context.c scripts/python/Perf-Trace-Util/Context.c are made part of this library. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Build | 5 +- tools/perf/Makefile.perf | 12 +- tools/perf/arch/Build | 3 +- tools/perf/arch/arm/Build | 2 +- tools/perf/arch/arm/util/Build | 10 +- tools/perf/arch/arm64/Build | 2 +- tools/perf/arch/arm64/util/Build | 20 +- tools/perf/arch/csky/Build | 2 +- tools/perf/arch/csky/util/Build | 6 +- tools/perf/arch/loongarch/Build | 2 +- tools/perf/arch/loongarch/util/Build | 8 +- tools/perf/arch/mips/Build | 2 +- tools/perf/arch/mips/util/Build | 6 +- tools/perf/arch/powerpc/Build | 2 +- tools/perf/arch/powerpc/util/Build | 24 +- tools/perf/arch/riscv/Build | 2 +- tools/perf/arch/riscv/util/Build | 8 +- tools/perf/arch/s390/Build | 2 +- tools/perf/arch/s390/util/Build | 16 +- tools/perf/arch/sh/Build | 2 +- tools/perf/arch/sh/util/Build | 2 +- tools/perf/arch/sparc/Build | 2 +- tools/perf/arch/sparc/util/Build | 2 +- tools/perf/arch/x86/Build | 2 +- tools/perf/arch/x86/util/Build | 42 +- tools/perf/scripts/Build | 4 +- tools/perf/scripts/perl/Perf-Trace-Util/Build | 2 +- .../perf/scripts/python/Perf-Trace-Util/Build | 2 +- tools/perf/util/Build | 394 +++++++++--------- tools/perf/util/arm-spe-decoder/Build | 2 +- tools/perf/util/cs-etm-decoder/Build | 2 +- tools/perf/util/hisi-ptt-decoder/Build | 2 +- tools/perf/util/intel-pt-decoder/Build | 2 +- tools/perf/util/perf-regs-arch/Build | 18 +- tools/perf/util/scripting-engines/Build | 4 +- 35 files changed, 315 insertions(+), 303 deletions(-) diff --git a/tools/perf/Build b/tools/perf/Build index 2787f5630ff7..1d4957957d75 100644 --- a/tools/perf/Build +++ b/tools/perf/Build @@ -53,11 +53,12 @@ CFLAGS_builtin-trace.o += -DSTRACE_GROUPS_DIR="BUILD_STR($(STRACE_GROUPS_DIR_ CFLAGS_builtin-report.o += -DTIPDIR="BUILD_STR($(tipdir_SQ))" CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)" -perf-y += util/ +perf-util-y += util/ +perf-util-y += arch/ perf-y += arch/ perf-test-y += arch/ perf-ui-y += ui/ -perf-y += scripts/ +perf-util-y += scripts/ gtk-y += ui/gtk/ diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 4a3c000b9845..ff03f0431013 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -434,6 +434,9 @@ LIBPERF_TEST := $(OUTPUT)libperf-test.a LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o LIBPERF_UI := $(OUTPUT)libperf-ui.a +LIBPERF_UTIL_IN := $(OUTPUT)perf-util-in.o +LIBPERF_UTIL := $(OUTPUT)libperf-util.a + LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a @@ -441,7 +444,8 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) ifdef LIBBPF_STATIC PERFLIBS += $(LIBBPF) endif -PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS) +PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPERF_UTIL) +PERFLIBS += $(LIBPMU_EVENTS) # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If @@ -761,6 +765,12 @@ $(LIBPERF_UI_IN): FORCE prepare $(LIBPERF_UI): $(LIBPERF_UI_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< +$(LIBPERF_UTIL_IN): FORCE prepare + $(Q)$(MAKE) $(build)=perf-util + +$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN) + $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< + $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ $(PERF_IN) $(LIBS) -o $@ diff --git a/tools/perf/arch/Build b/tools/perf/arch/Build index 6dd68c17924c..237321fcb45b 100644 --- a/tools/perf/arch/Build +++ b/tools/perf/arch/Build @@ -1,3 +1,4 @@ -perf-y += common.o +perf-util-y += common.o perf-y += $(SRCARCH)/ perf-test-y += $(SRCARCH)/ +perf-util-y += $(SRCARCH)/ diff --git a/tools/perf/arch/arm/Build b/tools/perf/arch/arm/Build index 6b4fdec52122..317425aa3712 100644 --- a/tools/perf/arch/arm/Build +++ b/tools/perf/arch/arm/Build @@ -1,2 +1,2 @@ -perf-y += util/ +perf-util-y += util/ perf-test-$(CONFIG_DWARF_UNWIND) += tests/ diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index 37fc63708966..e6dd7cd79ebd 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -1,8 +1,8 @@ -perf-y += perf_regs.o +perf-util-y += perf_regs.o -perf-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o -perf-$(CONFIG_AUXTRACE) += pmu.o auxtrace.o cs-etm.o +perf-util-$(CONFIG_AUXTRACE) += pmu.o auxtrace.o cs-etm.o diff --git a/tools/perf/arch/arm64/Build b/tools/perf/arch/arm64/Build index 58b2d965ed86..12ebc65ea7a3 100644 --- a/tools/perf/arch/arm64/Build +++ b/tools/perf/arch/arm64/Build @@ -1,2 +1,2 @@ -perf-y += util/ +perf-util-y += util/ perf-test-y += tests/ diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build index 78ef7115be3d..343ef7589a77 100644 --- a/tools/perf/arch/arm64/util/Build +++ b/tools/perf/arch/arm64/util/Build @@ -1,14 +1,14 @@ -perf-y += header.o -perf-y += machine.o -perf-y += perf_regs.o -perf-y += tsc.o -perf-y += pmu.o -perf-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-y += header.o +perf-util-y += machine.o +perf-util-y += perf_regs.o +perf-util-y += tsc.o +perf-util-y += pmu.o +perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o -perf-$(CONFIG_AUXTRACE) += ../../arm/util/pmu.o \ +perf-util-$(CONFIG_AUXTRACE) += ../../arm/util/pmu.o \ ../../arm/util/auxtrace.o \ ../../arm/util/cs-etm.o \ arm-spe.o mem-events.o hisi-ptt.o diff --git a/tools/perf/arch/csky/Build b/tools/perf/arch/csky/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/csky/Build +++ b/tools/perf/arch/csky/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Build index 7d3050134ae0..99d83f41bf43 100644 --- a/tools/perf/arch/csky/util/Build +++ b/tools/perf/arch/csky/util/Build @@ -1,4 +1,4 @@ -perf-y += perf_regs.o +perf-util-y += perf_regs.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/loongarch/Build b/tools/perf/arch/loongarch/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/loongarch/Build +++ b/tools/perf/arch/loongarch/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/loongarch/util/Build b/tools/perf/arch/loongarch/util/Build index d776125a2d06..2386ebbf6dd4 100644 --- a/tools/perf/arch/loongarch/util/Build +++ b/tools/perf/arch/loongarch/util/Build @@ -1,5 +1,5 @@ -perf-y += perf_regs.o +perf-util-y += perf_regs.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/mips/Build b/tools/perf/arch/mips/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/mips/Build +++ b/tools/perf/arch/mips/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Build index 51c8900a9a10..e4644f1e68a0 100644 --- a/tools/perf/arch/mips/util/Build +++ b/tools/perf/arch/mips/util/Build @@ -1,3 +1,3 @@ -perf-y += perf_regs.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o +perf-util-y += perf_regs.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o diff --git a/tools/perf/arch/powerpc/Build b/tools/perf/arch/powerpc/Build index 58b2d965ed86..12ebc65ea7a3 100644 --- a/tools/perf/arch/powerpc/Build +++ b/tools/perf/arch/powerpc/Build @@ -1,2 +1,2 @@ -perf-y += util/ +perf-util-y += util/ perf-test-y += tests/ diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build index 1d323f3a3322..6c588ecdf3bd 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build @@ -1,14 +1,14 @@ -perf-y += header.o -perf-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o -perf-y += perf_regs.o -perf-y += mem-events.o -perf-y += pmu.o -perf-y += sym-handling.o -perf-y += evsel.o -perf-y += event.o +perf-util-y += header.o +perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o +perf-util-y += perf_regs.o +perf-util-y += mem-events.o +perf-util-y += pmu.o +perf-util-y += sym-handling.o +perf-util-y += evsel.o +perf-util-y += event.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_DWARF) += skip-callchain-idx.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_DWARF) += skip-callchain-idx.o -perf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/riscv/Build b/tools/perf/arch/riscv/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/riscv/Build +++ b/tools/perf/arch/riscv/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/riscv/util/Build b/tools/perf/arch/riscv/util/Build index 603dbb5ae4dc..65ec3c66a375 100644 --- a/tools/perf/arch/riscv/util/Build +++ b/tools/perf/arch/riscv/util/Build @@ -1,5 +1,5 @@ -perf-y += perf_regs.o -perf-y += header.o +perf-util-y += perf_regs.o +perf-util-y += header.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/s390/Build b/tools/perf/arch/s390/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/s390/Build +++ b/tools/perf/arch/s390/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build index fa66f15a14ec..1ac830030ff3 100644 --- a/tools/perf/arch/s390/util/Build +++ b/tools/perf/arch/s390/util/Build @@ -1,11 +1,11 @@ -perf-y += header.o -perf-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o -perf-y += perf_regs.o +perf-util-y += header.o +perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o +perf-util-y += perf_regs.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o -perf-y += machine.o -perf-y += pmu.o +perf-util-y += machine.o +perf-util-y += pmu.o -perf-$(CONFIG_AUXTRACE) += auxtrace.o +perf-util-$(CONFIG_AUXTRACE) += auxtrace.o diff --git a/tools/perf/arch/sh/Build b/tools/perf/arch/sh/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/sh/Build +++ b/tools/perf/arch/sh/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/sh/util/Build b/tools/perf/arch/sh/util/Build index e813e618954b..32f44fc4ab98 100644 --- a/tools/perf/arch/sh/util/Build +++ b/tools/perf/arch/sh/util/Build @@ -1 +1 @@ -perf-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o diff --git a/tools/perf/arch/sparc/Build b/tools/perf/arch/sparc/Build index e4e5f33c84d8..e63eabc2c8f4 100644 --- a/tools/perf/arch/sparc/Build +++ b/tools/perf/arch/sparc/Build @@ -1 +1 @@ -perf-y += util/ +perf-util-y += util/ diff --git a/tools/perf/arch/sparc/util/Build b/tools/perf/arch/sparc/util/Build index e813e618954b..32f44fc4ab98 100644 --- a/tools/perf/arch/sparc/util/Build +++ b/tools/perf/arch/sparc/util/Build @@ -1 +1 @@ -perf-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o diff --git a/tools/perf/arch/x86/Build b/tools/perf/arch/x86/Build index 132cf8beaca2..87d057491343 100644 --- a/tools/perf/arch/x86/Build +++ b/tools/perf/arch/x86/Build @@ -1,4 +1,4 @@ -perf-y += util/ +perf-util-y += util/ perf-test-y += tests/ ifdef SHELLCHECK diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build index 005907cb97d8..2607ed5c4296 100644 --- a/tools/perf/arch/x86/util/Build +++ b/tools/perf/arch/x86/util/Build @@ -1,24 +1,24 @@ -perf-y += header.o -perf-y += tsc.o -perf-y += pmu.o -perf-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o -perf-y += perf_regs.o -perf-y += topdown.o -perf-y += machine.o -perf-y += event.o -perf-y += evlist.o -perf-y += mem-events.o -perf-y += evsel.o -perf-y += iostat.o -perf-y += env.o +perf-util-y += header.o +perf-util-y += tsc.o +perf-util-y += pmu.o +perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o +perf-util-y += perf_regs.o +perf-util-y += topdown.o +perf-util-y += machine.o +perf-util-y += event.o +perf-util-y += evlist.o +perf-util-y += mem-events.o +perf-util-y += evsel.o +perf-util-y += iostat.o +perf-util-y += env.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_BPF_PROLOGUE) += dwarf-regs.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_BPF_PROLOGUE) += dwarf-regs.o -perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o -perf-$(CONFIG_AUXTRACE) += auxtrace.o -perf-$(CONFIG_AUXTRACE) += archinsn.o -perf-$(CONFIG_AUXTRACE) += intel-pt.o -perf-$(CONFIG_AUXTRACE) += intel-bts.o +perf-util-$(CONFIG_AUXTRACE) += auxtrace.o +perf-util-$(CONFIG_AUXTRACE) += archinsn.o +perf-util-$(CONFIG_AUXTRACE) += intel-pt.o +perf-util-$(CONFIG_AUXTRACE) += intel-bts.o diff --git a/tools/perf/scripts/Build b/tools/perf/scripts/Build index 7d8e2e57faac..46f0c6f76dbf 100644 --- a/tools/perf/scripts/Build +++ b/tools/perf/scripts/Build @@ -1,4 +1,4 @@ ifeq ($(CONFIG_LIBTRACEEVENT),y) - perf-$(CONFIG_LIBPERL) += perl/Perf-Trace-Util/ + perf-util-$(CONFIG_LIBPERL) += perl/Perf-Trace-Util/ endif -perf-$(CONFIG_LIBPYTHON) += python/Perf-Trace-Util/ +perf-util-$(CONFIG_LIBPYTHON) += python/Perf-Trace-Util/ diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Build b/tools/perf/scripts/perl/Perf-Trace-Util/Build index cc76be005d5e..9b0e5a8b5070 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/Build +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Build @@ -1,4 +1,4 @@ -perf-y += Context.o +perf-util-y += Context.o CFLAGS_Context.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-switch-enum CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs -Wno-undef diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Build b/tools/perf/scripts/python/Perf-Trace-Util/Build index 5b0b5ff7e14a..be3710c61320 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/Build +++ b/tools/perf/scripts/python/Perf-Trace-Util/Build @@ -1,4 +1,4 @@ -perf-y += Context.o +perf-util-y += Context.o # -Wno-declaration-after-statement: The python headers have mixed code with declarations (decls after asserts, for instance) CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-declaration-after-statement diff --git a/tools/perf/util/Build b/tools/perf/util/Build index da64efd8718f..0f18fe81ef0b 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -1,181 +1,181 @@ include $(srctree)/tools/scripts/Makefile.include include $(srctree)/tools/scripts/utilities.mak -perf-y += arm64-frame-pointer-unwind-support.o -perf-y += addr_location.o -perf-y += annotate.o -perf-y += block-info.o -perf-y += block-range.o -perf-y += build-id.o -perf-y += cacheline.o -perf-y += config.o -perf-y += copyfile.o -perf-y += ctype.o -perf-y += db-export.o -perf-y += disasm.o -perf-y += env.o -perf-y += event.o -perf-y += evlist.o -perf-y += sideband_evlist.o -perf-y += evsel.o -perf-y += evsel_fprintf.o -perf-y += perf_event_attr_fprintf.o -perf-y += evswitch.o -perf-y += find_bit.o -perf-y += get_current_dir_name.o -perf-y += levenshtein.o -perf-y += mmap.o -perf-y += memswap.o -perf-y += parse-events.o -perf-y += print-events.o -perf-y += tracepoint.o -perf-y += perf_regs.o -perf-y += perf-regs-arch/ -perf-y += path.o -perf-y += print_binary.o -perf-y += print_insn.o -perf-y += rlimit.o -perf-y += argv_split.o -perf-y += rbtree.o -perf-y += libstring.o -perf-y += bitmap.o -perf-y += hweight.o -perf-y += smt.o -perf-y += strbuf.o -perf-y += string.o -perf-y += strlist.o -perf-y += strfilter.o -perf-y += top.o -perf-y += usage.o -perf-y += dso.o -perf-y += dsos.o -perf-y += symbol.o -perf-y += symbol_fprintf.o -perf-y += map_symbol.o -perf-y += color.o -perf-y += color_config.o -perf-y += metricgroup.o -perf-y += header.o -perf-y += callchain.o -perf-y += values.o -perf-y += debug.o -perf-y += fncache.o -perf-y += machine.o -perf-y += map.o -perf-y += maps.o -perf-y += pstack.o -perf-y += session.o -perf-y += sample-raw.o -perf-y += s390-sample-raw.o -perf-y += amd-sample-raw.o -perf-$(CONFIG_TRACE) += syscalltbl.o -perf-y += ordered-events.o -perf-y += namespaces.o -perf-y += comm.o -perf-y += thread.o -perf-y += threads.o -perf-y += thread_map.o -perf-y += parse-events-flex.o -perf-y += parse-events-bison.o -perf-y += pmu.o -perf-y += pmus.o -perf-y += pmu-flex.o -perf-y += pmu-bison.o -perf-y += svghelper.o -perf-$(CONFIG_LIBTRACEEVENT) += trace-event-info.o -perf-y += trace-event-scripting.o -perf-$(CONFIG_LIBTRACEEVENT) += trace-event.o -perf-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o -perf-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o -perf-y += sort.o -perf-y += hist.o -perf-y += util.o -perf-y += cpumap.o -perf-y += affinity.o -perf-y += cputopo.o -perf-y += cgroup.o -perf-y += target.o -perf-y += rblist.o -perf-y += intlist.o -perf-y += vdso.o -perf-y += counts.o -perf-y += stat.o -perf-y += stat-shadow.o -perf-y += stat-display.o -perf-y += perf_api_probe.o -perf-y += record.o -perf-y += srcline.o -perf-y += srccode.o -perf-y += synthetic-events.o -perf-y += data.o -perf-y += tsc.o -perf-y += cloexec.o -perf-y += call-path.o -perf-y += rwsem.o -perf-y += thread-stack.o -perf-y += spark.o -perf-y += topdown.o -perf-y += iostat.o -perf-y += stream.o -perf-$(CONFIG_AUXTRACE) += auxtrace.o -perf-$(CONFIG_AUXTRACE) += intel-pt-decoder/ -perf-$(CONFIG_AUXTRACE) += intel-pt.o -perf-$(CONFIG_AUXTRACE) += intel-bts.o -perf-$(CONFIG_AUXTRACE) += arm-spe.o -perf-$(CONFIG_AUXTRACE) += arm-spe-decoder/ -perf-$(CONFIG_AUXTRACE) += hisi-ptt.o -perf-$(CONFIG_AUXTRACE) += hisi-ptt-decoder/ -perf-$(CONFIG_AUXTRACE) += s390-cpumsf.o +perf-util-y += arm64-frame-pointer-unwind-support.o +perf-util-y += addr_location.o +perf-util-y += annotate.o +perf-util-y += block-info.o +perf-util-y += block-range.o +perf-util-y += build-id.o +perf-util-y += cacheline.o +perf-util-y += config.o +perf-util-y += copyfile.o +perf-util-y += ctype.o +perf-util-y += db-export.o +perf-util-y += disasm.o +perf-util-y += env.o +perf-util-y += event.o +perf-util-y += evlist.o +perf-util-y += sideband_evlist.o +perf-util-y += evsel.o +perf-util-y += evsel_fprintf.o +perf-util-y += perf_event_attr_fprintf.o +perf-util-y += evswitch.o +perf-util-y += find_bit.o +perf-util-y += get_current_dir_name.o +perf-util-y += levenshtein.o +perf-util-y += mmap.o +perf-util-y += memswap.o +perf-util-y += parse-events.o +perf-util-y += print-events.o +perf-util-y += tracepoint.o +perf-util-y += perf_regs.o +perf-util-y += perf-regs-arch/ +perf-util-y += path.o +perf-util-y += print_binary.o +perf-util-y += print_insn.o +perf-util-y += rlimit.o +perf-util-y += argv_split.o +perf-util-y += rbtree.o +perf-util-y += libstring.o +perf-util-y += bitmap.o +perf-util-y += hweight.o +perf-util-y += smt.o +perf-util-y += strbuf.o +perf-util-y += string.o +perf-util-y += strlist.o +perf-util-y += strfilter.o +perf-util-y += top.o +perf-util-y += usage.o +perf-util-y += dso.o +perf-util-y += dsos.o +perf-util-y += symbol.o +perf-util-y += symbol_fprintf.o +perf-util-y += map_symbol.o +perf-util-y += color.o +perf-util-y += color_config.o +perf-util-y += metricgroup.o +perf-util-y += header.o +perf-util-y += callchain.o +perf-util-y += values.o +perf-util-y += debug.o +perf-util-y += fncache.o +perf-util-y += machine.o +perf-util-y += map.o +perf-util-y += maps.o +perf-util-y += pstack.o +perf-util-y += session.o +perf-util-y += sample-raw.o +perf-util-y += s390-sample-raw.o +perf-util-y += amd-sample-raw.o +perf-util-$(CONFIG_TRACE) += syscalltbl.o +perf-util-y += ordered-events.o +perf-util-y += namespaces.o +perf-util-y += comm.o +perf-util-y += thread.o +perf-util-y += threads.o +perf-util-y += thread_map.o +perf-util-y += parse-events-flex.o +perf-util-y += parse-events-bison.o +perf-util-y += pmu.o +perf-util-y += pmus.o +perf-util-y += pmu-flex.o +perf-util-y += pmu-bison.o +perf-util-y += svghelper.o +perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-info.o +perf-util-y += trace-event-scripting.o +perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event.o +perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o +perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o +perf-util-y += sort.o +perf-util-y += hist.o +perf-util-y += util.o +perf-util-y += cpumap.o +perf-util-y += affinity.o +perf-util-y += cputopo.o +perf-util-y += cgroup.o +perf-util-y += target.o +perf-util-y += rblist.o +perf-util-y += intlist.o +perf-util-y += vdso.o +perf-util-y += counts.o +perf-util-y += stat.o +perf-util-y += stat-shadow.o +perf-util-y += stat-display.o +perf-util-y += perf_api_probe.o +perf-util-y += record.o +perf-util-y += srcline.o +perf-util-y += srccode.o +perf-util-y += synthetic-events.o +perf-util-y += data.o +perf-util-y += tsc.o +perf-util-y += cloexec.o +perf-util-y += call-path.o +perf-util-y += rwsem.o +perf-util-y += thread-stack.o +perf-util-y += spark.o +perf-util-y += topdown.o +perf-util-y += iostat.o +perf-util-y += stream.o +perf-util-$(CONFIG_AUXTRACE) += auxtrace.o +perf-util-$(CONFIG_AUXTRACE) += intel-pt-decoder/ +perf-util-$(CONFIG_AUXTRACE) += intel-pt.o +perf-util-$(CONFIG_AUXTRACE) += intel-bts.o +perf-util-$(CONFIG_AUXTRACE) += arm-spe.o +perf-util-$(CONFIG_AUXTRACE) += arm-spe-decoder/ +perf-util-$(CONFIG_AUXTRACE) += hisi-ptt.o +perf-util-$(CONFIG_AUXTRACE) += hisi-ptt-decoder/ +perf-util-$(CONFIG_AUXTRACE) += s390-cpumsf.o ifdef CONFIG_LIBOPENCSD -perf-$(CONFIG_AUXTRACE) += cs-etm.o -perf-$(CONFIG_AUXTRACE) += cs-etm-decoder/ +perf-util-$(CONFIG_AUXTRACE) += cs-etm.o +perf-util-$(CONFIG_AUXTRACE) += cs-etm-decoder/ endif -perf-$(CONFIG_AUXTRACE) += cs-etm-base.o - -perf-y += parse-branch-options.o -perf-y += dump-insn.o -perf-y += parse-regs-options.o -perf-y += parse-sublevel-options.o -perf-y += term.o -perf-y += help-unknown-cmd.o -perf-y += dlfilter.o -perf-y += mem-events.o -perf-y += mem-info.o -perf-y += vsprintf.o -perf-y += units.o -perf-y += time-utils.o -perf-y += expr-flex.o -perf-y += expr-bison.o -perf-y += expr.o -perf-y += branch.o -perf-y += mem2node.o -perf-y += clockid.o -perf-y += list_sort.o -perf-y += mutex.o -perf-y += sharded_mutex.o - -perf-$(CONFIG_LIBBPF) += bpf_map.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o -perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o +perf-util-$(CONFIG_AUXTRACE) += cs-etm-base.o + +perf-util-y += parse-branch-options.o +perf-util-y += dump-insn.o +perf-util-y += parse-regs-options.o +perf-util-y += parse-sublevel-options.o +perf-util-y += term.o +perf-util-y += help-unknown-cmd.o +perf-util-y += dlfilter.o +perf-util-y += mem-events.o +perf-util-y += mem-info.o +perf-util-y += vsprintf.o +perf-util-y += units.o +perf-util-y += time-utils.o +perf-util-y += expr-flex.o +perf-util-y += expr-bison.o +perf-util-y += expr.o +perf-util-y += branch.o +perf-util-y += mem2node.o +perf-util-y += clockid.o +perf-util-y += list_sort.o +perf-util-y += mutex.o +perf-util-y += sharded_mutex.o + +perf-util-$(CONFIG_LIBBPF) += bpf_map.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o +perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o ifeq ($(CONFIG_LIBTRACEEVENT),y) - perf-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o + perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o endif ifeq ($(CONFIG_LIBTRACEEVENT),y) - perf-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o - perf-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork_top.o + perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o + perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork_top.o endif -perf-$(CONFIG_LIBELF) += symbol-elf.o -perf-$(CONFIG_LIBELF) += probe-file.o -perf-$(CONFIG_LIBELF) += probe-event.o +perf-util-$(CONFIG_LIBELF) += symbol-elf.o +perf-util-$(CONFIG_LIBELF) += probe-file.o +perf-util-$(CONFIG_LIBELF) += probe-event.o ifdef CONFIG_LIBBPF_DYNAMIC hashmap := 1 @@ -185,60 +185,60 @@ ifndef CONFIG_LIBBPF endif ifdef hashmap -perf-y += hashmap.o +perf-util-y += hashmap.o endif ifndef CONFIG_LIBELF -perf-y += symbol-minimal.o +perf-util-y += symbol-minimal.o endif ifndef CONFIG_SETNS -perf-y += setns.o +perf-util-y += setns.o endif -perf-$(CONFIG_DWARF) += probe-finder.o -perf-$(CONFIG_DWARF) += dwarf-aux.o -perf-$(CONFIG_DWARF) += dwarf-regs.o -perf-$(CONFIG_DWARF) += debuginfo.o -perf-$(CONFIG_DWARF) += annotate-data.o +perf-util-$(CONFIG_DWARF) += probe-finder.o +perf-util-$(CONFIG_DWARF) += dwarf-aux.o +perf-util-$(CONFIG_DWARF) += dwarf-regs.o +perf-util-$(CONFIG_DWARF) += debuginfo.o +perf-util-$(CONFIG_DWARF) += annotate-data.o -perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o -perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o -perf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o -perf-$(CONFIG_LIBUNWIND_X86) += libunwind/x86_32.o -perf-$(CONFIG_LIBUNWIND_AARCH64) += libunwind/arm64.o +perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o +perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o +perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o +perf-util-$(CONFIG_LIBUNWIND_X86) += libunwind/x86_32.o +perf-util-$(CONFIG_LIBUNWIND_AARCH64) += libunwind/arm64.o ifeq ($(CONFIG_LIBTRACEEVENT),y) - perf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o + perf-util-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o endif -perf-y += data-convert-json.o +perf-util-y += data-convert-json.o -perf-y += scripting-engines/ +perf-util-y += scripting-engines/ -perf-$(CONFIG_ZLIB) += zlib.o -perf-$(CONFIG_LZMA) += lzma.o -perf-$(CONFIG_ZSTD) += zstd.o +perf-util-$(CONFIG_ZLIB) += zlib.o +perf-util-$(CONFIG_LZMA) += lzma.o +perf-util-$(CONFIG_ZSTD) += zstd.o -perf-$(CONFIG_LIBCAP) += cap.o +perf-util-$(CONFIG_LIBCAP) += cap.o -perf-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o -perf-y += demangle-ocaml.o -perf-y += demangle-java.o -perf-y += demangle-rust.o +perf-util-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o +perf-util-y += demangle-ocaml.o +perf-util-y += demangle-java.o +perf-util-y += demangle-rust.o ifdef CONFIG_JITDUMP -perf-$(CONFIG_LIBELF) += jitdump.o -perf-$(CONFIG_LIBELF) += genelf.o -perf-$(CONFIG_DWARF) += genelf_debug.o +perf-util-$(CONFIG_LIBELF) += jitdump.o +perf-util-$(CONFIG_LIBELF) += genelf.o +perf-util-$(CONFIG_DWARF) += genelf_debug.o endif -perf-y += perf-hooks.o +perf-util-y += perf-hooks.o -perf-$(CONFIG_LIBBPF) += bpf-event.o -perf-$(CONFIG_LIBBPF) += bpf-utils.o +perf-util-$(CONFIG_LIBBPF) += bpf-event.o +perf-util-$(CONFIG_LIBBPF) += bpf-utils.o -perf-$(CONFIG_LIBPFM4) += pfm.o +perf-util-$(CONFIG_LIBPFM4) += pfm.o CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))" @@ -403,4 +403,4 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(TEST_LOGS) +perf-util-y += $(TEST_LOGS) diff --git a/tools/perf/util/arm-spe-decoder/Build b/tools/perf/util/arm-spe-decoder/Build index f8dae13fc876..960062b3cb9e 100644 --- a/tools/perf/util/arm-spe-decoder/Build +++ b/tools/perf/util/arm-spe-decoder/Build @@ -1 +1 @@ -perf-$(CONFIG_AUXTRACE) += arm-spe-pkt-decoder.o arm-spe-decoder.o +perf-util-$(CONFIG_AUXTRACE) += arm-spe-pkt-decoder.o arm-spe-decoder.o diff --git a/tools/perf/util/cs-etm-decoder/Build b/tools/perf/util/cs-etm-decoder/Build index 216cb17a3322..056d665f7f88 100644 --- a/tools/perf/util/cs-etm-decoder/Build +++ b/tools/perf/util/cs-etm-decoder/Build @@ -1 +1 @@ -perf-$(CONFIG_AUXTRACE) += cs-etm-decoder.o +perf-util-$(CONFIG_AUXTRACE) += cs-etm-decoder.o diff --git a/tools/perf/util/hisi-ptt-decoder/Build b/tools/perf/util/hisi-ptt-decoder/Build index db3db8b75033..3298f7b7e308 100644 --- a/tools/perf/util/hisi-ptt-decoder/Build +++ b/tools/perf/util/hisi-ptt-decoder/Build @@ -1 +1 @@ -perf-$(CONFIG_AUXTRACE) += hisi-ptt-pkt-decoder.o +perf-util-$(CONFIG_AUXTRACE) += hisi-ptt-pkt-decoder.o diff --git a/tools/perf/util/intel-pt-decoder/Build b/tools/perf/util/intel-pt-decoder/Build index b41c2e9c6f88..30793d08c6d4 100644 --- a/tools/perf/util/intel-pt-decoder/Build +++ b/tools/perf/util/intel-pt-decoder/Build @@ -1,4 +1,4 @@ -perf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o intel-pt-log.o intel-pt-decoder.o +perf-util-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o intel-pt-log.o intel-pt-decoder.o inat_tables_script = $(srctree)/tools/arch/x86/tools/gen-insn-attr-x86.awk inat_tables_maps = $(srctree)/tools/arch/x86/lib/x86-opcode-map.txt diff --git a/tools/perf/util/perf-regs-arch/Build b/tools/perf/util/perf-regs-arch/Build index d9d596d330a7..be95402aa540 100644 --- a/tools/perf/util/perf-regs-arch/Build +++ b/tools/perf/util/perf-regs-arch/Build @@ -1,9 +1,9 @@ -perf-y += perf_regs_aarch64.o -perf-y += perf_regs_arm.o -perf-y += perf_regs_csky.o -perf-y += perf_regs_loongarch.o -perf-y += perf_regs_mips.o -perf-y += perf_regs_powerpc.o -perf-y += perf_regs_riscv.o -perf-y += perf_regs_s390.o -perf-y += perf_regs_x86.o +perf-util-y += perf_regs_aarch64.o +perf-util-y += perf_regs_arm.o +perf-util-y += perf_regs_csky.o +perf-util-y += perf_regs_loongarch.o +perf-util-y += perf_regs_mips.o +perf-util-y += perf_regs_powerpc.o +perf-util-y += perf_regs_riscv.o +perf-util-y += perf_regs_s390.o +perf-util-y += perf_regs_x86.o diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scripting-engines/Build index 586b94e90f4e..2282fe3772f3 100644 --- a/tools/perf/util/scripting-engines/Build +++ b/tools/perf/util/scripting-engines/Build @@ -1,7 +1,7 @@ ifeq ($(CONFIG_LIBTRACEEVENT),y) - perf-$(CONFIG_LIBPERL) += trace-event-perl.o + perf-util-$(CONFIG_LIBPERL) += trace-event-perl.o endif -perf-$(CONFIG_LIBPYTHON) += trace-event-python.o +perf-util-$(CONFIG_LIBPYTHON) += trace-event-python.o CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-switch-enum From patchwork Thu Jun 13 18:32:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B2F9C2BA15 for ; Thu, 13 Jun 2024 18:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RFFMZWmKlymYDO5A/b5mJ8qeCyNMh4RUSNt7e/tVCBQ=; b=IisKOsy3iB8UIK JhGdEWW7fjKfKIOc6sX36st6t0f+TaYnyDP2eD9VNuvdzWTjPIJi/cZUf3xu8MtG6V93eamw8y7b2 p489Qsnbo4GGB63KHXs3zOGCXDgaVzoRZOph8ve7/koTPjKeq5svYE723vQKMloCrjljSG3O0vbi8 I0uFqnCQfZnK0JEY3vkZJ8fN2l9NReS98Cb5/biYyI7XsieEeG8YLVcBqZ86Y319+ymLw3m5dT4bj VnK7GW0XOxqYR85K670AOhypopO4LURxlPy6nHJ2BTLtsecP7Y/hs3a6laXS6ufd0US9caHNNu3fV 9EMrq/nXpw7wvYRepClw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpGB-000000006RB-2VSc; Thu, 13 Jun 2024 18:33:19 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFk-0000000064s-0hmG for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:32:56 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6312dd49229so17834017b3.3 for ; Thu, 13 Jun 2024 11:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303568; x=1718908368; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ypeRfrMxrBCZjC38pT/Y3lCrmNLlrnXhQoa5V7sluF8=; b=QLLD1NfLcDYla9x0xio+a8FbPCTA7qclvFoyxLord+PUKhKM+Uj8pP09iZKqhvXlfz rzaSGgzMs35aQDaHAiZDon6g/X1e2QDpmhxkZwiDU7vAyASn0+N9rebEXwf5/ox77Zp3 T6ODYIux+fIzrgdmPk8BOg2KPBgitRBB3IiCnavpe6DtPkZKVb3pf7Y8+43hT6DjX6tF d8tlC7awy8+TbnKDcMxlmjsyW+owELyFDBPHy3SHYL/RGBE8kHam9t/ZSzZCrPDFxyKg tF3YfwytUOlUZG//hzXjrZiZLMtKVBPl9yJz88lESpEW1Zzq3TjduJ5XIRuiWamTdyba /dnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303568; x=1718908368; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ypeRfrMxrBCZjC38pT/Y3lCrmNLlrnXhQoa5V7sluF8=; b=vr0ZcHS8rxkdVKNErI3TB3bnq9TBVz6YupfcgkgoWvKnpUygdDfn5sxHNKYRW3CUW+ 30xUk/6dR55QxJIrOzkgHo4w/sQMIRoWipbcsUT6GiTzWavlrjcZs85ygStxJz4aF+8J 9DNXHvjoGRiFcB/eWPkJdrmI1D2m95l1B2Y7dOZ/drsIQSEkEXEbKujFRFes5ug/X/vN MCk4c4fvjMOab3GiALnvhIbnL/SB8XxWwf2TJYc1ErcVRZjaqyFTNZhVlSo2cu5dDu04 Vzell8Cm5A71dm/f6V3IYNDoiVvi4xe7vKbYrTx09EITj/SBVZjJqMZxPXPMXNZXNVKH p5SA== X-Forwarded-Encrypted: i=1; AJvYcCUkGN+ozek5UavGHWd/+M7HDSKy8H6c18HUNFm+kgHzJC0oIuut2YtPR59FkruqNF0AiBRjYIo0Qb9NT42EVVfJmlvE2i3khEiATvim0DYS X-Gm-Message-State: AOJu0YzBc78Xr0xVL9Rp2R7UI49swfF2t985BElVzmf7KXAZ8uORxoQp M45UH8tJat1RqOm7AUgt2u73AYH0PJ39iE5rnqQFqlQvNECsNEWcS4MA+gp3wH5nqObkGey2qZ7 xu3yPcQ== X-Google-Smtp-Source: AGHT+IGlc1VucCCgy50miWVLZiut4arjTaID5BWG1ljKHjmf/rA+ONWHWFD8IyOXY8b5oXq3ivlu+bq34cZj X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:690c:6503:b0:62c:fa1a:21d2 with SMTP id 00721157ae682-6322206f2d0mr747867b3.1.1718303568410; Thu, 13 Jun 2024 11:32:48 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:23 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-8-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 7/8] perf python: Switch module to linking libraries from building source From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113252_511215_40FEA9A8 X-CRM114-Status: GOOD ( 22.65 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org setup.py was building most perf sources causing setup.py to mimic the Makefile logic as well as flex/bison code to be stubbed out, due to complexity building. By using libraries fewer functions are stubbed out, the build is faster and the Makefile logic is reused which should simplify updating. The libraries are passed through LDFLAGS to avoid complexity in python. Force the -fPIC flag for libbpf.a to ensure it is suitable for linking into the perf python module. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Makefile.config | 5 + tools/perf/Makefile.perf | 6 +- tools/perf/util/python.c | 271 ++++++++++++++----------------------- tools/perf/util/setup.py | 33 +---- 4 files changed, 110 insertions(+), 205 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 7f1e016a9253..639be696f597 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -910,6 +910,11 @@ else endif CFLAGS += -DHAVE_LIBPYTHON_SUPPORT $(call detected,CONFIG_LIBPYTHON) + ifeq ($(filter -fPIC,$(CFLAGS)),) + # Building a shared library requires position independent code. + CFLAGS += -fPIC + CXXFLAGS += -fPIC + endif endif endif endif diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index ff03f0431013..4a1a9f09fa09 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -715,9 +715,9 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) # Create python binding output directory if not already present $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') -$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) $(LIBSUBCMD) +$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(PERFLIBS) $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ - CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \ + CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS)' \ $(PYTHON_WORD) util/setup.py \ --quiet build_ext; \ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ @@ -933,7 +933,7 @@ $(LIBAPI)-clean: $(LIBBPF): FORCE | $(LIBBPF_OUTPUT) $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \ O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \ - $@ install_headers + EXTRA_CFLAGS="-fPIC" $@ install_headers $(LIBBPF)-clean: $(call QUIET_CLEAN, libbpf) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 0aeb97c11c03..3be882b2e845 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -10,21 +10,19 @@ #endif #include #include "evlist.h" -#include "callchain.h" #include "evsel.h" #include "event.h" #include "print_binary.h" #include "thread_map.h" #include "trace-event.h" #include "mmap.h" -#include "stat.h" -#include "metricgroup.h" #include "util/bpf-filter.h" #include "util/env.h" -#include "util/pmu.h" -#include "util/pmus.h" +#include "util/kvm-stat.h" +#include "util/kwork.h" +#include "util/lock-contention.h" #include -#include "util.h" +#include "../builtin.h" #if PY_MAJOR_VERSION < 3 #define _PyUnicode_FromString(arg) \ @@ -50,166 +48,6 @@ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #endif -/* - * Avoid bringing in event parsing. - */ -int parse_event(struct evlist *evlist __maybe_unused, const char *str __maybe_unused) -{ - return 0; -} - -/* - * Provide these two so that we don't have to link against callchain.c and - * start dragging hist.c, etc. - */ -struct callchain_param callchain_param; - -int parse_callchain_record(const char *arg __maybe_unused, - struct callchain_param *param __maybe_unused) -{ - return 0; -} - -/* - * Add these not to drag util/env.c - */ -struct perf_env perf_env; - -const char *perf_env__cpuid(struct perf_env *env __maybe_unused) -{ - return NULL; -} - -// This one is a bit easier, wouldn't drag too much, but leave it as a stub we need it here -const char *perf_env__arch(struct perf_env *env __maybe_unused) -{ - return NULL; -} - -/* - * These ones are needed not to drag the PMU bandwagon, jevents generated - * pmu_sys_event_tables, etc and evsel__find_pmu() is used so far just for - * doing per PMU perf_event_attr.exclude_guest handling, not really needed, so - * far, for the perf python binding known usecases, revisit if this become - * necessary. - */ -struct perf_pmu *evsel__find_pmu(const struct evsel *evsel __maybe_unused) -{ - return NULL; -} - -int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, ...) -{ - return EOF; -} - -const char *perf_pmu__name_from_config(struct perf_pmu *pmu __maybe_unused, u64 config __maybe_unused) -{ - return NULL; -} - -struct perf_pmu *perf_pmus__find_by_type(unsigned int type __maybe_unused) -{ - return NULL; -} - -int perf_pmus__num_core_pmus(void) -{ - return 1; -} - -bool evsel__is_aux_event(const struct evsel *evsel __maybe_unused) -{ - return false; -} - -bool perf_pmus__supports_extended_type(void) -{ - return false; -} - -/* - * Add this one here not to drag util/metricgroup.c - */ -int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp, - struct rblist *new_metric_events, - struct rblist *old_metric_events) -{ - return 0; -} - -/* - * Add this one here not to drag util/trace-event-info.c - */ -char *tracepoint_id_to_name(u64 config) -{ - return NULL; -} - -/* - * XXX: All these evsel destructors need some better mechanism, like a linked - * list of destructors registered when the relevant code indeed is used instead - * of having more and more calls in perf_evsel__delete(). -- acme - * - * For now, add some more: - * - * Not to drag the BPF bandwagon... - */ -void bpf_counter__destroy(struct evsel *evsel); -int bpf_counter__install_pe(struct evsel *evsel, int cpu, int fd); -int bpf_counter__disable(struct evsel *evsel); - -void bpf_counter__destroy(struct evsel *evsel __maybe_unused) -{ -} - -int bpf_counter__install_pe(struct evsel *evsel __maybe_unused, int cpu __maybe_unused, int fd __maybe_unused) -{ - return 0; -} - -int bpf_counter__disable(struct evsel *evsel __maybe_unused) -{ - return 0; -} - -// not to drag util/bpf-filter.c -#ifdef HAVE_BPF_SKEL -int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused) -{ - return 0; -} - -int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused) -{ - return 0; -} -#endif - -/* - * Support debug printing even though util/debug.c is not linked. That means - * implementing 'verbose' and 'eprintf'. - */ -int verbose; -int debug_kmaps; -int debug_peo_args; - -int eprintf(int level, int var, const char *fmt, ...); - -int eprintf(int level, int var, const char *fmt, ...) -{ - va_list args; - int ret = 0; - - if (var >= level) { - va_start(args, fmt); - ret = vfprintf(stderr, fmt, args); - va_end(args); - } - - return ret; -} - /* Define PyVarObject_HEAD_INIT for python 2.5 */ #ifndef PyVarObject_HEAD_INIT # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, @@ -1510,15 +1348,102 @@ PyMODINIT_FUNC PyInit_perf(void) #endif } -/* - * Dummy, to avoid dragging all the test_attr infrastructure in the python - * binding. - */ -void test_attr__open(struct perf_event_attr *attr, pid_t pid, struct perf_cpu cpu, - int fd, int group_fd, unsigned long flags) + +/* The following are stubs to avoid dragging in builtin-* objects. */ +/* TODO: move the code out of the builtin-* file into util. */ + +unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH; + +bool kvm_entry_event(struct evsel *evsel __maybe_unused) { + return false; +} + +bool kvm_exit_event(struct evsel *evsel __maybe_unused) +{ + return false; +} + +bool exit_event_begin(struct evsel *evsel __maybe_unused, + struct perf_sample *sample __maybe_unused, + struct event_key *key __maybe_unused) +{ + return false; +} + +bool exit_event_end(struct evsel *evsel __maybe_unused, + struct perf_sample *sample __maybe_unused, + struct event_key *key __maybe_unused) +{ + return false; +} + +void exit_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, + struct event_key *key __maybe_unused, + char *decode __maybe_unused) +{ +} + +int find_scripts(char **scripts_array __maybe_unused, char **scripts_path_array __maybe_unused, + int num __maybe_unused, int pathlen __maybe_unused) +{ + return -1; +} + +void perf_stat__set_no_csv_summary(int set __maybe_unused) +{ +} + +void perf_stat__set_big_num(int set __maybe_unused) +{ +} + +int script_spec_register(const char *spec __maybe_unused, struct scripting_ops *ops __maybe_unused) +{ + return -1; +} + +arch_syscalls__strerrno_t *arch_syscalls__strerrno_function(const char *arch __maybe_unused) +{ + return NULL; +} + +struct kwork_work *perf_kwork_add_work(struct perf_kwork *kwork __maybe_unused, + struct kwork_class *class __maybe_unused, + struct kwork_work *key __maybe_unused) +{ + return NULL; +} + +void script_fetch_insn(struct perf_sample *sample __maybe_unused, + struct thread *thread __maybe_unused, + struct machine *machine __maybe_unused) +{ +} + +int perf_sample__sprintf_flags(u32 flags __maybe_unused, char *str __maybe_unused, + size_t sz __maybe_unused) +{ + return -1; +} + +bool match_callstack_filter(struct machine *machine __maybe_unused, u64 *callstack __maybe_unused) +{ + return false; +} + +struct lock_stat *lock_stat_find(u64 addr __maybe_unused) +{ + return NULL; +} + +struct lock_stat *lock_stat_findnew(u64 addr __maybe_unused, const char *name __maybe_unused, + int flags __maybe_unused) +{ + return NULL; } -void evlist__free_stats(struct evlist *evlist) +int cmd_inject(int argc __maybe_unused, const char *argv[] __maybe_unused) { + return -1; } diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 3107f5aa8c9a..142e9d447ce7 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -60,7 +60,7 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) -cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls', '-DPYTHON_PERF' ] +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ] if cc_is_clang: cflags += ["-Wno-unused-command-line-argument" ] else: @@ -72,36 +72,11 @@ cflags += [ "-Wno-declaration-after-statement" ] src_perf = getenv('srctree') + '/tools/perf' build_lib = getenv('PYTHON_EXTBUILD_LIB') build_tmp = getenv('PYTHON_EXTBUILD_TMP') -libtraceevent = getenv('LIBTRACEEVENT') -libapikfs = getenv('LIBAPI') -libperf = getenv('LIBPERF') - -ext_sources = [f.strip() for f in open('util/python-ext-sources') - if len(f.strip()) > 0 and f[0] != '#'] - -extra_libraries = [] - -if '-DHAVE_LIBTRACEEVENT' in cflags: - extra_libraries += [ 'traceevent' ] -else: - ext_sources.remove('util/trace-event.c') - ext_sources.remove('util/trace-event-parse.c') - -# use full paths with source files -ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)) - -if '-DHAVE_LIBNUMA_SUPPORT' in cflags: - extra_libraries += [ 'numa' ] -if '-DHAVE_LIBCAP_SUPPORT' in cflags: - extra_libraries += [ 'cap' ] perf = Extension('perf', - sources = ext_sources, - include_dirs = ['util/include'], - libraries = extra_libraries, - extra_compile_args = cflags, - extra_objects = [ x for x in [libtraceevent, libapikfs, libperf] - if x is not None], + sources = [ src_perf + '/util/python.c' ], + include_dirs = ['util/include'], + extra_compile_args = cflags, ) setup(name='perf', From patchwork Thu Jun 13 18:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13697407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C104C27C4F for ; Thu, 13 Jun 2024 19:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DYNMPvAhzFMBQa9ETz18bM3F5BVhY/EQ+IVegcwRJ6Y=; b=p4hdqwuZ1f6Q5l fk78CODgyMlxnIv+wZgSYlwgNtXSZnmOtMkAfocyQVf6apcAG+7I6Pz+MzNZHuG34dv2dQaArxaFM u+hRKQ1HppQnJUmw5lczQvQx6HdA3XWVYwEYAukyB7TRWMujLwX6ZfL0pGUgI14H20SSi+MhkJZPT L53doRr41WCO6KJa32NsY89p5RuCkJpGhjEHK0KJ8m30NWnqdVUC6rSPzNlPsb3gsp0hPG0GkBhCP Hz1SGZmW/RZmgqitvWTp09mahU/baNzmmZifx/6pck+9vPKa0WlhPS8eGw9BMensKC+2oe4blBTp5 nmQjH/OAv6acoo6eafwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHqCq-00000000I2T-0DIT; Thu, 13 Jun 2024 19:33:56 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHpFm-0000000066z-2t1m for linux-riscv@lists.infradead.org; Thu, 13 Jun 2024 18:33:00 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-dfef7896c01so2246377276.2 for ; Thu, 13 Jun 2024 11:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303571; x=1718908371; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=r+L2y8W9nebELrh4jjwhLDqIvkQwPnsfqcpkdzoDYes=; b=CY7BBNM+1uKUvsrOQyE5WlXwePAB14UQcYXmCF3a/PBYeOJdcNy784h/2cHVL31MVi 7FRT3v8KB9MTvK8IwAT1ak+TScdNTRRqBya/kTQI4cbz4qzwRe3+k8UA3kVTrBHk1iGH ldY13dsHsNukf98hsRQyJMckSB1wiC2W6/dlTzJqc48PPL4Wu5HEiyOQ5Chc1cHX1SDD HDB6qzw24YlT3h+z74zblYm+PoSCJ8kWWJ14A/pOP7W4U+P6P8V46DhW/bdY3f26oPrT uEbSwDT95XB4l1AK/gl/a7HUVjJvjdETh/CcEx7wozII3+VwP+x+VCczo7sX4gUYjzSW dMzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303571; x=1718908371; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r+L2y8W9nebELrh4jjwhLDqIvkQwPnsfqcpkdzoDYes=; b=GJd7kGGJSRsLunj/4CrILyG0NAYr1tGJX2EQU2cRsRsz+o1/qKf3uFbkgSQbn4HB1t i9d7PqsSf4+RyoFEW/+p+phAcwGfmjplQ2LsKDsMdhEm1TcHdrxb04GPeSY8ouEya/Kv YUwHidYPXUxk+FFu0dl2SDe/nd+6qtHpVVqaZyOMAsb8dH6vokSRUhr8GHYgs8AuBDJh k525NlnpgHzMVCph+FhntYUbs58+KT2GHwO9ifIN4YJwyi3yt/jbj8OeeQ4oYAS32H8w 1PQTyvhf8FGHNP9j4RrN8Tnv4rNCogAgsrv6F/Y7wz7+IoDchjXn3h0c2nPbrXdooOYv bxRA== X-Forwarded-Encrypted: i=1; AJvYcCWukW5p0fKBaWzjgquAEQv4QywGYqcLJR+X7dISYqe5xvsToQETyit4Bba4rZzgKbqnevhCcPrnwYShiXPiRdmezgj069SuDBklC1L7dTIU X-Gm-Message-State: AOJu0YxG1Iy9L0HzGWEbxaWyL1Zkka3gWZ6izIJGdF21YTBHg2K7cdCI V9sQPtF6lBTQ/UTxcPQAzDag4oXXvShgBmg/r/hvdoNksZ5TcnMoD+Z/2fGi16RSF0wpG7xayQs O1FOlXg== X-Google-Smtp-Source: AGHT+IG80DNm/FDT+O5OUP8JFT4D2XNhLByUqwk2k3UfIObo7dkaLn3FPAjmCygWQ5MUqnfeOwJ1qGBNNewF X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:6902:2b90:b0:dfa:7278:b4c4 with SMTP id 3f1490d57ef6-dff1538dae8mr77808276.4.1718303570700; Thu, 13 Jun 2024 11:32:50 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:24 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-9-irogers@google.com> Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 8/8] perf python: Clean up build dependencies From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_113254_848304_B110F8D9 X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The python build now depends on libraries and doesn't use python-ext-sources except for the util/python.c dependency. Switch to just directly depending on that file and util/setup.py. This allows the removal of python-ext-sources. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Makefile.perf | 10 +----- tools/perf/util/python-ext-sources | 53 ------------------------------ 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 tools/perf/util/python-ext-sources diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 4a1a9f09fa09..590081384882 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -380,14 +380,6 @@ python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT # Use the detected configuration -include $(OUTPUT).config-detected -ifeq ($(CONFIG_LIBTRACEEVENT),y) - PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) -else - PYTHON_EXT_SRCS := $(shell grep -v ^\#\\\|util/trace-event.c\\\|util/trace-event-parse.c util/python-ext-sources) -endif - -PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBAPI) - SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) PROGRAMS += $(OUTPUT)perf @@ -715,7 +707,7 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) # Create python binding output directory if not already present $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') -$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(PERFLIBS) +$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py $(PERFLIBS) $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS)' \ $(PYTHON_WORD) util/setup.py \ diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources deleted file mode 100644 index 1bec945f4838..000000000000 --- a/tools/perf/util/python-ext-sources +++ /dev/null @@ -1,53 +0,0 @@ -# -# List of files needed by perf python extension -# -# Each source file must be placed on its own line so that it can be -# processed by Makefile and util/setup.py accordingly. -# - -util/python.c -../lib/ctype.c -util/cap.c -util/evlist.c -util/evsel.c -util/evsel_fprintf.c -util/perf_event_attr_fprintf.c -util/cpumap.c -util/memswap.c -util/mmap.c -util/namespaces.c -../lib/bitmap.c -../lib/find_bit.c -../lib/list_sort.c -../lib/hweight.c -../lib/string.c -../lib/vsprintf.c -util/thread_map.c -util/util.c -util/cgroup.c -util/parse-branch-options.c -util/rblist.c -util/counts.c -util/print_binary.c -util/strlist.c -util/trace-event.c -util/trace-event-parse.c -../lib/rbtree.c -util/string.c -util/symbol_fprintf.c -util/units.c -util/affinity.c -util/rwsem.c -util/hashmap.c -util/perf_regs.c -util/fncache.c -util/rlimit.c -util/perf-regs-arch/perf_regs_aarch64.c -util/perf-regs-arch/perf_regs_arm.c -util/perf-regs-arch/perf_regs_csky.c -util/perf-regs-arch/perf_regs_loongarch.c -util/perf-regs-arch/perf_regs_mips.c -util/perf-regs-arch/perf_regs_powerpc.c -util/perf-regs-arch/perf_regs_riscv.c -util/perf-regs-arch/perf_regs_s390.c -util/perf-regs-arch/perf_regs_x86.c