Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp386221rdg; Thu, 12 Oct 2023 08:24:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLIWX3FTQ11UjgJmik9gWHXaI/6921sdaUUzr5Jqui6YtPJtkWeTiFKaBn1tTve5YV9rC6 X-Received: by 2002:a17:90b:1bc4:b0:274:dd15:87bf with SMTP id oa4-20020a17090b1bc400b00274dd1587bfmr31108615pjb.20.1697124245637; Thu, 12 Oct 2023 08:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697124245; cv=none; d=google.com; s=arc-20160816; b=xbRv4dcOdM2ecegm8U3OrKKXDVT9zQNrO13uWgqOnAYLq83yEUHzOzGiVgAeuTvS0z XO85TZPtK6PFC4hENlh3YaVhoC2sb3lmP+og3WQlu31znfgK2P67cbwdmpq5YTJFatkP ckyYCbZyTj0AkRdMMnUnJW61YdwdZEHOPcTGvmm4IunaBvYou6Dg7nUxpXSz+ZKyURDH EufzMGqM+WTOj3K4RQh8wSUJTarXbjPH8RNapKSTHpj4n4fYLakQX706PnXQpevtiS/l IBv7el8MlftvF4vEXMojgymoQozoFDum7p27mgA5qxVISggQKqy8EwkDoDEUivPyTzn9 i4YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VHK1BXeTdm+7g9q0Gbvmqz6TzZXu3xcSDt6W9eTGzYc=; fh=zKl0yrml4nwh7SLdGyvOhRT4AWJqTyTS7F0KTKUdmxk=; b=abw/loudVmVqOJLFeCIOW7tMnsahqSNg8kmFhq/t/2eJ/DWkuPksJ2JAO5pJl1O0Zt bJayb+ZOCGUCWyYYzK/wJD/cDbCq3qg68n5P32pV2eXYF61byBtGuUj1AtT2mdm3wpHM 70KDlwqpTRzjVqJNG3phyDIoQSkLzbykDgrmPN3Z3OzfasvzsIrcK4O1uv0LlulImW6Q zEAQCK+t40PypnTU1I6JwuGECZPf5qnr6KXAhPLSO+/Ipp4Ma/6tcIwbMaCY0lFU5sMJ HtXHJ9Eg5v/T+5GzpVVdvoOKpwI8hX87wxUXIBREiohIjcuzgzZOXEHeffuMc+7HK8ZU socA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wjzU5OR5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id be3-20020a656e43000000b00578ac490e7bsi2388874pgb.638.2023.10.12.08.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wjzU5OR5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id A66C9822D17A; Thu, 12 Oct 2023 08:24:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343999AbjJLPYC (ORCPT + 99 others); Thu, 12 Oct 2023 11:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379229AbjJLPX5 (ORCPT ); Thu, 12 Oct 2023 11:23:57 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463F8BE for ; Thu, 12 Oct 2023 08:23:55 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-534694a9f26so12773a12.1 for ; Thu, 12 Oct 2023 08:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697124234; x=1697729034; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VHK1BXeTdm+7g9q0Gbvmqz6TzZXu3xcSDt6W9eTGzYc=; b=wjzU5OR5w4DgbX1SvAChEx94DeItImQhJixpsg5DPd5Gzszf18rP4CU0QSzpL3BBSh jjXXPrGyOWUuW102lTB8KS3StGIFsxW2CcSTdJYvSku95vFjauL0UmJDMhrURjZnme5L 6ZvCKntkJNlb9UdmVlBa3fLxbqkwNltp2kl3pGN9z6ZYZPUn6GIxwWutF3r/HW0Artm0 XA7OJyUj/zCrwiFfJWLrKxIdCUqrZrL72md8FGOiTy3JSCfI01pMl2fdMLuEGMNWg0vy 5Nrr11VhUBFsv6aLeTPElHa2rMOPVOecT4yRc/TS8PMDLQblPS6jLgUOXBnqzOIp5gCa /JWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697124234; x=1697729034; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VHK1BXeTdm+7g9q0Gbvmqz6TzZXu3xcSDt6W9eTGzYc=; b=Xxw+yqfk33tLKtKi8KPSbBe4CVjJ9MhL76r0H7xGpxc9zD6DTGW9X+l0w5KfOknILm B+WSBGzTh/saeyPqVPbOsrX7O2RpGcJGc1mkEeWJrioYrU13ACasjWneftRLHpRk+X5f DQdSC7/AqBysyLUUODAgnnkSMKW3+KLZLH7HdblaK5K7XhG55Dw6IdyMrFH2qUppT4zv rIrX3SfnW2JfX2/BmLA3GrmQ5D9MRrqjAHlZZanglhBS9nPQ/GzzGOe4Tx958IDFR2p/ dL02t/pCWkedye3WZ7cMHlxicBXbo3bLywBx+CcKBnVSKM1+dFBQyeXboWL7bPty0kcK Q1PQ== X-Gm-Message-State: AOJu0YzNg2wkssIsAo2nj6pJZN5CxILZqLbj4MPJQalvvmI6NKhw/QoI viBVBcXUbpiN2P7I+VLY/lCmcJqiLLALjxf/qZf3CQ== X-Received: by 2002:a50:99d8:0:b0:53d:a40e:bed1 with SMTP id n24-20020a5099d8000000b0053da40ebed1mr299680edb.3.1697124233496; Thu, 12 Oct 2023 08:23:53 -0700 (PDT) MIME-Version: 1.0 References: <20231007021326.4156714-1-irogers@google.com> <20231007021326.4156714-2-irogers@google.com> <002da48a-c40f-4d6a-881c-59490ea2de95@intel.com> In-Reply-To: <002da48a-c40f-4d6a-881c-59490ea2de95@intel.com> From: Ian Rogers Date: Thu, 12 Oct 2023 08:23:41 -0700 Message-ID: Subject: Re: [PATCH v1 1/7] perf pmu: Rename perf_pmu__get_default_config to perf_pmu__arch_init To: Adrian Hunter Cc: 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 , 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" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 08:24:04 -0700 (PDT) On Thu, Oct 12, 2023 at 4:52=E2=80=AFAM Adrian Hunter wrote: > > On 7/10/23 05:13, Ian Rogers wrote: > > 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 > > One cosmetic comment otherwise: > > Reviewed-by: Adrian Hunter > > > --- > > 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 | 14 +++++++------- > > tools/perf/util/pmu.h | 2 +- > > 5 files changed, 14 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 =3D true; > > - return cs_etm_get_default_config(pmu); > > + pmu->default_config =3D 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 =3D arm_spe_pmu_default_config(pmu); > > } else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) { > > pmu->selectable =3D true; > > #endif > > } > > > > #endif > > - return NULL; > > } > > diff --git a/tools/perf/arch/s390/util/pmu.c b/tools/perf/arch/s390/uti= l/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 =3D 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 =3D true; > > - return intel_pt_pmu_default_config(pmu); > > + pmu->default_config =3D intel_pt_pmu_default_config(pmu); > > } > > if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME)) { > > pmu->auxtrace =3D true; > > pmu->selectable =3D 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 6b1b7f8f00fa..6e95b3d2c2e3 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 =3D perf_pmu__open_file_at(pmu, dirfd, "alias"); > > @@ -991,6 +985,12 @@ static int pmu_max_precise(int dirfd, struct perf_= pmu *pmu) > > return max_precise; > > } > > > > + > > Double blank line Thanks, will fix in v2. Ian > > +void __weak > > +perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) > > +{ > > +} > > + > > struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, c= onst char *name) > > { > > struct perf_pmu *pmu; > > @@ -1037,7 +1037,7 @@ struct perf_pmu *perf_pmu__lookup(struct list_hea= d *pmus, int dirfd, const char > > pmu_add_sys_aliases(pmu); > > list_add_tail(&pmu->list, pmus); > > > > - pmu->default_config =3D 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, co= nst 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); > > >