Skip to contentSkip to conversation

perf stat: Failure with "Operation not supported"

PATCH In review Anton Blanchard 1 participant 2 messages Dec 1, 2011 – Dec 8, 2011 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf stat: Failure with "Operation not supported"

perf stat is failing on PowerPC:

# perf stat /bin/true
  Error: open_counter returned with 95 (Operation not supported). /bin/dmesg may provide additional information.

Fatal: Not all events could be opened.

commit 370faf1dd046 (perf stat: Fail softly on unsupported events) added a check for failure returning ENOENT, but the POWER backend returns EOPNOTSUPP. It looks like alpha, blackfin and mips do the same.

With the patch applied, things work as expected:

# perf stat /bin/true
 Performance counter stats for '/bin/true':
          0.362176 task-clock                #    0.623 CPUs utilized          
                 0 context-switches          #    0.000 M/sec                  
                 0 CPU-migrations            #    0.000 M/sec                  
                28 page-faults               #    0.077 M/sec                  
         1,677,020 cycles                    #    4.630 GHz                    
   <not supported> stalled-cycles-frontend 
   <not supported> stalled-cycles-backend  
           431,220 instructions              #    0.26  insns per cycle        
           101,889 branches                  #  281.325 M/sec                  
             4,145 branch-misses             #    4.07% of all branches        
       0.000581361 seconds time elapsed

---

tools/perf/builtin-stat.c +2 -1
Index: linux/tools/perf/builtin-stat.c
===================================================================
@@ -463,7 +463,8 @@ static int run_perf_stat(int argc __used
 
 	list_for_each_entry(counter, &evsel_list->entries, node) {
 		if (create_perf_stat_counter(counter, first) < 0) {
-			if (errno == EINVAL || errno == ENOSYS || errno == ENOENT) {
+			if (errno == EINVAL || errno == ENOSYS ||
+			    errno == ENOENT || errno == EOPNOTSUPP) {
 				if (verbose)
 					ui__warning("%s event is not supported by the kernel.\n",
 						    event_name(counter));
#1 lore raw
Commit-ID:  38f6ae1e1b0d5e8b0a95f88c1eee2c5e8b001631
Gitweb:     http://git.kernel.org/tip/38f6ae1e1b0d5e8b0a95f88c1eee2c5e8b001631
Author:     Anton Blanchard <[email protected]>
AuthorDate: Fri, 2 Dec 2011 09:38:33 +1100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 5 Dec 2011 14:32:40 -0200

perf stat: Failure with "Operation not supported"

perf stat is failing on PowerPC:

Error: open_counter returned with 95 (Operation not supported). /bin/dmesg may provide additional information.

Fatal: Not all events could be opened.

commit 370faf1dd046 (perf stat: Fail softly on unsupported events) added a check for failure returning ENOENT, but the POWER backend returns EOPNOTSUPP. It looks like alpha, blackfin and mips do the same.

With the patch applied, things work as expected:

Performance counter stats for '/bin/true':

          0.362176 task-clock                #    0.623 CPUs utilized
                 0 context-switches          #    0.000 M/sec
                 0 CPU-migrations            #    0.000 M/sec
                28 page-faults               #    0.077 M/sec
         1,677,020 cycles                    #    4.630 GHz
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
           431,220 instructions              #    0.26  insns per cycle
           101,889 branches                  #  281.325 M/sec
             4,145 branch-misses             #    4.07% of all branches
       0.000581361 seconds time elapsed
---
 tools/perf/builtin-stat.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/perf/builtin-stat.c +2 -1
index 7d98676..955930e 100644
@@ -463,7 +463,8 @@ static int run_perf_stat(int argc __used, const char **argv)
 
 	list_for_each_entry(counter, &evsel_list->entries, node) {
 		if (create_perf_stat_counter(counter, first) < 0) {
-			if (errno == EINVAL || errno == ENOSYS || errno == ENOENT) {
+			if (errno == EINVAL || errno == ENOSYS ||
+			    errno == ENOENT || errno == EOPNOTSUPP) {
 				if (verbose)
 					ui__warning("%s event is not supported by the kernel.\n",
 						    event_name(counter));