From patchwork Wed Nov 9 18:49:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 1405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp504041wru; Wed, 9 Nov 2022 10:51:19 -0800 (PST) X-Google-Smtp-Source: AMsMyM7f+Fy32PC76wgd9vmRMf3f0MMlmGJVaISeUPt21KC/JiUpBFMqaWY0L+q9ZcP8cEq6NU/f X-Received: by 2002:a17:902:e888:b0:186:a6be:1106 with SMTP id w8-20020a170902e88800b00186a6be1106mr60960409plg.150.1668019879129; Wed, 09 Nov 2022 10:51:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668019879; cv=none; d=google.com; s=arc-20160816; b=QkLX/+7vWX8yLoBo85px0I+RVi1XacktOj9lFK4AYkj2RarcxT486n4R9KoII5OEhX CzePwemIxTIFkamfCDECMyZ1PmoOR1MZKr8v6jUqe7lbjNP4gNajfJYtNBJEGVBpkvIZ jy1T4hI/dFxJIihQNaPfgfoxYAbgc78+cZz61RQgBKAoB4D7wwI+qW4xPUg+q2K1yJrg nVCG2KZ+hPfj6q8FOWuMYyIOF1R8SEOppWQKMGNlHCu3uTv2yrXO6I8T0cVPcDsaNtrw hy2V/S/N2hKje56Vu3InVPNSPexVHG6Mk9tCkl32BiGLMEhsRaq4Pmj023k4VlXnVsf3 Q/sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=lkoognfiz4T0FO9qiJqVW8CCjbYEKiYWyfXc5YQhyvU=; b=IG2gvSIKrjmgL/7acnpKes2uxwk5w3jVWCVwY9Uy7Qo2kgtwZ7ib98xf87RqfE9gBd GOgfO8PMw6KRNvED0doKkc66AiReB1BGxVZyFalnjDIeOYkrwlo0RjTjJcMqGfARXTXG QdrdRiNqRUiykoitqzfTC0lVt9YoCRpn9p1jZs+Eqt541kgSf9/DWbjIUFF2sndgMoUu Tl4cwF1HeEUvly5pqNElAUgroixKo/cWbtZhy/QLDt2CVLVhZepxm3+tU5W4U4lKSB1H gjoBmk0SaiGh1ZHBhtpaiRvQ26+11tMAwJ5uRUynGCCdNRQNBsYjtGIzJgKEZ0AB6Q+6 jpkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=j69pt3b6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je4-20020a170903264400b00186db024863si16116643plb.612.2022.11.09.10.51.05; Wed, 09 Nov 2022 10:51:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=j69pt3b6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231589AbiKISt3 (ORCPT + 99 others); Wed, 9 Nov 2022 13:49:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbiKISt1 (ORCPT ); Wed, 9 Nov 2022 13:49:27 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5618313F91 for ; Wed, 9 Nov 2022 10:49:26 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id nl16-20020a17090b385000b002138288fd51so1845477pjb.6 for ; Wed, 09 Nov 2022 10:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=lkoognfiz4T0FO9qiJqVW8CCjbYEKiYWyfXc5YQhyvU=; b=j69pt3b65opmCrEUZi5UPc1HYd/XHA0eHlmdQQkHI+ARnwDXXgf8KRyvL4NEZd7ajs x4iit8Zps0gDdr4HFiP8+viZ/HZYB2E9C874CDUbvquklngUPsMre2ujqhCQOnPfb0NF AxFGGgIDYJkTyPmwnMSwmPFdxZr/CgABD5SeaRHK17Y7N1wduXBq7rnqSSSulFHRSycz BRbFDhGcBNLAwNcZK3uAa5So2ICT5ZKA125taXxkT6I3R86sG6irVFVe5c8jJu3rl0F+ 4h3Uj8aQO4jCE+CZJwDhlhj+iKyr3mv2du7I1hmGySLgFGoANhaL+gHzt9tBPiII78ZQ Fp6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lkoognfiz4T0FO9qiJqVW8CCjbYEKiYWyfXc5YQhyvU=; b=rCRujObvykJimRqaaxkwyJ1ssqC1qGEL/lO2Nw/NmWHwNzRxz94rL/XzxLxrDfn3ii 8F6B+cFNaM0u8K7XZVulFlo0Z5OYGYSbP0AD/PwhNOVazzPIHmhcUk6zVXONRPlJgHrf kP6Ijx2UGp1A+uX8BaCnGrqK3QBrOpKuqsR/AauOvecev+MYkImaIi4Ag3hltgaU+vhq 8ES1ZK+3E5jdvzl+Lr7JdDXqMdVxFOsqNK0Un3PreCzMI4XGcy/9GkcgtiN2TWaewWQa Ih1G/evaRgkFqAPuKVA6iLc5oBHXqRTNJQiP1WeNfTZKUAexygMhn5BxTNLxnqzzKxHr zwng== X-Gm-Message-State: ANoB5pmAkuswXvG37FeT3PYmmhe7KqZLLYS9aeVnVRYiYS2nZvT0/ous 5DfdGS0SA/AOAOqY8QNf4eZhlkFEHwoa X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b06f:a254:5ce9:c442]) (user=irogers job=sendgmr) by 2002:a17:90b:4003:b0:20a:fee1:8f69 with SMTP id ie3-20020a17090b400300b0020afee18f69mr55292pjb.0.1668019765401; Wed, 09 Nov 2022 10:49:25 -0800 (PST) Date: Wed, 9 Nov 2022 10:49:00 -0800 Message-Id: <20221109184914.1357295-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH v2 00/14] Fix perf tools/lib includes From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Masahiro Yamada , Nicolas Schier , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Nick Desaulniers , Andrii Nakryiko Cc: Stephane Eranian , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749045613073207220?= X-GMAIL-MSGID: =?utf-8?q?1749045613073207220?= The previous build would add -Itools/lib and get dependencies for libtraceevent, libsubcmd, libsymbol, libapi and libbpf meaning that overriding these libraries would change the link time dependency but the headers would erroneously come from tools/lib. Fix the build to install headers and then depend on these. To reduce exposing internal headers/APIs some clean up is performed. tools/lib/symbol has a Makefile added, while tools/lib/api and tools/lib/subcmd have install targets added. The pattern used for the dependencies in Makefile.perf is modelled on libbpf. The problem and solution were motivated by this issue and discussion: https://lore.kernel.org/lkml/CAEf4BzbbOHQZUAe6iWaehKCPQAf3VC=hq657buqe2_yRKxaK-A@mail.gmail.com/ v2. Fix a MANIFEST issue for the source tar ball. Add dependencies for the installed header files so that the build doesn't overtake building these dependencies. Both issues reported by Arnaldo Carvalho de Melo . Ian Rogers (14): tools lib api: Add install target tools lib subcmd: Add install target perf build: Install libsubcmd locally when building perf build: Install libapi locally when building perf build: Install libperf locally when building perf build: Install libtraceevent locally when building tools lib api: Add missing install headers tools lib perf: Add missing install headers tool lib symbol: Add Makefile/Build perf build: Install libsymbol locally when building perf expr: Tidy hashmap dependency perf thread_map: Reduce exposure of libperf internal API perf cpumap: Tidy libperf includes perf build: Use tools/lib headers from install path tools/lib/api/Makefile | 52 +++++ tools/lib/perf/Makefile | 10 +- tools/lib/subcmd/Makefile | 49 +++++ tools/lib/symbol/Build | 1 + tools/lib/symbol/Makefile | 115 +++++++++++ tools/perf/.gitignore | 7 +- tools/perf/MANIFEST | 3 +- tools/perf/Makefile.config | 2 - tools/perf/Makefile.perf | 192 ++++++++++++++---- tools/perf/builtin-stat.c | 1 + tools/perf/builtin-trace.c | 4 +- tools/perf/tests/cpumap.c | 2 +- tools/perf/tests/expr.c | 1 + tools/perf/tests/openat-syscall.c | 1 + tools/perf/tests/pmu-events.c | 1 + tools/perf/tests/thread-map.c | 1 + tools/perf/util/Build | 5 - tools/perf/util/auxtrace.h | 2 +- tools/perf/util/bpf-loader.c | 4 - tools/perf/util/bpf_counter.c | 2 +- tools/perf/util/cpumap.c | 1 + tools/perf/util/cpumap.h | 2 +- tools/perf/util/evsel.c | 5 +- tools/perf/util/evsel.h | 2 - tools/perf/util/expr.c | 1 + tools/perf/util/expr.h | 7 +- tools/perf/util/metricgroup.c | 1 + tools/perf/util/python.c | 6 +- .../scripting-engines/trace-event-python.c | 2 +- tools/perf/util/stat-shadow.c | 1 + tools/perf/util/stat.c | 4 - tools/perf/util/thread_map.c | 1 + tools/perf/util/thread_map.h | 2 - 33 files changed, 402 insertions(+), 88 deletions(-) create mode 100644 tools/lib/symbol/Build create mode 100644 tools/lib/symbol/Makefile Acked-by: Namhyung Kim