Skip to contentSkip to conversation

tests/panfrost: Add infinite job test

PATCH New Steven Price 2 participants 3 messages Sep 13, 2019 – Sep 14, 2019 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/panfrost: Add infinite job test

Construct a loop of three job descriptors that will execute continuously. Then free the BO backing the job descriptors (before the timeout) causing a page fault on the GPU. The GPU fault will race with the destruction of the BO.

---
This is a test for the bug fixed by "Prevent race when handling page fault"[1]

[1] https://lore.kernel.org/lkml/[email protected]/

 lib/igt_panfrost.c      | 50 +++++++++++++++++++++++++++++++++++++++++
 lib/igt_panfrost.h      |  1 +
 lib/panfrost-job.h      |  6 ++++-
 tests/panfrost_submit.c | 14 ++++++++++++
 4 files changed, 70 insertions(+), 1 deletion(-)
lib/igt_panfrost.c +50 -0
index 8b0c2b77..04dac3d7 100644
@@ -72,6 +72,8 @@ igt_panfrost_gem_new(int fd, size_t size)
 void
 igt_panfrost_free_bo(int fd, struct panfrost_bo *bo)
 {
+        if (!bo)
+                return;
         if (bo->map)
                 munmap(bo->map, bo->size);
         gem_close(fd, bo->handle);
@@ -127,6 +129,54 @@ void igt_panfrost_bo_mmap(int fd, struct panfrost_bo *bo)
         igt_assert(bo->map);
 }
 
+struct panfrost_submit *igt_panfrost_infinite_job(int fd)
+{
+        struct panfrost_submit *submit;
+        struct mali_job_descriptor_header header = {
+                .job_type = JOB_TYPE_SET_VALUE,
+                .job_descriptor_size = MALI_JOB_64
+        };
+        struct mali_payload_set_value payload = {
+                .value_descriptor = MALI_SET_VALUE_ZERO,
+                .immediate = JOB_NOT_STARTED
+        };
+        int i;
+        int size = ALIGN(sizeof(header) + sizeof(payload), 64);
+        uint32_t *bos;
+
+        submit = calloc(1, sizeof(*submit));
+
+        submit->submit_bo = igt_panfrost_gem_new(fd, size * 3);
+        igt_panfrost_bo_mmap(fd, submit->submit_bo);
+
+        for(i = 0; i < 3; i++) {
+                int offset = i * size;
+                int next_offset = (i == 2) ? 0 : (offset + size);
+                int prev_offset = (i == 0) ? size * 2 : (offset - size);
+
+                header.next_job_64 = submit->submit_bo->offset + next_offset;
+                payload.out = submit->submit_bo->offset + prev_offset;
+
+                memcpy(submit->submit_bo->map + offset, &header,
+                                sizeof(header));
+                memcpy(submit->submit_bo->map + offset + sizeof(header),
+                                &payload, sizeof(payload));
+        }
+
+        bos = malloc(sizeof(*bos));
+        bos[0] = submit->submit_bo->handle;
+
+        submit->args = calloc(1, sizeof(*submit->args));
+        submit->args->jc = submit->submit_bo->offset;
+        submit->args->requirements = 0;
+        submit->args->bo_handles = to_user_pointer(bos);
+        submit->args->bo_handle_count = 1;
+
+        igt_assert_eq(drmSyncobjCreate(fd, DRM_SYNCOBJ_CREATE_SIGNALED, &submit->args->out_sync), 0);
+
+        return submit;
+}
+
 struct panfrost_submit *igt_panfrost_trivial_job(int fd, bool do_crash, int width, int height, uint32_t color)
 {
         struct panfrost_submit *submit;
lib/igt_panfrost.h +1 -0
index cc7998dc..5e7c8c86 100644
@@ -47,6 +47,7 @@ struct panfrost_submit {
 struct panfrost_bo *igt_panfrost_gem_new(int fd, size_t size);
 void igt_panfrost_free_bo(int fd, struct panfrost_bo *bo);
 
+struct panfrost_submit *igt_panfrost_infinite_job(int fd);
 struct panfrost_submit *igt_panfrost_trivial_job(int fd, bool do_crash, int width, int height, uint32_t color);
 void igt_panfrost_free_job(int fd, struct panfrost_submit *submit);
 
lib/panfrost-job.h +5 -1
index 85ef02d0..206f9d44 100644
@@ -613,9 +613,13 @@ struct mali_job_descriptor_header {
         };
 } __attribute__((packed));
 
+#define MALI_SET_VALUE_ZERO      3
+
 struct mali_payload_set_value {
         u64 out;
-        u64 unknown;
+        u32 value_descriptor;
+        u32 reserved;
+        u64 immediate;
 } __attribute__((packed));
 
 /* Special attributes have a fixed index */
tests/panfrost_submit.c +14 -0
index 13ce85b7..b0b37fbd 100644
@@ -175,6 +175,20 @@ igt_main
                 igt_panfrost_free_job(fd, submit);
         }
 
+        igt_subtest("pan-infinite") {
+                struct panfrost_submit *submit;
+
+                submit = igt_panfrost_infinite_job(fd);
+                do_ioctl(fd, DRM_IOCTL_PANFROST_SUBMIT, submit->args);
+                /* Expect for this job to timeout */
+                igt_assert(!syncobj_wait(fd, &submit->args->out_sync, 1,
+                                         abs_timeout(SHORT_TIME_NSEC), 0, NULL));
+                /* This will unmap the job while it is still executing causing
+                 * a page fault
+                 */
+                igt_panfrost_free_job(fd, submit);
+        }
+
         igt_fixture {
                 close(fd);
         }
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/panfrost: Add infinite job test

== Series Details ==

== Series Details ==

Series: tests/panfrost: Add infinite job test
URL : https://patchwork.freedesktop.org/series/66650/
State : success

== Summary ==

CI Bug Log - changes from IGT_5180 -> IGTPW_3456
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Suppressed ####

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

* igt@gem_exec_create@basic:
- {fi-tgl-u}: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-tgl-u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-tgl-u/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_switch@legacy-render:
- fi-bxt-dsi: [PASS][3] -> [INCOMPLETE][4] ([fdo#103927] / [fdo#111381])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-bxt-dsi/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-bxt-dsi/igt@[email protected]

* igt@kms_addfb_basic@unused-modifier:
- fi-icl-u3: [PASS][5] -> [DMESG-WARN][6] ([fdo#107724])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-icl-u3/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-icl-u3/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][7] -> [FAIL][8] ([fdo#111407])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-kbl-7500u/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live_execlists:
- fi-skl-gvtdvm: [DMESG-FAIL][9] ([fdo#111108]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html

* igt@i915_selftest@live_requests:
- {fi-icl-guc}: [INCOMPLETE][11] ([fdo#107713] / [fdo#109644] / [fdo#110464]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-icl-guc/igt@i915_selftest@live_requests.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-icl-guc/igt@i915_selftest@live_requests.html

* igt@kms_prop_blob@basic:
- fi-icl-u3: [DMESG-WARN][13] ([fdo#107724]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/fi-icl-u3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/fi-icl-u3/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#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109644]: https://bugs.freedesktop.org/show_bug.cgi?id=109644
[fdo#110464]: https://bugs.freedesktop.org/show_bug.cgi?id=110464
[fdo#111108]: https://bugs.freedesktop.org/show_bug.cgi?id=111108
[fdo#111381]: https://bugs.freedesktop.org/show_bug.cgi?id=111381
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407

Participating hosts (54 -> 45)
------------------------------

Missing (9): fi-ilk-m540 fi-tgl-u2 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* IGT: IGT_5180 -> IGTPW_3456

CI-20190529: 20190529
CI_DRM_6888: 52e9cd0877ee673ba1bb80c7c7be2e53c0821084 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3456: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/
IGT_5180: 811b10e2bd7fd2cd8ced9bbb55361c178886bbbd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@panfrost_submit@pan-infinite

== Logs ==

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

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for tests/panfrost: Add infinite job test

In reply to Steven Price
== Series Details ==

== Series Details ==

Series: tests/panfrost: Add infinite job test
URL : https://patchwork.freedesktop.org/series/66650/
State : success

== Summary ==

CI Bug Log - changes from IGT_5180_full -> IGTPW_3456_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

New tests
---------

New tests have been introduced between IGT_5180_full and IGTPW_3456_full:

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

* igt@panfrost_submit@pan-infinite:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [PASS][1] -> [SKIP][2] ([fdo#110841])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preempt-bsd1:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#109276]) +15 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb8/igt@[email protected]

* igt@gem_exec_schedule@preempt-other-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +2 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb7/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb4/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-256x85-random:
- shard-hsw: [PASS][7] -> [INCOMPLETE][8] ([fdo#103540])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-hsw5/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-hsw1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-stridechange:
- shard-iclb: [PASS][9] -> [FAIL][10] ([fdo#103167]) +5 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb3/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: [PASS][11] -> [DMESG-WARN][12] ([fdo#108566]) +4 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-apl7/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-apl1/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [PASS][13] -> [FAIL][14] ([fdo#103166])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb8/igt@[email protected]

* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [PASS][15] -> [SKIP][16] ([fdo#109441]) +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb5/igt@kms_psr@psr2_primary_page_flip.html

#### Possible fixes ####

* igt@gem_ctx_switch@legacy-bsd2-heavy:
- shard-iclb: [SKIP][17] ([fdo#109276]) -> [PASS][18] +17 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb3/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@promotion-bsd:
- shard-iclb: [SKIP][19] ([fdo#111325]) -> [PASS][20] +2 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb4/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb8/igt@[email protected]

* igt@kms_cursor_legacy@cursor-vs-flip-atomic:
- shard-hsw: [FAIL][21] ([fdo#103355]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-hsw6/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-hsw7/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk: [FAIL][23] ([fdo#105363]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-glk9/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-glk8/igt@[email protected]

* igt@kms_flip@dpms-vs-vblank-race:
- shard-glk: [FAIL][25] ([fdo#111609]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-glk1/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-glk1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-iclb: [FAIL][27] ([fdo#103167]) -> [PASS][28] +3 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb2/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb7/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-kbl: [INCOMPLETE][29] ([fdo#103665]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-kbl3/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-kbl2/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [SKIP][31] ([fdo#109441]) -> [PASS][32] +2 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb8/igt@kms_psr@psr2_sprite_plane_move.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-apl: [DMESG-WARN][33] ([fdo#108566]) -> [PASS][34] +3 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-apl1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-apl6/igt@[email protected]

#### Warnings ####

* igt@gem_mocs_settings@mocs-settings-bsd2:
- shard-iclb: [SKIP][35] ([fdo#109276]) -> [FAIL][36] ([fdo#111330]) +2 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5180/shard-iclb6/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/shard-iclb4/igt@[email protected]

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[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#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#111609]: https://bugs.freedesktop.org/show_bug.cgi?id=111609

Participating hosts (7 -> 6)
------------------------------

Missing (1): shard-skl

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

* CI: CI-20190529 -> None
* IGT: IGT_5180 -> IGTPW_3456

CI-20190529: 20190529
CI_DRM_6888: 52e9cd0877ee673ba1bb80c7c7be2e53c0821084 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3456: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3456/
IGT_5180: 811b10e2bd7fd2cd8ced9bbb55361c178886bbbd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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