All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported
@ 2019-03-12  5:32 Li Wang
  2019-03-12 12:54 ` Michael Holzheu
  2019-03-20  9:19 ` Li Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Li Wang @ 2019-03-12  5:32 UTC (permalink / raw)
  To: ltp

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

Signed-off-by: Li Wang <liwang@redhat.com>
---
 .../perf_event_open/perf_event_open02.c         | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
index cdaa5c80c..95e30519f 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -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.20.1


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

* [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported
  2019-03-12  5:32 [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported Li Wang
@ 2019-03-12 12:54 ` Michael Holzheu
  2019-03-20 12:24   ` Jan Stancek
  2019-03-20  9:19 ` Li Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Holzheu @ 2019-03-12 12:54 UTC (permalink / raw)
  To: ltp

Looks good to me.

Reviewed-by: Michael Holzheu <holzheu@linux.ibm.com>

Am Tue, 12 Mar 2019 13:32:36 +0800
schrieb Li Wang <liwang@redhat.com>:

> 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
> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  .../perf_event_open/perf_event_open02.c         | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> index cdaa5c80c..95e30519f 100644
> --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> @@ -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");
>  			}


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

* [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported
  2019-03-12  5:32 [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported Li Wang
  2019-03-12 12:54 ` Michael Holzheu
@ 2019-03-20  9:19 ` Li Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Li Wang @ 2019-03-20  9:19 UTC (permalink / raw)
  To: ltp

ping~

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

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

* [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported
  2019-03-12 12:54 ` Michael Holzheu
@ 2019-03-20 12:24   ` Jan Stancek
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Stancek @ 2019-03-20 12:24 UTC (permalink / raw)
  To: ltp


----- Original Message -----
> Looks good to me.
> 
> Reviewed-by: Michael Holzheu <holzheu@linux.ibm.com>
> 
> Am Tue, 12 Mar 2019 13:32:36 +0800
> schrieb Li Wang <liwang@redhat.com>:
> 
> > 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
> > 
> > Signed-off-by: Li Wang <liwang@redhat.com>

Pushed.

Thanks,
Jan

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

end of thread, other threads:[~2019-03-20 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  5:32 [LTP] [PATCH RFC] perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supported Li Wang
2019-03-12 12:54 ` Michael Holzheu
2019-03-20 12:24   ` Jan Stancek
2019-03-20  9:19 ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.