Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp477679rdg; Thu, 12 Oct 2023 10:57:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBeWG+t8rtaiAyj+F8qdR5ViLqa2MtNUYC1aIG4NFubxxmo0o0KMYDrIpCajyQLl7ecQPC X-Received: by 2002:a17:90a:8804:b0:274:111c:c14d with SMTP id s4-20020a17090a880400b00274111cc14dmr21707050pjn.13.1697133471737; Thu, 12 Oct 2023 10:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697133471; cv=none; d=google.com; s=arc-20160816; b=sHo744EObkRxqF4pUjUbMRns8Dhe3sDZMUJuI7zfgcHuqzZ5DXhZu8vJoXvLJbhB/B oD6qEwqpv1W5XeiRXaQ34MrKThjyvmgux7fzYmE7BbxNAC4srwUBukd60M8PEUNyscrB y+p3ytfMxh7wGHKaOStRDnsxZUKqG3+Jy4WYjfvf1W6nDizaJdk79P+K8YxEWrFlzF/D CavZakIN4aC+3nGc0z3O1GuclwFAFNmjoUTfGKXCdBA169bVBi0+zka/4tIJ3HSc3wDh teK23Sjgu1lzZ2oUkgW+nSGxBPTsXl1mnMY0+SzgErd0vEquR1HSXyMyDzz6BjWfrdGv u6iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=5nkZcfdBOLCg2JD7+nD32uBrulHPlnA6DzJIE9BS0/8=; fh=/5tleBjPDujrXIYss611tAyhfELId0etfY4oKm6i49Q=; b=o5G4UD37G6iLVr8YvGiX/pJqp7KpTpwM0Hdo7+6/kEL3HzHaOKfD0FGyCRTlzHX8Lx 6GLhI2C7EUwF7AglKhRx0R0/1PZMCfEdGVntSvE/uI13XpYrR/0hcAUggtxjrNtUoufk 649ROVwZ2zebcaJZzHeJVtpF+4JxIQHSWyR4pm0+7rXv2lq6M25rqit8eymKVPN8qf+o 1i9OYdD/SXp9MhKoyzDvwpx5QYINF3hlCqbGpA6e3hsuc16IFMaNxDoZZFvOVcoivMZ3 ZjlKkonpSSfUR/5cwr0t8/5Dj3K8AjOy1jAy8xsy/R2KYMHMd3uuuBFeB6S9vITwKMjp eQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kV5zSE4z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bf19-20020a17090b0b1300b0027681e3a57fsi2791295pjb.162.2023.10.12.10.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:57:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kV5zSE4z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BFB5E82516CC; Thu, 12 Oct 2023 10:57:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441869AbjJLR44 (ORCPT + 99 others); Thu, 12 Oct 2023 13:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441848AbjJLR4y (ORCPT ); Thu, 12 Oct 2023 13:56:54 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA2EDB8 for ; Thu, 12 Oct 2023 10:56:52 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d85fc108f0eso1561917276.2 for ; Thu, 12 Oct 2023 10:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697133412; x=1697738212; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=5nkZcfdBOLCg2JD7+nD32uBrulHPlnA6DzJIE9BS0/8=; b=kV5zSE4zWfhTUdCs/rnOxGyYltVNqQ4OXdGQgI9+rmOA2W4gmpFEIeHkfUAOnLHrpl TcJ/TAbbmICHBVfMd/Bh9PyYh932Xw2Rqi3rdhzx2N12G0p/QR56fYvPE9IhZBtbRghP laHoEVNM3cI/Lze1x9IH0AMLtMB5O1z65wr9HWS22k65q1c7opjUJJSKlIK9hWrKbSsy QtbMPdSriu25p0LUh0VrwJSjb/R/g/lqENhdYNumFIGli7uMrBUSOhy9/FtXab4Pgxj1 s4S3YJ1DL65F0/0Qbo4WmCOGDyBa9WlrmfKmjBYuzZsh+qMGy+qo1RFL9yp7G/K5jN/I m4wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697133412; x=1697738212; 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=5nkZcfdBOLCg2JD7+nD32uBrulHPlnA6DzJIE9BS0/8=; b=CnCxI37jH6nir0uA513jIELzMmAqDYgDjU9DDMVxLyCQEYs2j6T3vD95lTq/+1AzEk 2UecLlkf/4OMd/RqJA45xlnptl5gDXFfnH9O7mApUjkCsyrUlHIWtWJuJaU5fS2D08Nt mAJuQ+hVGCt0hoioKRxbo5Y40WvwDvDCGPbmtRxeolDUSmNlBUdjp9OeovbuY1FDkB+F rd5GYyLX9njKTbdagYZgMDpN1wgJTtei5ra1k68A3ErCN13xA33zmjwCAh15CJW9tHQ7 UDyLe+U2OceXfBK+LT9gD6b8CSiSU5OBiqBc/6vJAVk0OEVqp7rcoug9q65J0ss9rkqV miTw== X-Gm-Message-State: AOJu0Yx54gZrCr7uXFuPNHoJcmbD7zdEMIZvhR7pDghW8fnHwWzauSWZ dh/36qAvmvgOV++wPUzKML/NZZm8LCOW X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6a89:babc:124b:e4e6]) (user=irogers job=sendgmr) by 2002:a25:aa48:0:b0:d9a:be7b:283c with SMTP id s66-20020a25aa48000000b00d9abe7b283cmr65087ybi.0.1697133411989; Thu, 12 Oct 2023 10:56:51 -0700 (PDT) Date: Thu, 12 Oct 2023 10:56:39 -0700 In-Reply-To: <20231012175645.1849503-1-irogers@google.com> Message-Id: <20231012175645.1849503-2-irogers@google.com> Mime-Version: 1.0 References: <20231012175645.1849503-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Subject: [PATCH v2 1/7] perf pmu: Rename perf_pmu__get_default_config to perf_pmu__arch_init From: Ian Rogers To: Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Thomas Richter , Ravi Bangoria , Kajol Jain , Jing Zhang , Kan Liang , Yang Jihong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:57:48 -0700 (PDT) Assign default_config as part of the init. perf_pmu__get_default_config was doing more than just getting the default config and so this is intended to better align with the code. Signed-off-by: Ian Rogers --- tools/perf/arch/arm/util/pmu.c | 8 +++----- tools/perf/arch/s390/util/pmu.c | 3 +-- tools/perf/arch/x86/util/pmu.c | 5 ++--- tools/perf/util/pmu.c | 13 ++++++------- tools/perf/util/pmu.h | 2 +- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c index a9623b128ece..d55d2b15f2e6 100644 --- a/tools/perf/arch/arm/util/pmu.c +++ b/tools/perf/arch/arm/util/pmu.c @@ -14,22 +14,20 @@ #include "../../../util/pmu.h" #include "../../../util/cs-etm.h" -struct perf_event_attr -*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) +void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) { #ifdef HAVE_AUXTRACE_SUPPORT if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) { /* add ETM default config here */ pmu->selectable = true; - return cs_etm_get_default_config(pmu); + pmu->default_config = cs_etm_get_default_config(pmu); #if defined(__aarch64__) } else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) { - return arm_spe_pmu_default_config(pmu); + pmu->default_config = arm_spe_pmu_default_config(pmu); } else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) { pmu->selectable = true; #endif } #endif - return NULL; } diff --git a/tools/perf/arch/s390/util/pmu.c b/tools/perf/arch/s390/util/pmu.c index 11f03f32e3fd..886c30e001fa 100644 --- a/tools/perf/arch/s390/util/pmu.c +++ b/tools/perf/arch/s390/util/pmu.c @@ -13,11 +13,10 @@ #define S390_PMUPAI_EXT "pai_ext" #define S390_PMUCPUM_CF "cpum_cf" -struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu) +void perf_pmu__arch_init(struct perf_pmu *pmu) { if (!strcmp(pmu->name, S390_PMUPAI_CRYPTO) || !strcmp(pmu->name, S390_PMUPAI_EXT) || !strcmp(pmu->name, S390_PMUCPUM_CF)) pmu->selectable = true; - return NULL; } diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c index 8b53ca468a50..811e2377d2d5 100644 --- a/tools/perf/arch/x86/util/pmu.c +++ b/tools/perf/arch/x86/util/pmu.c @@ -17,19 +17,18 @@ #include "../../../util/pmus.h" #include "env.h" -struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) +void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) { #ifdef HAVE_AUXTRACE_SUPPORT if (!strcmp(pmu->name, INTEL_PT_PMU_NAME)) { pmu->auxtrace = true; - return intel_pt_pmu_default_config(pmu); + pmu->default_config = intel_pt_pmu_default_config(pmu); } if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) { pmu->auxtrace = true; pmu->selectable = true; } #endif - return NULL; } int perf_pmus__num_mem_pmus(void) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 6428e2648289..d075da0eecc0 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -954,12 +954,6 @@ void pmu_add_sys_aliases(struct perf_pmu *pmu) pmu_for_each_sys_event(pmu_add_sys_aliases_iter_fn, pmu); } -struct perf_event_attr * __weak -perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) -{ - return NULL; -} - static char *pmu_find_alias_name(struct perf_pmu *pmu, int dirfd) { FILE *file = perf_pmu__open_file_at(pmu, dirfd, "alias"); @@ -991,6 +985,11 @@ static int pmu_max_precise(int dirfd, struct perf_pmu *pmu) return max_precise; } +void __weak +perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) +{ +} + struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *name) { struct perf_pmu *pmu; @@ -1037,7 +1036,7 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char pmu_add_sys_aliases(pmu); list_add_tail(&pmu->list, pmus); - pmu->default_config = perf_pmu__get_default_config(pmu); + perf_pmu__arch_init(pmu); return pmu; err: diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 85190d058852..588c64e38d6b 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -233,7 +233,7 @@ bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name); int perf_pmu__test(void); -struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu); +void perf_pmu__arch_init(struct perf_pmu *pmu); void pmu_add_cpu_aliases_table(struct perf_pmu *pmu, const struct pmu_events_table *table); -- 2.42.0.655.g421f12c284-goog