All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] perf_event_open02: stop groups with hw counters first
@ 2019-10-16 11:24 Jan Stancek
  2019-10-16 11:24 ` [LTP] [PATCH 2/2] perf_event_open02: make test more reliable on -rt kernels Jan Stancek
  2019-10-16 11:38 ` [LTP] [PATCH 1/2] perf_event_open02: stop groups with hw counters first Cyril Hrubis
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Stancek @ 2019-10-16 11:24 UTC (permalink / raw)
  To: ltp

Nick reports that prctl(PR_TASK_PERF_EVENTS_DISABLE) doesn't stop tsk0
as last one, which sometimes causes test to fail, because of way test
calculates 'ratio' value and very low tolerance.

Looking at implementation, prctl() walks the list and does appear to
disable events in order they were created (tsk0 first).

Stop groups with hw counters before tsk0.

ratio     Before        After
mean      4.99921       4.99871
stdev     0.00006315    0.0000746

Fixes: #588
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/perf_event_open/perf_event_open02.c | 6 ++++++
 1 file changed, 6 insertions(+)

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 95e30519fe42..1cfe29bb3d8a 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -324,6 +324,12 @@ static void verify(void)
 
 	do_work();
 
+	/* stop groups with hw counters first before tsk0 */
+	for (i = 0; i < n; i++) {
+		ioctl(hwfd[i], PERF_EVENT_IOC_DISABLE);
+		ioctl(tskfd[i], PERF_EVENT_IOC_DISABLE);
+	}
+
 	if (prctl(PR_TASK_PERF_EVENTS_DISABLE) == -1) {
 		tst_brkm(TBROK | TERRNO, cleanup,
 			 "prctl(PR_TASK_PERF_EVENTS_DISABLE) failed");
-- 
1.8.3.1


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

end of thread, other threads:[~2019-10-18  8:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-16 11:24 [LTP] [PATCH 1/2] perf_event_open02: stop groups with hw counters first Jan Stancek
2019-10-16 11:24 ` [LTP] [PATCH 2/2] perf_event_open02: make test more reliable on -rt kernels Jan Stancek
2019-10-16 11:44   ` Cyril Hrubis
2019-10-16 12:42     ` Jan Stancek
2019-10-16 14:05       ` [LTP] [PATCH v2] " Jan Stancek
2019-10-16 14:14         ` Cyril Hrubis
2019-10-18  8:12           ` Jan Stancek
2019-10-16 11:38 ` [LTP] [PATCH 1/2] perf_event_open02: stop groups with hw counters first Cyril Hrubis

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.