[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b087a806bbec50ce5752f6e09c70ed9ac4314c4c.camel@intel.com>
Date: Fri, 12 Jul 2024 03:22:30 +0000
From: "Zhang, Rui" <rui.zhang@...el.com>
To: "alexander.shishkin@...ux.intel.com" <alexander.shishkin@...ux.intel.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, "Hunter, Adrian"
<adrian.hunter@...el.com>, "mingo@...hat.com" <mingo@...hat.com>,
"irogers@...gle.com" <irogers@...gle.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "gustavoars@...nel.org" <gustavoars@...nel.org>,
"kan.liang@...ux.intel.com" <kan.liang@...ux.intel.com>, "kees@...nel.org"
<kees@...nel.org>, "mark.rutland@....com" <mark.rutland@....com>,
"peterz@...radead.org" <peterz@...radead.org>, "Dhananjay.Ugwekar@....com"
<Dhananjay.Ugwekar@....com>, "bp@...en8.de" <bp@...en8.de>, "acme@...nel.org"
<acme@...nel.org>, "oleksandr@...alenko.name" <oleksandr@...alenko.name>,
"jolsa@...nel.org" <jolsa@...nel.org>, "x86@...nel.org" <x86@...nel.org>,
"namhyung@...nel.org" <namhyung@...nel.org>
CC: "ravi.bangoria@....com" <ravi.bangoria@....com>, "kprateek.nayak@....com"
<kprateek.nayak@....com>, "gautham.shenoy@....com" <gautham.shenoy@....com>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
"sandipan.das@....com" <sandipan.das@....com>, "ananth.narayan@....com"
<ananth.narayan@....com>, "linux-pm@...r.kernel.org"
<linux-pm@...r.kernel.org>
Subject: Re: [PATCH v4 07/11] perf/x86/rapl: Add an argument to the cleanup
and init functions
On Thu, 2024-07-11 at 10:24 +0000, Dhananjay Ugwekar wrote:
> Prep for per-core RAPL PMU addition.
>
> No functional change.
>
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
Reviewed-by: Zhang Rui <rui.zhang@...el.com>
-rui
> ---
> arch/x86/events/rapl.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
> index 1d36565d0cb9..362e82284ccb 100644
> --- a/arch/x86/events/rapl.c
> +++ b/arch/x86/events/rapl.c
> @@ -694,7 +694,7 @@ static void __init rapl_advertise(void)
> }
> }
>
> -static void cleanup_rapl_pmus(void)
> +static void cleanup_rapl_pmus(struct rapl_pmus *rapl_pmus)
> {
> int i;
>
> @@ -712,9 +712,10 @@ static const struct attribute_group
> *rapl_attr_update[] = {
> NULL,
> };
>
> -static int __init init_rapl_pmus(void)
> +static int __init init_rapl_pmus(struct rapl_pmus **rapl_pmus_ptr)
> {
> int nr_rapl_pmu = topology_max_packages();
> + struct rapl_pmus *rapl_pmus;
>
> if (!rapl_pmu_is_pkg_scope())
> nr_rapl_pmu *= topology_max_dies_per_package();
> @@ -738,6 +739,9 @@ static int __init init_rapl_pmus(void)
> rapl_pmus->pmu.read = rapl_pmu_event_read;
> rapl_pmus->pmu.module = THIS_MODULE;
> rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE;
> +
> + *rapl_pmus_ptr = rapl_pmus;
> +
> return 0;
> }
>
> @@ -879,7 +883,7 @@ static int __init rapl_pmu_init(void)
> if (ret)
> return ret;
>
> - ret = init_rapl_pmus();
> + ret = init_rapl_pmus(&rapl_pmus);
> if (ret)
> return ret;
>
> @@ -903,7 +907,7 @@ static int __init rapl_pmu_init(void)
> cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE);
> out:
> pr_warn("Initialization failed (%d), disabled\n", ret);
> - cleanup_rapl_pmus();
> + cleanup_rapl_pmus(rapl_pmus);
> return ret;
> }
> module_init(rapl_pmu_init);
> @@ -912,6 +916,6 @@ static void __exit intel_rapl_exit(void)
> {
> cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE);
> perf_pmu_unregister(&rapl_pmus->pmu);
> - cleanup_rapl_pmus();
> + cleanup_rapl_pmus(rapl_pmus);
> }
> module_exit(intel_rapl_exit);
Powered by blists - more mailing lists