lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cddb56a940b90da8f11ff73bbbbf196770d3ecad.camel@intel.com>
Date: Fri, 1 Nov 2024 07:29:20 +0000
From: "Zhang, Rui" <rui.zhang@...el.com>
To: "alexander.shishkin@...ux.intel.com" <alexander.shishkin@...ux.intel.com>,
	"tglx@...utronix.de" <tglx@...utronix.de>, "bp@...en8.de" <bp@...en8.de>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
	"peterz@...radead.org" <peterz@...radead.org>, "mark.rutland@....com"
	<mark.rutland@....com>, "mingo@...hat.com" <mingo@...hat.com>,
	"Dhananjay.Ugwekar@....com" <Dhananjay.Ugwekar@....com>, "acme@...nel.org"
	<acme@...nel.org>, "namhyung@...nel.org" <namhyung@...nel.org>,
	"jolsa@...nel.org" <jolsa@...nel.org>, "kan.liang@...ux.intel.com"
	<kan.liang@...ux.intel.com>, "irogers@...gle.com" <irogers@...gle.com>,
	"Hunter, Adrian" <adrian.hunter@...el.com>
CC: "linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
	"ravi.bangoria@....com" <ravi.bangoria@....com>, "ananth.narayan@....com"
	<ananth.narayan@....com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "gautham.shenoy@....com"
	<gautham.shenoy@....com>, "kprateek.nayak@....com" <kprateek.nayak@....com>,
	"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v6 06/10] perf/x86/rapl: Add arguments to the init and
 cleanup functions

On Fri, 2024-10-25 at 11:13 +0000, Dhananjay Ugwekar wrote:
> Prepare for the addition of RAPL core energy counter support.
> 
> Add arguments to the init and cleanup functions, which will help in
> initialization and cleaning up of two separate PMUs.
> 
> No functional change.
> 
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>

Reviewed-by: Zhang Rui <rui.zhang@...el.com>
Tested-by: Zhang Rui <rui.zhang@...el.com>

thanks,
rui


> ---
>  arch/x86/events/rapl.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
> index 447f62caa5f9..bf6fee114294 100644
> --- a/arch/x86/events/rapl.c
> +++ b/arch/x86/events/rapl.c
> @@ -597,7 +597,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;
>  
> @@ -615,7 +615,7 @@ static const struct attribute_group
> *rapl_attr_update[] = {
>         NULL,
>  };
>  
> -static int __init init_rapl_pmu(void)
> +static int __init init_rapl_pmu(struct rapl_pmus *rapl_pmus)
>  {
>         struct rapl_pmu *rapl_pmu;
>         int idx;
> @@ -641,20 +641,20 @@ static int __init init_rapl_pmu(void)
>         return -ENOMEM;
>  }
>  
> -static int __init init_rapl_pmus(void)
> +static int __init init_rapl_pmus(struct rapl_pmus **rapl_pmus_ptr,
> int rapl_pmu_scope)
>  {
>         int nr_rapl_pmu = topology_max_packages();
> -       int rapl_pmu_scope = PERF_PMU_SCOPE_PKG;
> +       struct rapl_pmus *rapl_pmus;
>  
> -       if (!rapl_pmu_is_pkg_scope()) {
> -               nr_rapl_pmu *= topology_max_dies_per_package();
> -               rapl_pmu_scope = PERF_PMU_SCOPE_DIE;
> -       }
> +       if (rapl_pmu_scope == PERF_PMU_SCOPE_DIE)
> +               nr_rapl_pmu     *= topology_max_dies_per_package();
>  
>         rapl_pmus = kzalloc(struct_size(rapl_pmus, rapl_pmu,
> nr_rapl_pmu), GFP_KERNEL);
>         if (!rapl_pmus)
>                 return -ENOMEM;
>  
> +       *rapl_pmus_ptr = rapl_pmus;
> +
>         rapl_pmus->nr_rapl_pmu          = nr_rapl_pmu;
>         rapl_pmus->pmu.attr_groups      = rapl_attr_groups;
>         rapl_pmus->pmu.attr_update      = rapl_attr_update;
> @@ -669,7 +669,7 @@ static int __init init_rapl_pmus(void)
>         rapl_pmus->pmu.module           = THIS_MODULE;
>         rapl_pmus->pmu.capabilities     = PERF_PMU_CAP_NO_EXCLUDE;
>  
> -       return init_rapl_pmu();
> +       return init_rapl_pmu(rapl_pmus);
>  }
>  
>  static struct rapl_model model_snb = {
> @@ -793,8 +793,12 @@ MODULE_DEVICE_TABLE(x86cpu, rapl_model_match);
>  static int __init rapl_pmu_init(void)
>  {
>         const struct x86_cpu_id *id;
> +       int rapl_pmu_scope = PERF_PMU_SCOPE_DIE;
>         int ret;
>  
> +       if (rapl_pmu_is_pkg_scope())
> +               rapl_pmu_scope = PERF_PMU_SCOPE_PKG;
> +
>         id = x86_match_cpu(rapl_model_match);
>         if (!id)
>                 return -ENODEV;
> @@ -810,7 +814,7 @@ static int __init rapl_pmu_init(void)
>         if (ret)
>                 return ret;
>  
> -       ret = init_rapl_pmus();
> +       ret = init_rapl_pmus(&rapl_pmus, rapl_pmu_scope);
>         if (ret)
>                 return ret;
>  
> @@ -823,7 +827,7 @@ static int __init rapl_pmu_init(void)
>  
>  out:
>         pr_warn("Initialization failed (%d), disabled\n", ret);
> -       cleanup_rapl_pmus();
> +       cleanup_rapl_pmus(rapl_pmus);
>         return ret;
>  }
>  module_init(rapl_pmu_init);
> @@ -831,6 +835,6 @@ module_init(rapl_pmu_init);
>  static void __exit intel_rapl_exit(void)
>  {
>         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

Powered by Openwall GNU/*/Linux Powered by OpenVZ