[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <97e10366-b9d2-5fae-74a5-8f7e314eafa4@linux.intel.com>
Date: Mon, 27 Feb 2023 11:20:58 -0500
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Deepak R Varma <drv@...lo.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Saurabh Singh Sengar <ssengar@...rosoft.com>,
Praveen Kumar <kumarpraveen@...ux.microsoft.com>
Subject: Re: [PATCH] perf/x86/core: Remove repeating test expression
On 2023-02-27 6:47 a.m., Deepak R Varma wrote:
> Current implementation already checks validity of the cpu_type for the
> hybrid pmu two lines above. Hence there is no need to again include
> it in the immediate if test evaluation.
The pmu_attr is different from the pmu. The pmu_attr is the
EVENT_ATTR_STR_HYBRID() which is defined in the kernel. The pmu is
calculated from the sysfs PMU entry. The first two line is to check
whether the attr is defined in the kernel. The second check is to find
the correct attr for the sysfs PMU entry. I don't think we should remove
the second check.
Thanks,
Kan
>
> Signed-off-by: Deepak R Varma <drv@...lo.com>
> ---
> arch/x86/events/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 87a7f0cd77fd..89db2352deb9 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -1893,7 +1893,7 @@ ssize_t events_hybrid_sysfs_show(struct device *dev,
> for (i = 0; i < x86_pmu.num_hybrid_pmus; i++) {
> if (!(x86_pmu.hybrid_pmu[i].cpu_type & pmu_attr->pmu_type))
> continue;
> - if (x86_pmu.hybrid_pmu[i].cpu_type & pmu->cpu_type) {
> + if (pmu->cpu_type) {
> next_str = strchr(str, ';');
> if (next_str)
> return snprintf(page, next_str - str + 1, "%s", str);
Powered by blists - more mailing lists