* [PATCH] perf/x86/core: Remove repeating test expression
@ 2023-02-27 11:47 Deepak R Varma
2023-02-27 12:27 ` Deepak R Varma
2023-02-27 16:20 ` Liang, Kan
0 siblings, 2 replies; 3+ messages in thread
From: Deepak R Varma @ 2023-02-27 11:47 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, linux-perf-users, linux-kernel
Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma
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(-)
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] perf/x86/core: Remove repeating test expression
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
1 sibling, 0 replies; 3+ messages in thread
From: Deepak R Varma @ 2023-02-27 12:27 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, linux-perf-users, linux-kernel
Cc: Saurabh Singh Sengar, Praveen Kumar
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] perf/x86/core: Remove repeating test expression
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
1 sibling, 0 replies; 3+ messages in thread
From: Liang, Kan @ 2023-02-27 16:20 UTC (permalink / raw)
To: Deepak R Varma, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Thomas Gleixner, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, linux-perf-users, linux-kernel
Cc: Saurabh Singh Sengar, Praveen Kumar
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-27 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).