linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Deepak R Varma <drv@mailo.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
	Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: Re: [PATCH] perf/x86/core: Remove repeating test expression
Date: Mon, 27 Feb 2023 11:20:58 -0500	[thread overview]
Message-ID: <97e10366-b9d2-5fae-74a5-8f7e314eafa4@linux.intel.com> (raw)
In-Reply-To: <Y/yYTY7c7L0+d+Gb@ubun2204.myguest.virtualbox.org>



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@mailo.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);

      parent reply	other threads:[~2023-02-27 16:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 11:47 [PATCH] perf/x86/core: Remove repeating test expression Deepak R Varma
2023-02-27 12:27 ` Deepak R Varma
2023-02-27 16:20 ` Liang, Kan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97e10366-b9d2-5fae-74a5-8f7e314eafa4@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=drv@mailo.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=kumarpraveen@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ssengar@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).