Message ID | Y/yYTY7c7L0+d+Gb@ubun2204.myguest.virtualbox.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2368240wrd; Mon, 27 Feb 2023 03:52:44 -0800 (PST) X-Google-Smtp-Source: AK7set9wGJE0TYYecwr0EMsGzzC9FuR3JAIRY67nnRcvdUqJeJgqIM36URNFeijEVaRQ5YgmqW5g X-Received: by 2002:a17:906:1747:b0:8b1:3d15:1e2c with SMTP id d7-20020a170906174700b008b13d151e2cmr30367294eje.9.1677498764454; Mon, 27 Feb 2023 03:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677498764; cv=none; d=google.com; s=arc-20160816; b=hNgzH5fThBy5/GxHt/zSrVfPdQ7SD67XB3CASFh8YPwiUQYYuxirgh2eJDPRIAdbfC nACdvkcVBLA533cJfYATHuRTbguWjfMhGoj+LGPITKSxiSTQFn3lC3JYytkjPL8+uht+ Mk6adqXjgqgvPQt8sHHDFQJ5lKVRHYI9tRQY+fxkBAOGyXC40FCoy1IRzNaqJUnZwDaw sY63oCu8xbc6ZLG4i6mhSMyLlmdqPNJWYr72AF9CEUlYEkS7e7CoGeD1Wl+UZyLFrR6C v1aBwORJ0/MrG85ZTwlEDUkJoGQ2h5IlB9ywuQ6/JlAwdRBywlI0dmGsdB5bC09nCJNG P/yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=h3do3LqCzSufGs2y6twRsiMv/9XK+VbeSPE+ldTtIdA=; b=ZpHa1faHqYtVcRCzNkI78rpoDnjb/UV+z/krRd9mAHTyn2Eb7dDoXNHah61PmcCtYD ec0GtIOGFoBpy5a4hlNEURuwDv5xNRiTBSWDf+67Pgz3fZ5H0y8/QyGulrGr/lQJATYX sOCD/0k4/6n9gFhfh+94P3Cj/A7jsGoZWZItU61awnO3K9rUAyRIGcqMEppc6R1E8dm0 CuUr8ixcWCmLFOt+m5z7cFOxJpv63nAVyKdRWIqZyNGO4hobgLW3DF8RsR9pSH8SHR30 3CWb6A6jlHCTPLZlNRP17cnCsYvp5YB8ItX2M2FCF880pqhXt4rSiqke/vzrH2ybYLlO 0Dcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=dJliIvk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by16-20020a170906a2d000b008c349e2ca96si7339163ejb.719.2023.02.27.03.52.22; Mon, 27 Feb 2023 03:52:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=dJliIvk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbjB0LsX (ORCPT <rfc822;wenzhi022@gmail.com> + 99 others); Mon, 27 Feb 2023 06:48:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjB0LsR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Feb 2023 06:48:17 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 312501E9EE; Mon, 27 Feb 2023 03:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1677498451; bh=CI8s0gM0tMtJHBxeXCTI0IQpxz9851TtDO86l4aVjx8=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=dJliIvk6QlvwU3rCzUk7QBq8DjwevOBDejXxpnGzrv5IRr35EL9X+AqYuXMlkhaBZ rA4TE7VY6Drey4OqIjNoESTa/LM0N9qYlr1cSr6j7eAjQu4C3E4b5jMK1WnrbuMku0 qo7RAi3ekl3i4jnj2hO9r0hCJfIVVXR4Axqs7SmQ= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Mon, 27 Feb 2023 12:47:31 +0100 (CET) X-EA-Auth: vnFL1j1Pzw06bs3ZGVnme+e34tOLBxQ0GRjIE9QE87xaKerSboINzXlNieTuym4CdlL72C+mDKJR3y52TlF1tA== Date: Mon, 27 Feb 2023 17:17:25 +0530 From: Deepak R Varma <drv@mailo.com> To: 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>, Deepak R Varma <drv@mailo.com> Subject: [PATCH] perf/x86/core: Remove repeating test expression Message-ID: <Y/yYTY7c7L0+d+Gb@ubun2204.myguest.virtualbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758984944763029968?= X-GMAIL-MSGID: =?utf-8?q?1758984944763029968?= |
Series |
perf/x86/core: Remove repeating test expression
|
|
Commit Message
Deepak R Varma
Feb. 27, 2023, 11:47 a.m. UTC
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.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
arch/x86/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Feb 27, 2023 at 05:17:25PM +0530, 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. > > Signed-off-by: Deepak R Varma <drv@mailo.com> > --- Please disregard. I misread the bitwise operation as logical evaluation. Sorry for any inconvenience. Deepak. > 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); > -- > 2.34.1 >
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);
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);