linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing
@ 2025-11-14 22:05 Ian Rogers
  2025-11-14 22:05 ` [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating Ian Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ian Rogers @ 2025-11-14 22:05 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Thomas Falcon, Howard Chu, James Clark,
	Zhongqiu Han, Anubhav Shelat, Ravi Bangoria, linux-perf-users,
	linux-kernel

Writing currently fails on non-x86 and hybrid CPUs. Switch to the more
regular find_core_pmu that is normally used in this case. Tested on
hybrid alderlake system.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index a2f808841b33..e69b271f8073 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1560,7 +1560,7 @@ static int __write_pmu_caps(struct feat_fd *ff, struct perf_pmu *pmu,
 static int write_cpu_pmu_caps(struct feat_fd *ff,
 			      struct evlist *evlist __maybe_unused)
 {
-	struct perf_pmu *cpu_pmu = perf_pmus__find("cpu");
+	struct perf_pmu *cpu_pmu = perf_pmus__find_core_pmu();
 	int ret;
 
 	if (!cpu_pmu)
-- 
2.52.0.rc1.455.g30608eb744-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating
  2025-11-14 22:05 [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Ian Rogers
@ 2025-11-14 22:05 ` Ian Rogers
  2025-11-24 12:34   ` Anubhav Shelat
  2025-11-25 11:41   ` [PATCH] perf pmu: fix duplicate conditional statement Anubhav Shelat
  2025-11-14 22:05 ` [PATCH v1 3/3] perf evsel: Skip store_evsel_ids for non-perf-event PMUs Ian Rogers
  2025-11-20 19:02 ` [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Namhyung Kim
  2 siblings, 2 replies; 11+ messages in thread
From: Ian Rogers @ 2025-11-14 22:05 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Thomas Falcon, Howard Chu, James Clark,
	Zhongqiu Han, Anubhav Shelat, Ravi Bangoria, linux-perf-users,
	linux-kernel

Rather than perf_pmu__is_xxx calls, and a notion of kind so that a
single call can be used.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/pmu.h | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 1ebcf0242af8..cfcaba3e2e75 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -37,6 +37,19 @@ struct perf_pmu_caps {
 	struct list_head list;
 };
 
+enum pmu_kind {
+	/* A perf event syscall PMU. */
+	PERF_PMU_KIND_PE,
+	/* A perf tool provided DRM PMU. */
+	PERF_PMU_KIND_DRM,
+	/* A perf tool provided HWMON PMU. */
+	PERF_PMU_KIND_HWMON,
+	/* Perf tool provided PMU for tool events like time. */
+	PERF_PMU_KIND_TOOL,
+	/* A testing PMU kind. */
+	PERF_PMU_KIND_FAKE
+};
+
 enum {
 	PERF_PMU_TYPE_PE_START    = 0,
 	PERF_PMU_TYPE_PE_END      = 0xFFFDFFFF,
@@ -306,4 +319,25 @@ void perf_pmu__delete(struct perf_pmu *pmu);
 const char *perf_pmu__name_from_config(struct perf_pmu *pmu, u64 config);
 bool perf_pmu__is_fake(const struct perf_pmu *pmu);
 
+static inline enum pmu_kind perf_pmu__kind(const struct perf_pmu *pmu)
+{
+	__u32 type;
+
+	if (!pmu)
+		return PERF_PMU_KIND_PE;
+
+	type = pmu->type;
+	if (type <= PERF_PMU_TYPE_PE_END)
+		return PERF_PMU_KIND_PE;
+	if (type <= PERF_PMU_TYPE_DRM_END)
+		return PERF_PMU_KIND_DRM;
+	if (type <= PERF_PMU_TYPE_DRM_END)
+		return PERF_PMU_KIND_DRM;
+	if (type <= PERF_PMU_TYPE_HWMON_END)
+		return PERF_PMU_KIND_HWMON;
+	if (type == PERF_PMU_TYPE_TOOL)
+		return PERF_PMU_KIND_TOOL;
+	return PERF_PMU_KIND_FAKE;
+}
+
 #endif /* __PMU_H */
-- 
2.52.0.rc1.455.g30608eb744-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v1 3/3] perf evsel: Skip store_evsel_ids for non-perf-event PMUs
  2025-11-14 22:05 [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Ian Rogers
  2025-11-14 22:05 ` [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating Ian Rogers
@ 2025-11-14 22:05 ` Ian Rogers
  2025-11-17 19:47   ` Falcon, Thomas
  2025-11-20 19:02 ` [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Namhyung Kim
  2 siblings, 1 reply; 11+ messages in thread
From: Ian Rogers @ 2025-11-14 22:05 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Thomas Falcon, Howard Chu, James Clark,
	Zhongqiu Han, Anubhav Shelat, Ravi Bangoria, linux-perf-users,
	linux-kernel

The IDs are associated with perf events and not applicable to non-perf
event PMUs. The failure to generate the ids was causing perf stat
record to fail.

```
$ perf stat record -a sleep 1

 Performance counter stats for 'system wide':

            47,941      context-switches                 #      nan cs/sec  cs_per_second
              0.00 msec cpu-clock                        #      0.0 CPUs  CPUs_utilized
             3,261      cpu-migrations                   #      nan migrations/sec  migrations_per_second
               516      page-faults                      #      nan faults/sec  page_faults_per_second
         7,525,483      cpu_core/branch-misses/          #      2.3 %  branch_miss_rate
       322,069,004      cpu_core/branches/               #      nan M/sec  branch_frequency
     1,895,684,291      cpu_core/cpu-cycles/             #      nan GHz  cycles_frequency
     2,789,777,426      cpu_core/instructions/           #      1.5 instructions  insn_per_cycle
         7,074,765      cpu_atom/branch-misses/          #      3.2 %  branch_miss_rate         (49.89%)
       224,225,412      cpu_atom/branches/               #      nan M/sec  branch_frequency     (50.29%)
     2,061,679,981      cpu_atom/cpu-cycles/             #      nan GHz  cycles_frequency       (50.33%)
     2,011,242,533      cpu_atom/instructions/           #      1.0 instructions  insn_per_cycle  (50.33%)
             TopdownL1 (cpu_core)                        #      9.0 %  tma_bad_speculation
                                                         #     28.3 %  tma_frontend_bound
                                                         #     35.2 %  tma_backend_bound
                                                         #     27.5 %  tma_retiring
             TopdownL1 (cpu_atom)                        #     36.8 %  tma_backend_bound        (59.65%)
                                                         #     22.8 %  tma_frontend_bound       (59.60%)
                                                         #     11.6 %  tma_bad_speculation
                                                         #     28.8 %  tma_retiring             (59.59%)

       1.006777519 seconds time elapsed

$ perf stat report

 Performance counter stats for 'perf':

     1,013,376,154      duration_time
     <not counted>      duration_time
     <not counted>      duration_time
     <not counted>      duration_time
     <not counted>      duration_time
     <not counted>      duration_time
            47,941      context-switches
              0.00 msec cpu-clock
             3,261      cpu-migrations
               516      page-faults
         7,525,483      cpu_core/branch-misses/
       322,069,814      cpu_core/branches/
       322,069,004      cpu_core/branches/
     1,895,684,291      cpu_core/cpu-cycles/
     1,895,679,209      cpu_core/cpu-cycles/
     2,789,777,426      cpu_core/instructions/
     <not counted>      cpu_core/cpu-cycles/
     <not counted>      cpu_core/stalled-cycles-frontend/
     <not counted>      cpu_core/cpu-cycles/
     <not counted>      cpu_core/stalled-cycles-backend/
     <not counted>      cpu_core/stalled-cycles-backend/
     <not counted>      cpu_core/instructions/
     <not counted>      cpu_core/stalled-cycles-frontend/
         7,074,765      cpu_atom/branch-misses/                                                 (49.89%)
       221,679,088      cpu_atom/branches/                                                      (49.89%)
       224,225,412      cpu_atom/branches/                                                      (50.29%)
     2,061,679,981      cpu_atom/cpu-cycles/                                                    (50.33%)
     2,016,259,567      cpu_atom/cpu-cycles/                                                    (50.33%)
     2,011,242,533      cpu_atom/instructions/                                                  (50.33%)
     <not counted>      cpu_atom/cpu-cycles/
     <not counted>      cpu_atom/stalled-cycles-frontend/
     <not counted>      cpu_atom/cpu-cycles/
     <not counted>      cpu_atom/stalled-cycles-backend/
     <not counted>      cpu_atom/stalled-cycles-backend/
     <not counted>      cpu_atom/instructions/
     <not counted>      cpu_atom/stalled-cycles-frontend/
        17,145,113      cpu_core/INT_MISC.UOP_DROPPING/
    10,594,226,100      cpu_core/TOPDOWN.SLOTS/
     2,919,021,401      cpu_core/topdown-retiring/
       943,101,838      cpu_core/topdown-bad-spec/
     3,031,152,533      cpu_core/topdown-fe-bound/
     3,739,756,791      cpu_core/topdown-be-bound/
     1,909,501,648      cpu_atom/CPU_CLK_UNHALTED.CORE/                                         (60.04%)
     3,516,608,359      cpu_atom/TOPDOWN_BE_BOUND.ALL/                                          (59.65%)
     2,179,403,876      cpu_atom/TOPDOWN_FE_BOUND.ALL/                                          (59.60%)
     2,745,732,458      cpu_atom/TOPDOWN_RETIRING.ALL/                                          (59.59%)

       1.006777519 seconds time elapsed

Some events weren't counted. Try disabling the NMI watchdog:
        echo 0 > /proc/sys/kernel/nmi_watchdog
        perf stat ...
        echo 1 > /proc/sys/kernel/nmi_watchdog
```

Reported-by: James Clark <james.clark@linaro.org>
Closes: https://lore.kernel.org/lkml/ca0f0cd3-7335-48f9-8737-2f70a75b019a@linaro.org/
Signed-off-by: Ian Rogers <irogers@google.com>
---
I looked into adding metrics to perf stat report but there would be a
merge conflict with:
https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/
so holding off for now.
---
 tools/perf/util/evsel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 989c56d4a23f..aee42666e882 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -3974,6 +3974,9 @@ static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
 	if (evsel__is_retire_lat(evsel))
 		return 0;
 
+	if (perf_pmu__kind(evsel->pmu) != PERF_PMU_KIND_PE)
+		return 0;
+
 	for (cpu_map_idx = 0; cpu_map_idx < xyarray__max_x(evsel->core.fd); cpu_map_idx++) {
 		for (thread = 0; thread < xyarray__max_y(evsel->core.fd);
 		     thread++) {
-- 
2.52.0.rc1.455.g30608eb744-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v1 3/3] perf evsel: Skip store_evsel_ids for non-perf-event PMUs
  2025-11-14 22:05 ` [PATCH v1 3/3] perf evsel: Skip store_evsel_ids for non-perf-event PMUs Ian Rogers
@ 2025-11-17 19:47   ` Falcon, Thomas
  0 siblings, 0 replies; 11+ messages in thread
From: Falcon, Thomas @ 2025-11-17 19:47 UTC (permalink / raw)
  To: james.clark@linaro.org, alexander.shishkin@linux.intel.com,
	ashelat@redhat.com, ravi.bangoria@amd.com, peterz@infradead.org,
	acme@kernel.org, mingo@redhat.com, Hunter, Adrian,
	linux-kernel@vger.kernel.org, namhyung@kernel.org,
	jolsa@kernel.org, howardchu95@gmail.com, irogers@google.com,
	linux-perf-users@vger.kernel.org, quic_zhonhan@quicinc.com

On Fri, 2025-11-14 at 14:05 -0800, Ian Rogers wrote:
> The IDs are associated with perf events and not applicable to non-perf
> event PMUs. The failure to generate the ids was causing perf stat
> record to fail.
> 

Hi Ian, looks good to me.

Tested-by: Thomas Falcon <thomas.falcon@intel.com>

Here's the output on my alder lake:

 % sudo ./perf stat record -a sleep 1


 Performance counter stats for 'system wide':

             3,485      context-switches                 #    144.8 cs/sec  cs_per_second     
         24,075.55 msec cpu-clock                        #     24.0    CPUs  CPUs_utilized       
               206      cpu-migrations                   #      8.6 migrations/sec  migrations_per_second
               678      page-faults                      #     28.2 faults/sec  page_faults_per_second
         1,508,292      cpu_core/branch-misses/          #      2.1 %  branch_miss_rate       
        73,298,298      cpu_core/branches/               #      3.0 M/sec  branch_frequency   
       319,787,502      cpu_core/cpu-cycles/             #      0.0 GHz  cycles_frequency     
       366,691,216      cpu_core/instructions/           #      1.1 instructions  insn_per_cycle
           455,948      cpu_atom/branch-misses/          #      1.6 %  branch_miss_rate         (49.87%)
        28,573,057      cpu_atom/branches/               #      1.2 M/sec  branch_frequency     (49.98%)
       235,791,714      cpu_atom/cpu-cycles/             #      0.0 GHz  cycles_frequency       (50.07%)
       158,014,230      cpu_atom/instructions/           #      0.7 instructions  insn_per_cycle  (50.15%)
             TopdownL1 (cpu_core)                        #      8.1 %  tma_bad_speculation    
                                                         #     37.0 %  tma_frontend_bound     
                                                         #     36.6 %  tma_backend_bound      
                                                         #     18.2 %  tma_retiring           
             TopdownL1 (cpu_atom)                        #     51.0 %  tma_backend_bound        (59.99%)
                                                         #     21.4 %  tma_frontend_bound       (59.90%)
                                                         #     11.5 %  tma_bad_speculation    
                                                         #     16.2 %  tma_retiring             (59.82%)

       1.003087466 seconds time elapsed


 % sudo ./perf stat report           

 Performance counter stats for '/home/tfalcon/perf-tools-next/tools/perf/perf':

     1,005,135,862      duration_time                                                         
     <not counted>      duration_time                                                         
     <not counted>      duration_time                                                         
     <not counted>      duration_time                                                         
     <not counted>      duration_time                                                         
     <not counted>      duration_time                                                         
             3,485      context-switches                                                      
         24,075.55 msec cpu-clock                                                             
               206      cpu-migrations                                                        
               678      page-faults                                                           
         1,508,292      cpu_core/branch-misses/                                               
        73,299,004      cpu_core/branches/                                                    
        73,298,298      cpu_core/branches/                                                    
       319,787,502      cpu_core/cpu-cycles/                                                  
       319,799,050      cpu_core/cpu-cycles/                                                  
       366,691,216      cpu_core/instructions/                                                
     <not counted>      cpu_core/cpu-cycles/                                                  
     <not counted>      cpu_core/stalled-cycles-frontend/                                      
     <not counted>      cpu_core/cpu-cycles/                                                  
     <not counted>      cpu_core/stalled-cycles-backend/                                      
     <not counted>      cpu_core/stalled-cycles-backend/                                      
     <not counted>      cpu_core/instructions/                                                
     <not counted>      cpu_core/stalled-cycles-frontend/                                      
           455,948      cpu_atom/branch-misses/                                                 (49.87%)
        29,378,879      cpu_atom/branches/                                                      (49.87%)
        28,573,057      cpu_atom/branches/                                                      (49.98%)
       235,791,714      cpu_atom/cpu-cycles/                                                    (50.07%)
       231,878,974      cpu_atom/cpu-cycles/                                                    (50.15%)
       158,014,230      cpu_atom/instructions/                                                  (50.15%)
     <not counted>      cpu_atom/cpu-cycles/                                                  
     <not counted>      cpu_atom/stalled-cycles-frontend/                                      
     <not counted>      cpu_atom/cpu-cycles/                                                  
     <not counted>      cpu_atom/stalled-cycles-backend/                                      
     <not counted>      cpu_atom/stalled-cycles-backend/                                      
     <not counted>      cpu_atom/instructions/                                                
     <not counted>      cpu_atom/stalled-cycles-frontend/                                      
         2,082,641      cpu_core/INT_MISC.UOP_DROPPING/                                       
     1,895,277,552      cpu_core/TOPDOWN.SLOTS/                                               
       345,024,206      cpu_core/topdown-retiring/                                            
       152,096,310      cpu_core/topdown-bad-spec/                                            
       704,850,131      cpu_core/topdown-fe-bound/                                            
       695,054,658      cpu_core/topdown-be-bound/                                            
       231,791,063      cpu_atom/CPU_CLK_UNHALTED.CORE/                                         (60.09%)
       590,930,101      cpu_atom/TOPDOWN_BE_BOUND.ALL/                                          (59.99%)
       247,501,143      cpu_atom/TOPDOWN_FE_BOUND.ALL/                                          (59.90%)
       187,767,093      cpu_atom/TOPDOWN_RETIRING.ALL/                                          (59.82%)

       1.003087466 seconds time elapsed

Some events weren't counted. Try disabling the NMI watchdog:
	echo 0 > /proc/sys/kernel/nmi_watchdog
	perf stat ...
	echo 1 > /proc/sys/kernel/nmi_watchdog

Thanks,
Tom

> ```
> $ perf stat record -a sleep 1
> 
>  Performance counter stats for 'system wide':
> 
>             47,941      context-switches                 #      nan cs/sec  cs_per_second
>               0.00 msec cpu-clock                        #      0.0 CPUs  CPUs_utilized
>              3,261      cpu-migrations                   #      nan migrations/sec  migrations_per_second
>                516      page-faults                      #      nan faults/sec  page_faults_per_second
>          7,525,483      cpu_core/branch-misses/          #      2.3 %  branch_miss_rate
>        322,069,004      cpu_core/branches/               #      nan M/sec  branch_frequency
>      1,895,684,291      cpu_core/cpu-cycles/             #      nan GHz  cycles_frequency
>      2,789,777,426      cpu_core/instructions/           #      1.5 instructions  insn_per_cycle
>          7,074,765      cpu_atom/branch-misses/          #      3.2 %  branch_miss_rate         (49.89%)
>        224,225,412      cpu_atom/branches/               #      nan M/sec  branch_frequency     (50.29%)
>      2,061,679,981      cpu_atom/cpu-cycles/             #      nan GHz  cycles_frequency       (50.33%)
>      2,011,242,533      cpu_atom/instructions/           #      1.0 instructions  insn_per_cycle  (50.33%)
>              TopdownL1 (cpu_core)                        #      9.0 %  tma_bad_speculation
>                                                          #     28.3 %  tma_frontend_bound
>                                                          #     35.2 %  tma_backend_bound
>                                                          #     27.5 %  tma_retiring
>              TopdownL1 (cpu_atom)                        #     36.8 %  tma_backend_bound        (59.65%)
>                                                          #     22.8 %  tma_frontend_bound       (59.60%)
>                                                          #     11.6 %  tma_bad_speculation
>                                                          #     28.8 %  tma_retiring             (59.59%)
> 
>        1.006777519 seconds time elapsed
> 
> $ perf stat report
> 
>  Performance counter stats for 'perf':
> 
>      1,013,376,154      duration_time
>      <not counted>      duration_time
>      <not counted>      duration_time
>      <not counted>      duration_time
>      <not counted>      duration_time
>      <not counted>      duration_time
>             47,941      context-switches
>               0.00 msec cpu-clock
>              3,261      cpu-migrations
>                516      page-faults
>          7,525,483      cpu_core/branch-misses/
>        322,069,814      cpu_core/branches/
>        322,069,004      cpu_core/branches/
>      1,895,684,291      cpu_core/cpu-cycles/
>      1,895,679,209      cpu_core/cpu-cycles/
>      2,789,777,426      cpu_core/instructions/
>      <not counted>      cpu_core/cpu-cycles/
>      <not counted>      cpu_core/stalled-cycles-frontend/
>      <not counted>      cpu_core/cpu-cycles/
>      <not counted>      cpu_core/stalled-cycles-backend/
>      <not counted>      cpu_core/stalled-cycles-backend/
>      <not counted>      cpu_core/instructions/
>      <not counted>      cpu_core/stalled-cycles-frontend/
>          7,074,765      cpu_atom/branch-misses/                                                 (49.89%)
>        221,679,088      cpu_atom/branches/                                                      (49.89%)
>        224,225,412      cpu_atom/branches/                                                      (50.29%)
>      2,061,679,981      cpu_atom/cpu-cycles/                                                    (50.33%)
>      2,016,259,567      cpu_atom/cpu-cycles/                                                    (50.33%)
>      2,011,242,533      cpu_atom/instructions/                                                  (50.33%)
>      <not counted>      cpu_atom/cpu-cycles/
>      <not counted>      cpu_atom/stalled-cycles-frontend/
>      <not counted>      cpu_atom/cpu-cycles/
>      <not counted>      cpu_atom/stalled-cycles-backend/
>      <not counted>      cpu_atom/stalled-cycles-backend/
>      <not counted>      cpu_atom/instructions/
>      <not counted>      cpu_atom/stalled-cycles-frontend/
>         17,145,113      cpu_core/INT_MISC.UOP_DROPPING/
>     10,594,226,100      cpu_core/TOPDOWN.SLOTS/
>      2,919,021,401      cpu_core/topdown-retiring/
>        943,101,838      cpu_core/topdown-bad-spec/
>      3,031,152,533      cpu_core/topdown-fe-bound/
>      3,739,756,791      cpu_core/topdown-be-bound/
>      1,909,501,648      cpu_atom/CPU_CLK_UNHALTED.CORE/                                         (60.04%)
>      3,516,608,359      cpu_atom/TOPDOWN_BE_BOUND.ALL/                                          (59.65%)
>      2,179,403,876      cpu_atom/TOPDOWN_FE_BOUND.ALL/                                          (59.60%)
>      2,745,732,458      cpu_atom/TOPDOWN_RETIRING.ALL/                                          (59.59%)
> 
>        1.006777519 seconds time elapsed
> 
> Some events weren't counted. Try disabling the NMI watchdog:
>         echo 0 > /proc/sys/kernel/nmi_watchdog
>         perf stat ...
>         echo 1 > /proc/sys/kernel/nmi_watchdog
> ```
> 
> Reported-by: James Clark <james.clark@linaro.org>
> Closes: https://lore.kernel.org/lkml/ca0f0cd3-7335-48f9-8737-2f70a75b019a@linaro.org/
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> I looked into adding metrics to perf stat report but there would be a
> merge conflict with:
> https://lore.kernel.org/lkml/20251113180517.44096-1-irogers@google.com/
> so holding off for now.
> ---
>  tools/perf/util/evsel.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 989c56d4a23f..aee42666e882 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -3974,6 +3974,9 @@ static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
>  	if (evsel__is_retire_lat(evsel))
>  		return 0;
>  
> +	if (perf_pmu__kind(evsel->pmu) != PERF_PMU_KIND_PE)
> +		return 0;
> +
>  	for (cpu_map_idx = 0; cpu_map_idx < xyarray__max_x(evsel->core.fd); cpu_map_idx++) {
>  		for (thread = 0; thread < xyarray__max_y(evsel->core.fd);
>  		     thread++) {


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing
  2025-11-14 22:05 [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Ian Rogers
  2025-11-14 22:05 ` [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating Ian Rogers
  2025-11-14 22:05 ` [PATCH v1 3/3] perf evsel: Skip store_evsel_ids for non-perf-event PMUs Ian Rogers
@ 2025-11-20 19:02 ` Namhyung Kim
  2 siblings, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2025-11-20 19:02 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Thomas Falcon,
	Howard Chu, James Clark, Zhongqiu Han, Anubhav Shelat,
	Ravi Bangoria, linux-perf-users, linux-kernel, Ian Rogers

On Fri, 14 Nov 2025 14:05:45 -0800, Ian Rogers wrote:
> Writing currently fails on non-x86 and hybrid CPUs. Switch to the more
> regular find_core_pmu that is normally used in this case. Tested on
> hybrid alderlake system.
> 
> 
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating
  2025-11-14 22:05 ` [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating Ian Rogers
@ 2025-11-24 12:34   ` Anubhav Shelat
  2025-11-24 20:22     ` Namhyung Kim
  2025-11-25 11:41   ` [PATCH] perf pmu: fix duplicate conditional statement Anubhav Shelat
  1 sibling, 1 reply; 11+ messages in thread
From: Anubhav Shelat @ 2025-11-24 12:34 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Thomas Falcon, Howard Chu, James Clark, Zhongqiu Han,
	Ravi Bangoria, linux-perf-users, linux-kernel

On Fri, Nov 14, 2025 at 10:06 PM Ian Rogers <irogers@google.com> wrote:
> +static inline enum pmu_kind perf_pmu__kind(const struct perf_pmu *pmu)
> +{
> +       __u32 type;
> +
> +       if (!pmu)
> +               return PERF_PMU_KIND_PE;
> +
> +       type = pmu->type;
> +       if (type <= PERF_PMU_TYPE_PE_END)
> +               return PERF_PMU_KIND_PE;
> +       if (type <= PERF_PMU_TYPE_DRM_END)
> +               return PERF_PMU_KIND_DRM;
> +       if (type <= PERF_PMU_TYPE_DRM_END)
> +               return PERF_PMU_KIND_DRM;
> +       if (type <= PERF_PMU_TYPE_HWMON_END)
> +               return PERF_PMU_KIND_HWMON;
> +       if (type == PERF_PMU_TYPE_TOOL)
> +               return PERF_PMU_KIND_TOOL;
> +       return PERF_PMU_KIND_FAKE;
> +}
> +

Looks like there's a duplicate check for PERF_PMU_TYPE_DRM_END.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating
  2025-11-24 12:34   ` Anubhav Shelat
@ 2025-11-24 20:22     ` Namhyung Kim
  0 siblings, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2025-11-24 20:22 UTC (permalink / raw)
  To: Anubhav Shelat
  Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Thomas Falcon,
	Howard Chu, James Clark, Zhongqiu Han, Ravi Bangoria,
	linux-perf-users, linux-kernel

Hello,

On Mon, Nov 24, 2025 at 12:34:11PM +0000, Anubhav Shelat wrote:
> On Fri, Nov 14, 2025 at 10:06 PM Ian Rogers <irogers@google.com> wrote:
> > +static inline enum pmu_kind perf_pmu__kind(const struct perf_pmu *pmu)
> > +{
> > +       __u32 type;
> > +
> > +       if (!pmu)
> > +               return PERF_PMU_KIND_PE;
> > +
> > +       type = pmu->type;
> > +       if (type <= PERF_PMU_TYPE_PE_END)
> > +               return PERF_PMU_KIND_PE;
> > +       if (type <= PERF_PMU_TYPE_DRM_END)
> > +               return PERF_PMU_KIND_DRM;
> > +       if (type <= PERF_PMU_TYPE_DRM_END)
> > +               return PERF_PMU_KIND_DRM;
> > +       if (type <= PERF_PMU_TYPE_HWMON_END)
> > +               return PERF_PMU_KIND_HWMON;
> > +       if (type == PERF_PMU_TYPE_TOOL)
> > +               return PERF_PMU_KIND_TOOL;
> > +       return PERF_PMU_KIND_FAKE;
> > +}
> > +
> 
> Looks like there's a duplicate check for PERF_PMU_TYPE_DRM_END.

Right, can you please send a fix?

Thanks,
Namhyung


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] perf pmu: fix duplicate conditional statement
  2025-11-14 22:05 ` [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating Ian Rogers
  2025-11-24 12:34   ` Anubhav Shelat
@ 2025-11-25 11:41   ` Anubhav Shelat
  2025-11-26  1:33     ` Mi, Dapeng
  2025-11-27 20:58     ` Namhyung Kim
  1 sibling, 2 replies; 11+ messages in thread
From: Anubhav Shelat @ 2025-11-25 11:41 UTC (permalink / raw)
  To: mpetlan, acme, namhyung, irogers, linux-perf-users
  Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa,
	adrian.hunter, kan.liang, dapeng1.mi, james.clark, Anubhav Shelat

Remove duplicate check for PERF_PMU_TYPE_DRM_END in perf_pmu__kind.

Fixes cedf1f4852ae.

Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
---
 tools/perf/util/pmu.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index cfcaba3e2e75..723a67cb41f4 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -331,8 +331,6 @@ static inline enum pmu_kind perf_pmu__kind(const struct perf_pmu *pmu)
 		return PERF_PMU_KIND_PE;
 	if (type <= PERF_PMU_TYPE_DRM_END)
 		return PERF_PMU_KIND_DRM;
-	if (type <= PERF_PMU_TYPE_DRM_END)
-		return PERF_PMU_KIND_DRM;
 	if (type <= PERF_PMU_TYPE_HWMON_END)
 		return PERF_PMU_KIND_HWMON;
 	if (type == PERF_PMU_TYPE_TOOL)
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] perf pmu: fix duplicate conditional statement
  2025-11-25 11:41   ` [PATCH] perf pmu: fix duplicate conditional statement Anubhav Shelat
@ 2025-11-26  1:33     ` Mi, Dapeng
  2025-11-26  2:27       ` Ian Rogers
  2025-11-27 20:58     ` Namhyung Kim
  1 sibling, 1 reply; 11+ messages in thread
From: Mi, Dapeng @ 2025-11-26  1:33 UTC (permalink / raw)
  To: Anubhav Shelat, mpetlan, acme, namhyung, irogers,
	linux-perf-users
  Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa,
	adrian.hunter, kan.liang, james.clark


On 11/25/2025 7:41 PM, Anubhav Shelat wrote:
> Remove duplicate check for PERF_PMU_TYPE_DRM_END in perf_pmu__kind.
>
> Fixes cedf1f4852ae.

The code change looks good to me. But the offensive commit hash ID seems
incorrect.

The change comes from this commit.

f0feb21e0a10 ("perf pmu: Add PMU kind to simplify differentiating")

Better add a "Fixes" tag for this change. 

>
> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
> ---
>  tools/perf/util/pmu.h | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> index cfcaba3e2e75..723a67cb41f4 100644
> --- a/tools/perf/util/pmu.h
> +++ b/tools/perf/util/pmu.h
> @@ -331,8 +331,6 @@ static inline enum pmu_kind perf_pmu__kind(const struct perf_pmu *pmu)
>  		return PERF_PMU_KIND_PE;
>  	if (type <= PERF_PMU_TYPE_DRM_END)
>  		return PERF_PMU_KIND_DRM;
> -	if (type <= PERF_PMU_TYPE_DRM_END)
> -		return PERF_PMU_KIND_DRM;
>  	if (type <= PERF_PMU_TYPE_HWMON_END)
>  		return PERF_PMU_KIND_HWMON;
>  	if (type == PERF_PMU_TYPE_TOOL)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] perf pmu: fix duplicate conditional statement
  2025-11-26  1:33     ` Mi, Dapeng
@ 2025-11-26  2:27       ` Ian Rogers
  0 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2025-11-26  2:27 UTC (permalink / raw)
  To: Mi, Dapeng
  Cc: Anubhav Shelat, mpetlan, acme, namhyung, linux-perf-users, peterz,
	mingo, mark.rutland, alexander.shishkin, jolsa, adrian.hunter,
	kan.liang, james.clark

On Tue, Nov 25, 2025 at 5:33 PM Mi, Dapeng <dapeng1.mi@linux.intel.com> wrote:
>
>
> On 11/25/2025 7:41 PM, Anubhav Shelat wrote:
> > Remove duplicate check for PERF_PMU_TYPE_DRM_END in perf_pmu__kind.
> >
> > Fixes cedf1f4852ae.
>
> The code change looks good to me. But the offensive commit hash ID seems
> incorrect.
>
> The change comes from this commit.
>
> f0feb21e0a10 ("perf pmu: Add PMU kind to simplify differentiating")
>
> Better add a "Fixes" tag for this change.

Thanks! I think the fixes tag should be:

Fixes:  f0feb21e0a10 ("perf pmu: Add PMU kind to simplify differentiating")

and there could also be:

Closes: https://lore.kernel.org/linux-perf-users/CA+G8Dh+wLx+FvjjoEkypqvXhbzWEQVpykovzrsHi2_eQjHkzQA@mail.gmail.com/

as well as:

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> >
> > Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
> > ---
> >  tools/perf/util/pmu.h | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> > index cfcaba3e2e75..723a67cb41f4 100644
> > --- a/tools/perf/util/pmu.h
> > +++ b/tools/perf/util/pmu.h
> > @@ -331,8 +331,6 @@ static inline enum pmu_kind perf_pmu__kind(const struct perf_pmu *pmu)
> >               return PERF_PMU_KIND_PE;
> >       if (type <= PERF_PMU_TYPE_DRM_END)
> >               return PERF_PMU_KIND_DRM;
> > -     if (type <= PERF_PMU_TYPE_DRM_END)
> > -             return PERF_PMU_KIND_DRM;
> >       if (type <= PERF_PMU_TYPE_HWMON_END)
> >               return PERF_PMU_KIND_HWMON;
> >       if (type == PERF_PMU_TYPE_TOOL)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] perf pmu: fix duplicate conditional statement
  2025-11-25 11:41   ` [PATCH] perf pmu: fix duplicate conditional statement Anubhav Shelat
  2025-11-26  1:33     ` Mi, Dapeng
@ 2025-11-27 20:58     ` Namhyung Kim
  1 sibling, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2025-11-27 20:58 UTC (permalink / raw)
  To: mpetlan, acme, irogers, linux-perf-users, Anubhav Shelat
  Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa,
	adrian.hunter, kan.liang, dapeng1.mi, james.clark

On Tue, 25 Nov 2025 11:41:18 +0000, Anubhav Shelat wrote:
> Remove duplicate check for PERF_PMU_TYPE_DRM_END in perf_pmu__kind.
> 
> Fixes cedf1f4852ae.
> 
> 
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-11-27 20:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14 22:05 [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Ian Rogers
2025-11-14 22:05 ` [PATCH v1 2/3] perf pmu: Add PMU kind to simplify differentiating Ian Rogers
2025-11-24 12:34   ` Anubhav Shelat
2025-11-24 20:22     ` Namhyung Kim
2025-11-25 11:41   ` [PATCH] perf pmu: fix duplicate conditional statement Anubhav Shelat
2025-11-26  1:33     ` Mi, Dapeng
2025-11-26  2:27       ` Ian Rogers
2025-11-27 20:58     ` Namhyung Kim
2025-11-14 22:05 ` [PATCH v1 3/3] perf evsel: Skip store_evsel_ids for non-perf-event PMUs Ian Rogers
2025-11-17 19:47   ` Falcon, Thomas
2025-11-20 19:02 ` [PATCH v1 1/3] perf header: Switch "cpu" for find_core_pmu in caps feature writing Namhyung Kim

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).