Skip to contentSkip to conversation

tests/perf: Add test to verify non-power-of-2 OA reports

PATCH In review Umesh Nerlige Ramappa 3 participants 4 messages Sep 13, 2019 – Sep 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/perf: Add test to verify non-power-of-2 OA reports

Add test to verify perf report size that is not a power of 2. Verify that the report that spans the boundary of the OA buffer is read correctly.

v2: (Lionel)
- Call sanity_check_reports to verify report contents.
- Move format definition to the end of the enum to avoid breaking API

---
 include/drm-uapi/i915_drm.h |   1 +
 tests/perf.c                | 115 ++++++++++++++++++++++++++++++++++++
 2 files changed, 116 insertions(+)
include/drm-uapi/i915_drm.h +1 -0
index 761517f1..befede6f 100644
@@ -1834,6 +1834,7 @@ enum drm_i915_oa_format {
 	I915_OA_FORMAT_A12,
 	I915_OA_FORMAT_A12_B8_C8,
 	I915_OA_FORMAT_A32u40_A4u32_B8_C8,
+	I915_OA_FORMAT_A29_B8_C8,
 
 	I915_OA_FORMAT_MAX	    /* non-ABI */
 };
tests/perf.c +115 -0

145 lines not on this page · raw message

Signature · 6 lines
2.20.1

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

[igt-dev] ✓ Fi.CI.BAT: success for tests/perf: Add test to verify non-power-of-2 OA reports

== Series Details ==

== Series Details ==

Series: tests/perf: Add test to verify non-power-of-2 OA reports
URL : https://patchwork.freedesktop.org/series/66696/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6894 -> IGTPW_3460
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/66696/revisions/1/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_3460:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@gem_ctx_create@basic-files:
- {fi-tgl-u2}: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/fi-tgl-u2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/fi-tgl-u2/igt@[email protected]

* igt@gem_exec_fence@nb-await-default:
- {fi-tgl-u}: [FAIL][3] ([fdo#111562] / [fdo#111597]) -> [WARN][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/fi-tgl-u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/fi-tgl-u/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_3460 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@prime_vgem@basic-read:
- fi-icl-u3: [PASS][5] -> [DMESG-WARN][6] ([fdo#107724]) +2 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/fi-icl-u3/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/fi-icl-u3/igt@[email protected]

#### Possible fixes ####

* igt@gem_mmap_gtt@basic-write-cpu-read-gtt:
- fi-icl-u3: [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8] +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/fi-icl-u3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/fi-icl-u3/igt@[email protected]

* igt@kms_chamelium@hdmi-crc-fast:
- fi-icl-u2: [FAIL][9] ([fdo#109635 ]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/fi-icl-u2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/fi-icl-u2/igt@[email protected]

#### Warnings ####

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][11] ([fdo#111096]) -> [FAIL][12] ([fdo#111407])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/fi-kbl-7500u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/fi-kbl-7500u/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#106350]: https://bugs.freedesktop.org/show_bug.cgi?id=106350
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[fdo#111562]: https://bugs.freedesktop.org/show_bug.cgi?id=111562
[fdo#111597]: https://bugs.freedesktop.org/show_bug.cgi?id=111597

Participating hosts (54 -> 46)
------------------------------

Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-gdg-551 fi-icl-y fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_5182 -> IGTPW_3460

CI-20190529: 20190529
CI_DRM_6894: a323fd657c577491b1660662624bac36bb964222 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3460: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/
IGT_5182: f7104497049e3761ac297b66fd5586849b3cfcc8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@perf@non-power-of-2-oa-formats

== Logs ==

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

#2 lore raw

[igt-dev] ✗ Fi.CI.IGT: failure for tests/perf: Add test to verify non-power-of-2 OA reports

In reply to Umesh Nerlige Ramappa
== Series Details ==

== Series Details ==

Series: tests/perf: Add test to verify non-power-of-2 OA reports
URL : https://patchwork.freedesktop.org/series/66696/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6894_full -> IGTPW_3460_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_3460_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_3460_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/66696/revisions/1/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_3460_full:

### IGT changes ###

#### Possible regressions ####

* {igt@perf@non-power-of-2-oa-formats} (NEW):
- shard-hsw: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-hsw6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb2/igt@[email protected]

* igt@perf@oa-formats:
- shard-hsw: [PASS][3] -> [FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-hsw2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-hsw4/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_6894_full and IGTPW_3460_full:

### New IGT tests (1) ###

* igt@perf@non-power-of-2-oa-formats:
- Statuses : 1 fail(s) 5 skip(s)
- Exec time: [0.0, 0.33] s

Known issues
------------

Here are the changes found in IGTPW_3460_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_balancer@smoke:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#110854])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb6/igt@[email protected]

* igt@gem_exec_schedule@deep-bsd:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#111325]) +5 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@promotion-bsd1:
- shard-iclb: [PASS][9] -> [SKIP][10] ([fdo#109276]) +15 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb1/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb8/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl: [PASS][11] -> [DMESG-WARN][12] ([fdo#108566]) +4 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-apl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-apl5/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank:
- shard-hsw: [PASS][13] -> [FAIL][14] ([fdo#105363])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-hsw2/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-hsw6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-shrfb-msflip-blt:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +6 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-shrfb-msflip-blt.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-shrfb-msflip-blt.html

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#103166])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb1/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb4/igt@[email protected]

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109441]) +2 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb1/igt@kms_psr@psr2_cursor_render.html

* igt@kms_vblank@pipe-b-wait-busy-hang:
- shard-apl: [PASS][21] -> [INCOMPLETE][22] ([fdo#103927]) +2 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-apl6/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-apl4/igt@[email protected]

#### Possible fixes ####

* igt@gem_eio@in-flight-suspend:
- shard-apl: [DMESG-WARN][23] ([fdo#108566]) -> [PASS][24] +5 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-apl4/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-apl5/igt@[email protected]

* igt@gem_eio@reset-stress:
- shard-iclb: [FAIL][25] ([fdo#109661]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb2/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb6/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-128x42-offscreen:
- shard-hsw: [INCOMPLETE][27] ([fdo#103540]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-hsw8/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-hsw5/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-64x21-random:
- shard-apl: [FAIL][29] ([fdo#103232]) -> [PASS][30] +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-apl2/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-apl7/igt@[email protected]
- shard-kbl: [FAIL][31] ([fdo#103232]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-kbl3/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-kbl1/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-kbl: [DMESG-WARN][33] ([fdo#108566]) -> [PASS][34] +1 similar issue
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-kbl3/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-kbl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-iclb: [FAIL][35] ([fdo#103167]) -> [PASS][36] +3 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb3/igt@[email protected]

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [SKIP][37] ([fdo#109441]) -> [PASS][38] +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb1/igt@kms_psr@psr2_primary_mmap_cpu.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html

* igt@kms_rotation_crc@cursor-rotation-180:
- shard-iclb: [INCOMPLETE][39] ([fdo#107713] / [fdo#110026]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb7/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb3/igt@[email protected]

* igt@kms_setmode@basic:
- shard-apl: [FAIL][41] ([fdo#99912]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-apl2/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-apl8/igt@[email protected]

* igt@prime_vgem@fence-wait-bsd2:
- shard-iclb: [SKIP][43] ([fdo#109276]) -> [PASS][44] +9 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb6/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb1/igt@[email protected]

#### Warnings ####

* igt@gem_mocs_settings@mocs-rc6-bsd2:
- shard-iclb: [SKIP][45] ([fdo#109276]) -> [FAIL][46] ([fdo#111330])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb7/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb1/igt@[email protected]

* igt@gem_mocs_settings@mocs-reset-bsd2:
- shard-iclb: [FAIL][47] ([fdo#111330]) -> [SKIP][48] ([fdo#109276]) +1 similar issue
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6894/shard-iclb1/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/shard-iclb5/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
[fdo#110026]: https://bugs.freedesktop.org/show_bug.cgi?id=110026
[fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 6)
------------------------------

Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_5182 -> IGTPW_3460
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_6894: a323fd657c577491b1660662624bac36bb964222 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3460: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3460/
IGT_5182: f7104497049e3761ac297b66fd5586849b3cfcc8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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

#3 lore raw
In reply to Umesh Nerlige Ramappa
Quoted 169 lines · Umesh Nerlige Ramappa

Add test to verify perf report size that is not a power of 2. Verify that the report that spans the boundary of the OA buffer is read correctly.

v2: (Lionel)
- Call sanity_check_reports to verify report contents.
- Move format definition to the end of the enum to avoid breaking API

---
  include/drm-uapi/i915_drm.h |   1 +
  tests/perf.c                | 115 ++++++++++++++++++++++++++++++++++++
  2 files changed, 116 insertions(+)
include/drm-uapi/i915_drm.h +1 -0
index 761517f1..befede6f 100644
@@ -1834,6 +1834,7 @@ enum drm_i915_oa_format {
  	I915_OA_FORMAT_A12,
  	I915_OA_FORMAT_A12_B8_C8,
  	I915_OA_FORMAT_A32u40_A4u32_B8_C8,
+	I915_OA_FORMAT_A29_B8_C8,
 
  	I915_OA_FORMAT_MAX	    /* non-ABI */
  };
tests/perf.c +110 -0
index 5ad8b2db..00c81b6d 100644
@@ -136,6 +136,11 @@ static struct oa_format hsw_oa_formats[I915_OA_FORMAT_MAX] = {
  		"C4_B8", .size = 64,
  		.c_off = 16, .n_c = 4,
  		.b_off = 28, .n_b = 8 },
+	[I915_OA_FORMAT_A29_B8_C8] = { /* HSW only */
+		"A29_B8_C8", .size = 192,
+		.a_off = 12,  .n_a = 29,
+		.b_off = 128, .n_b = 8,
+		.c_off = 160, .n_c = 8, },
  };
 
  static struct oa_format gen8_oa_formats[I915_OA_FORMAT_MAX] = {
@@ -1191,6 +1196,70 @@ test_missing_sample_flags(void)
  	do_ioctl_err(drm_fd, DRM_IOCTL_I915_PERF_OPEN, &param, EINVAL);
  }
 
+static void
+read_oa_reports(int format_id,
+		int exponent,
+		int max_reports)
+{
+	size_t format_size = get_oa_format(format_id).size;
+	size_t sample_size = (sizeof(struct drm_i915_perf_record_header) +
+			      format_size);
+	const struct drm_i915_perf_record_header *header;
+	uint32_t exponent_mask = (1 << (exponent + 1)) - 1;
+
+	/* Allocate twice max buffer size to verify odd report size support and
+	 * wrap around
+	 */
+	int buf_size = sample_size * max_reports * 1.5;
+	uint8_t *buf = malloc(buf_size);
+	uint8_t *rbuf = buf;
+	int num_reports = 0;
+	uint32_t *oa_report0;
+	ssize_t len = 0;
+
+	while (num_reports < max_reports) {
+		buf += len;
+		while ((len = read(stream_fd, buf, buf_size)) < 0 &&
+		       errno == EINTR)
+			;
+
+		igt_assert(len > 0);
+		igt_debug("read %d bytes\n", (int)len);
+
+		for (size_t offset = 0; (offset < len) && (num_reports < max_reports); offset += header->size) {
+			uint32_t *oa_report1;
+
+			header = (void *)(buf + offset);
+			igt_debug("header = %p\n", header);
+
+			igt_assert_eq(header->pad, 0);
+			igt_assert_neq(header->type, DRM_I915_PERF_RECORD_OA_BUFFER_LOST);
+			if (header->type == DRM_I915_PERF_RECORD_OA_REPORT_LOST) {
+				igt_debug("read restart: OA trigger collision / report lost\n");
+				num_reports = 0;
+				break;
+			}
+
+			igt_assert_eq(header->type, DRM_I915_PERF_RECORD_SAMPLE);
+			igt_assert_eq(header->size, sample_size);
+			oa_report1 = (void *)(header + 1);
+			igt_debug("read report: reason = %x, timestamp = %x, exponent mask=%x\n",
+				  oa_report1[0], oa_report1[1], exponent_mask);
+			igt_assert_neq(oa_report1[1], 0);
+
+			num_reports++;
+			if (num_reports >= 2) {
+				sanity_check_reports(oa_report0, oa_report1,
+						     format_id);
+			}
+			oa_report0 = oa_report1;
+		}
+	}
+
+	igt_debug("num_reports %d\n", num_reports);
+	free(rbuf);
+}
+
  static void
  read_2_oa_reports(int format_id,
  		  int exponent,
@@ -1304,6 +1373,34 @@ read_2_oa_reports(int format_id,
  	igt_assert(!"reached");
  }
 
+static void
+open_and_read_oa_reports(int format_id,
+			 int exponent,
+			 int num_reports)
+{
+	uint64_t properties[] = {
+		/* Include OA reports in samples */
+		DRM_I915_PERF_PROP_SAMPLE_OA, true,
+
+		/* OA unit configuration */
+		DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id,
+		DRM_I915_PERF_PROP_OA_FORMAT, format_id,
+		DRM_I915_PERF_PROP_OA_EXPONENT, exponent,
+
+	};
+	struct drm_i915_perf_open_param param = {
+		.flags = I915_PERF_FLAG_FD_CLOEXEC,
+		.num_properties = sizeof(properties) / 16,
+		.properties_ptr = to_user_pointer(properties),
+	};
+
+	stream_fd = __perf_open(drm_fd, &param, false);
+
+	read_oa_reports(format_id, exponent, num_reports);
+
+	__perf_close(stream_fd);
+}
+
  static void
  open_and_read_2_oa_reports(int format_id,
  			   int exponent,
@@ -1493,6 +1590,19 @@ print_report(uint32_t *report, int fmt)
  }
  #endif
 
+static void
+test_non_power_of_2_oa_formats(void)
+{
+	struct oa_format format = get_oa_format(I915_OA_FORMAT_A29_B8_C8);
+	int num_reports = ((MAX_OA_BUF_SIZE / format.size) << 1) + 100;
+
+	igt_assert(format.name);
+	igt_debug("Reading %d reports for OA format %s\n", num_reports, format.name);
+	open_and_read_oa_reports(I915_OA_FORMAT_A29_B8_C8,
+				 oa_exp_1_millisec,
+				 num_reports);
+}
+
  static void
  test_oa_formats(void)
  {

tests/perf.c igt_main · line 4239

Quoted 6 lines
tests/perf.c +3 -0
@@ -4124,6 +4234,11 @@ igt_main
  	igt_subtest("oa-formats")
  		test_oa_formats();
 
+	igt_subtest("non-power-of-2-oa-formats") {
+		igt_require(IS_HASWELL(devid));
+		test_non_power_of_2_oa_formats();

Like I mentioned on the kernel series, the kernel change associated with this test should be versioned and this test only be run if the perf version is appropriate.

That way it won't fail on older kernels.

-Lionel

tests/perf.c igt_main · line 4244

Quoted 5 lines
tests/perf.c +2 -0
+	}
+
  	igt_subtest("invalid-oa-exponent")
  		test_invalid_oa_exponent();
  	igt_subtest("low-oa-exponent-permissions")

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