Skip to contentSkip to conversation

lib/igt_perf: Find active perf CPU

PATCH In review Tvrtko Ursulin 4 participants 5 messages Feb 21, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_perf: Find active perf CPU

From: Tvrtko Ursulin <[email protected]>

Instead of assuming PMU runs on CPU0, try all possible CPUs if that is not the case. This makes the callers handle fallout from broken tests better, as well as sysadmin interventions where callers are not tests.

---
 lib/igt_perf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
lib/igt_perf.c +8 -1
index 0221461e918f..99d82ea51c9b 100644
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <sys/sysinfo.h>
 
 #include "igt_perf.h"
 
@@ -31,6 +32,8 @@ static int
 _perf_open(uint64_t type, uint64_t config, int group, uint64_t format)
 {
 	struct perf_event_attr attr = { };
+	int nr_cpus = get_nprocs_conf();
+	int cpu = 0, ret;
 
 	attr.type = type;
 	if (attr.type == 0)
@@ -42,7 +45,11 @@ _perf_open(uint64_t type, uint64_t config, int group, uint64_t format)
 	attr.read_format = format;
 	attr.config = config;
 
-	return perf_event_open(&attr, -1, 0, group, 0);
+	do {
+		ret = perf_event_open(&attr, -1, cpu++, group, 0);
+	} while ((ret < 0 && errno == EINVAL) && (cpu < nr_cpus));
+
+	return ret;
 }
 
 int perf_i915_open(uint64_t config)
Signature · 6 lines
2.14.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 1/1
#1 lore raw

Quoting Tvrtko Ursulin (2018-02-21 10:29:57)

Quoted 8 lines

From: Tvrtko Ursulin <[email protected]>

Instead of assuming PMU runs on CPU0, try all possible CPUs if that is not the case. This makes the callers handle fallout from broken tests better, as well as sysadmin interventions where callers are not tests.

As a bonus it also helps document the perf_open() call.

Are we not allowed to pass cpu=-1 for any/all cpus? -Chris
_______________________________________________
igt-dev mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
Quoted 7 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-02-21 10:29:57)

Quoted 6 lines

From: Tvrtko Ursulin <[email protected]>

Instead of assuming PMU runs on CPU0, try all possible CPUs if that is not the case. This makes the callers handle fallout from broken tests better, as well as sysadmin interventions where callers are not tests.

Quoted 5 lines
Quoted 2 lines

As a bonus it also helps document the perf_open() call.

Thanks!

Quoted 1 line

Are we not allowed to pass cpu=-1 for any/all cpus?

No, that is documented to return -EINVAL from perf core. I guess it comes from the per-CPU nature of perf.

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for lib/igt_perf: Find active perf CPU

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: lib/igt_perf: Find active perf CPU
URL : https://patchwork.freedesktop.org/series/38686/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 960e55a87d7b7d7385063e37cc9f281df2be8037 igt/gem_ctx_isolation: Check isolation of registers between contexts

with latest DRM-Tip kernel build CI_DRM_3816
42d073db2a85 drm-tip: 2018y-02m-21d-14h-03m-58s UTC integration manifest

No testlist changes.

Test gem_mmap_gtt:

        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                fail       -> PASS       (fi-ivb-3520m)
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
                fail       -> PASS       (fi-ivb-3520m)
        Subgroup suspend-read-crc-pipe-c:
                fail       -> PASS       (fi-ivb-3520m)

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:418s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:427s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:375s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:490s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:285s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:479s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:468s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:456s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:565s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:414s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:284s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:505s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:386s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:409s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:457s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:409s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:453s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:489s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:451s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:494s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:590s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:428s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:499s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:520s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:489s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:472s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:407s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:432s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:516s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:397s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_969/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for lib/igt_perf: Find active perf CPU

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: lib/igt_perf: Find active perf CPU
URL : https://patchwork.freedesktop.org/series/38686/
State : success

== Summary ==

Test kms_flip:

        Subgroup modeset-vs-vblank-race-interruptible:
                fail       -> PASS       (shard-apl) fdo#103060
        Subgroup 2x-flip-vs-absolute-wf_vblank-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368 +1
        Subgroup blocking-wf_vblank:
                pass       -> FAIL       (shard-hsw) fdo#103928
Test kms_plane_multiple:
        Subgroup legacy-pipe-b-tiling-none:
                skip       -> PASS       (shard-snb)
Test kms_cursor_legacy:
        Subgroup flip-vs-cursor-toggle:
                pass       -> FAIL       (shard-hsw) fdo#102670
Test kms_vblank:
        Subgroup pipe-b-wait-busy-hang:
                skip       -> PASS       (shard-snb)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c-frame-sequence:
                fail       -> PASS       (shard-apl) fdo#103481
Test perf:
        Subgroup oa-exponents:
                pass       -> FAIL       (shard-apl) fdo#102254
Test kms_atomic_transition:
        Subgroup 1x-modeset-transitions-nonblocking-fencing:
                fail       -> PASS       (shard-apl) fdo#103207

fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207

shard-apl        total:3376 pass:1776 dwarn:1   dfail:0   fail:13  skip:1585 time:12272s
shard-hsw        total:3465 pass:1766 dwarn:1   dfail:0   fail:4   skip:1693 time:11724s
shard-snb        total:3465 pass:1357 dwarn:1   dfail:0   fail:3   skip:2104 time:6711s

Blacklisted hosts:
shard-kbl total:3432 pass:1946 dwarn:1 dfail:0 fail:15 skip:1469 time:9523s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_969/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev