Skip to contentSkip to conversation

perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported

RFC PATCH New Li Wang 3 participants 4 messages Mar 12, 2019 – Mar 20, 2019

lore
Share & tools
lore

Li Wang

author
#0 lore raw

RFC PATCH 1/1 perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported

The testcase is broken on system with PERF_COUNT_HW_INSTRUCTIONS not supported. Previously, it does the event check in count_hardware_counters, but that has been filtered out on s390 platform via commit 6730475ba5. So now test break as follow:

  perf_event_open02    1  TBROK  :  perf_event_open02.c:275: perf_event_open failed: errno=ENOENT(2): No such file or directory
  perf_event_open02    2  TBROK  :  perf_event_open02.c:275: Remaining cases broken
---
 .../perf_event_open/perf_event_open02.c         | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +14 -3
index cdaa5c80c..95e30519f 100644
@@ -268,9 +268,20 @@ static void setup(void)
 		tsk_event.disabled = 0;
 		for (i = 0; i < n; ++i) {
 			hwfd[i] = perf_event_open(&hw_event, 0, -1, -1, 0);
-			tskfd[i] = perf_event_open(&tsk_event, 0, -1,
-						   hwfd[i], 0);
-			if (tskfd[i] == -1 || hwfd[i] == -1) {
+			if (hwfd[i] == -1) {
+				if (errno == ENOENT || errno == ENODEV) {
+					tst_brkm(TCONF | TERRNO, cleanup,
+						"PERF_COUNT_HW_INSTRUCTIONS not supported");
+				}
+				tst_brkm(TBROK | TERRNO, cleanup,
+					 "perf_event_open failed");
+			}
+			tskfd[i] = perf_event_open(&tsk_event, 0, -1, hwfd[i], 0);
+			if (tskfd[i] == -1) {
+				if (errno == ENOENT || errno == ENODEV) {
+					tst_brkm(TCONF | TERRNO, cleanup,
+						"PERF_COUNT_SW_TASK_CLOCK not supported");
+				}
 				tst_brkm(TBROK | TERRNO, cleanup,
 					 "perf_event_open failed");
 			}
Signature · 1 line
2.20.1
#1 lore raw

RFC PATCH 1/1 perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported

Looks good to me.

Am Tue, 12 Mar 2019 13:32:36 +0800
schrieb Li Wang <[email protected]>:

Quoted 40 lines

The testcase is broken on system with PERF_COUNT_HW_INSTRUCTIONS not supported. Previously, it does the event check in count_hardware_counters, but that has been filtered out on s390 platform via commit 6730475ba5. So now test break as follow:

  perf_event_open02    1  TBROK  :  perf_event_open02.c:275: perf_event_open failed: errno=ENOENT(2): No such file or directory
  perf_event_open02    2  TBROK  :  perf_event_open02.c:275: Remaining cases broken
---
 .../perf_event_open/perf_event_open02.c         | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +14 -3
index cdaa5c80c..95e30519f 100644
@@ -268,9 +268,20 @@ static void setup(void)
 		tsk_event.disabled = 0;
 		for (i = 0; i < n; ++i) {
 			hwfd[i] = perf_event_open(&hw_event, 0, -1, -1, 0);
-			tskfd[i] = perf_event_open(&tsk_event, 0, -1,
-						   hwfd[i], 0);
-			if (tskfd[i] == -1 || hwfd[i] == -1) {
+			if (hwfd[i] == -1) {
+				if (errno == ENOENT || errno == ENODEV) {
+					tst_brkm(TCONF | TERRNO, cleanup,
+						"PERF_COUNT_HW_INSTRUCTIONS not supported");
+				}
+				tst_brkm(TBROK | TERRNO, cleanup,
+					 "perf_event_open failed");
+			}
+			tskfd[i] = perf_event_open(&tsk_event, 0, -1, hwfd[i], 0);
+			if (tskfd[i] == -1) {
+				if (errno == ENOENT || errno == ENODEV) {
+					tst_brkm(TCONF | TERRNO, cleanup,
+						"PERF_COUNT_SW_TASK_CLOCK not supported");
+				}
 				tst_brkm(TBROK | TERRNO, cleanup,
 					 "perf_event_open failed");
 			}
#2 lore raw

RFC PATCH 1/1 perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported

----- Original Message -----

Quoted 19 lines

Looks good to me.

Am Tue, 12 Mar 2019 13:32:36 +0800
schrieb Li Wang <[email protected]>:

Quoted 12 lines

The testcase is broken on system with PERF_COUNT_HW_INSTRUCTIONS not supported.
Previously, it does the event check in count_hardware_counters, but that has
been filtered out on s390 platform via commit 6730475ba5. So now test break as follow:
perf_event_open02 1 TBROK : perf_event_open02.c:275:
perf_event_open failed: errno=ENOENT(2): No such file or directory
perf_event_open02 2 TBROK : perf_event_open02.c:275: Remaining
cases broken

Pushed.

Thanks,
Jan

author
#3 lore raw

RFC PATCH 1/1 perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported

In reply to Li Wang

ping~

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190320/fb32983d/attachment.html>