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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da8e731480d0f4b8284c6fc69e68f2aab2b23292.camel@intel.com>
Date: Fri, 1 Nov 2024 07:28:40 +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 03/10] perf/x86/rapl: Remove the cpu_to_rapl_pmu()
 function

On Fri, 2024-10-25 at 11:13 +0000, Dhananjay Ugwekar wrote:
> Prepare for the addition of RAPL core energy counter support.
> Post which, one CPU might be mapped to more than one rapl_pmu
> (package/die one and a core one). So, remove the cpu_to_rapl_pmu()
> function.
> 
> 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 | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
> index f70c49ca0ef3..d20c5b1dd0ad 100644
> --- a/arch/x86/events/rapl.c
> +++ b/arch/x86/events/rapl.c
> @@ -162,17 +162,6 @@ static inline unsigned int get_rapl_pmu_idx(int
> cpu)
>                                         
> topology_logical_die_id(cpu);
>  }
>  
> -static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)
> -{
> -       unsigned int rapl_pmu_idx = get_rapl_pmu_idx(cpu);
> -
> -       /*
> -        * The unsigned check also catches the '-1' return value for
> non
> -        * existent mappings in the topology map.
> -        */
> -       return rapl_pmu_idx < rapl_pmus->nr_rapl_pmu ? rapl_pmus-
> >pmus[rapl_pmu_idx] : NULL;
> -}
> -
>  static inline u64 rapl_read_counter(struct perf_event *event)
>  {
>         u64 raw;
> @@ -348,7 +337,7 @@ static void rapl_pmu_event_del(struct perf_event
> *event, int flags)
>  static int rapl_pmu_event_init(struct perf_event *event)
>  {
>         u64 cfg = event->attr.config & RAPL_EVENT_MASK;
> -       int bit, ret = 0;
> +       int bit, rapl_pmu_idx, ret = 0;
>         struct rapl_pmu *pmu;
>  
>         /* only look at RAPL events */
> @@ -376,8 +365,12 @@ static int rapl_pmu_event_init(struct perf_event
> *event)
>         if (event->attr.sample_period) /* no sampling */
>                 return -EINVAL;
>  
> +       rapl_pmu_idx = get_rapl_pmu_idx(event->cpu);
> +       if (rapl_pmu_idx >= rapl_pmus->nr_rapl_pmu)
> +               return -EINVAL;
> +
>         /* must be done before validate_group */
> -       pmu = cpu_to_rapl_pmu(event->cpu);
> +       pmu = rapl_pmus->pmus[rapl_pmu_idx];
>         if (!pmu)
>                 return -EINVAL;
>         event->pmu_private = pmu;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ