Skip to contentSkip to conversation

tests/perf_pmu: Use perf timestamps when calculating average frequency

PATCH In review Tvrtko Ursulin 4 participants 6 messages Feb 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/perf_pmu: Use perf timestamps when calculating average frequency

From: Tvrtko Ursulin <[email protected]>

We can use perf reported timestamps to potentially get a more accurate frequency average.

Lets see if this improves the situation for sporadic failures like on APL:

Frequency: min=100, max=750, boost=750 MHz
Min frequency: requested 90.0, actual 90.0
Max frequency: requested 749.8, actual 647.9

---
 tests/perf_pmu.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
tests/perf_pmu.c +10 -9
index 681d4a55d006..14041ee686e8 100644
@@ -107,7 +107,7 @@ static uint64_t pmu_read_single(int fd)
 	return __pmu_read_single(fd, NULL);
 }
 
-static void pmu_read_multi(int fd, unsigned int num, uint64_t *val)
+static uint64_t pmu_read_multi(int fd, unsigned int num, uint64_t *val)
 {
 	uint64_t buf[2 + num];
 	unsigned int i;
@@ -116,6 +116,8 @@ static void pmu_read_multi(int fd, unsigned int num, uint64_t *val)
 
 	for (i = 0; i < num; i++)
 		val[i] = buf[2 + i];
+
+	return buf[1];
 }
 
 #define assert_within_epsilon(x, ref, tolerance) \
@@ -1167,9 +1169,8 @@ static void
 test_frequency(int gem_fd)
 {
 	uint32_t min_freq, max_freq, boost_freq;
-	uint64_t val[2], start[2];
+	uint64_t val[2], start[2], slept;
 	double min[2], max[2];
-	unsigned long slept;
 	igt_spin_t *spin;
 	int fd, sysfs;
 
@@ -1200,11 +1201,11 @@ test_frequency(int gem_fd)
 
 	gem_quiescent_gpu(gem_fd); /* Idle to be sure the change takes effect */
 	spin = igt_spin_batch_new(gem_fd, 0, I915_EXEC_RENDER, 0);
-	pmu_read_multi(fd, 2, start);
 
-	slept = measured_usleep(batch_duration_ns / 1000);
+	slept = pmu_read_multi(fd, 2, start);
+	measured_usleep(batch_duration_ns / 1000);
+	slept = pmu_read_multi(fd, 2, val) - slept;
 
-	pmu_read_multi(fd, 2, val);
 	min[0] = 1e9*(val[0] - start[0]) / slept;
 	min[1] = 1e9*(val[1] - start[1]) / slept;
 
@@ -1226,11 +1227,11 @@ test_frequency(int gem_fd)
 
 	gem_quiescent_gpu(gem_fd);
 	spin = igt_spin_batch_new(gem_fd, 0, I915_EXEC_RENDER, 0);
-	pmu_read_multi(fd, 2, start);
 
-	slept = measured_usleep(batch_duration_ns / 1000);
+	slept = pmu_read_multi(fd, 2, start);
+	measured_usleep(batch_duration_ns / 1000);
+	slept = pmu_read_multi(fd, 2, val) - slept;
 
-	pmu_read_multi(fd, 2, val);
 	max[0] = 1e9*(val[0] - start[0]) / slept;
 	max[1] = 1e9*(val[1] - start[1]) / slept;
 
Signature · 6 lines
2.14.1

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

Quoting Tvrtko Ursulin (2018-02-07 12:24:24)

Quoted 5 lines

From: Tvrtko Ursulin <[email protected]>

We can use perf reported timestamps to potentially get a more accurate frequency average.

Quoted 7 lines

Lets see if this improves the situation for sporadic failures like on APL:

Frequency: min=100, max=750, boost=750 MHz
Min frequency: requested 90.0, actual 90.0
Max frequency: requested 749.8, actual 647.9

Even if it doesn't using the embedded timestamp makes a lot more sense,

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 8 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-02-07 12:24:24)

Quoted 7 lines

From: Tvrtko Ursulin <[email protected]>

We can use perf reported timestamps to potentially get a more accurate frequency average.

Lets see if this improves the situation for sporadic failures like on APL:

Quoted 8 lines
Quoted 5 lines

Frequency: min=100, max=750, boost=750 MHz
Min frequency: requested 90.0, actual 90.0
Max frequency: requested 749.8, actual 647.9

Even if it doesn't using the embedded timestamp makes a lot more sense,

Thanks.

It will definitely not fix everything. For instance I think that on one SKL GT2 I see max frequency being reported as 1000 MHz while in actuality it can only reach 950 Mhz. What to do one machine like that one is the question.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Quoting Tvrtko Ursulin (2018-02-07 12:54:47)

Quoted 19 lines · Chris Wilson
Quoted 8 lines

Quoting Tvrtko Ursulin (2018-02-07 12:24:24)

Quoted 7 lines

From: Tvrtko Ursulin <[email protected]>

We can use perf reported timestamps to potentially get a more accurate frequency average.

Lets see if this improves the situation for sporadic failures like on APL:

Quoted 8 lines
Quoted 5 lines

Frequency: min=100, max=750, boost=750 MHz
Min frequency: requested 90.0, actual 90.0
Max frequency: requested 749.8, actual 647.9

Even if it doesn't using the embedded timestamp makes a lot more sense,

Quoted 6 lines

Thanks.

It will definitely not fix everything. For instance I think that on one SKL GT2 I see max frequency being reported as 1000 MHz while in actuality it can only reach 950 Mhz. What to do one machine like that one is the question.

The lies the CPU tells. We will have to assume that it isn't clamped by more than a bin or so, and may be just assert a one-sided tolerance i.e. can't be greater than max, but is allowed ~100MHz less? -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.BAT: success for tests/perf_pmu: Use perf timestamps when calculating average frequency

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: tests/perf_pmu: Use perf timestamps when calculating average frequency
URL : https://patchwork.freedesktop.org/series/37812/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 2baf7ece5b6d2faccedc56527ec91623f41a85e4 lib: Move __gem_context_create to common ioctl wrapper library.

with latest DRM-Tip kernel build CI_DRM_3735
94ca1ebb0652 drm-tip: 2018y-02m-07d-13h-38m-30s UTC integration manifest

No testlist changes.

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

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:420s
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:377s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:498s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:288s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:482s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:488s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:460s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:572s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:578s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:417s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:286s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:513s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:391s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:415s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:417s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:454s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:498s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:453s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:500s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:597s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:430s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:527s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:487s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:497s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:419s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:429s
fi-snb-2520m     total:245  pass:211  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:401s

Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:469s

== Logs ==

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

#5 lore raw

✗ Fi.CI.IGT: warning for tests/perf_pmu: Use perf timestamps when calculating average frequency

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: tests/perf_pmu: Use perf timestamps when calculating average frequency
URL : https://patchwork.freedesktop.org/series/37812/
State : warning

== Summary ==

Test kms_flip:

        Subgroup flip-vs-blocking-wf-vblank:
                fail       -> PASS       (shard-apl) fdo#100368
        Subgroup flip-vs-modeset-vs-hang-interruptible:
                pass       -> DMESG-WARN (shard-snb) fdo#104311
        Subgroup modeset-vs-vblank-race-interruptible:
                fail       -> PASS       (shard-hsw) fdo#103060
        Subgroup 2x-flip-vs-expired-vblank:
                fail       -> PASS       (shard-hsw) fdo#102887
Test kms_vblank:
        Subgroup pipe-b-ts-continuation-suspend:
                pass       -> SKIP       (shard-snb)
Test kms_cursor_crc:
        Subgroup cursor-128x128-suspend:
                skip       -> PASS       (shard-snb) fdo#103880
Test perf:
        Subgroup buffer-fill:
                fail       -> PASS       (shard-apl) fdo#103755
        Subgroup enable-disable:
                fail       -> PASS       (shard-apl) fdo#103715
Test kms_sysfs_edid_timing:
                pass       -> WARN       (shard-apl) fdo#100047

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104311 https://bugs.freedesktop.org/show_bug.cgi?id=104311
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103880 https://bugs.freedesktop.org/show_bug.cgi?id=103880
fdo#103755 https://bugs.freedesktop.org/show_bug.cgi?id=103755
fdo#103715 https://bugs.freedesktop.org/show_bug.cgi?id=103715
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047

shard-apl        total:3437 pass:1780 dwarn:1   dfail:0   fail:20  skip:1634 time:12568s
shard-hsw        total:3442 pass:1759 dwarn:1   dfail:0   fail:10  skip:1671 time:11752s
shard-snb        total:3442 pass:1348 dwarn:3   dfail:0   fail:10  skip:2081 time:6655s

== Logs ==

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