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