* [Intel-gfx] [PATCH i-g-t] i915/gem_exec_parallel: Launch 1s worth of threads @ 2021-01-19 23:17 ` Chris Wilson 0 siblings, 0 replies; 6+ messages in thread From: Chris Wilson @ 2021-01-19 23:17 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev, Chris Wilson Let's not assume that the thread execution is instantaneous, but apply a time limit as well as a maximum number so that the test should always run in bounded time. Also limit each thread to submitting only two pieces of outstanding work, to minimise over-saturation. We use two alternating batches as a generic way of tracking their fences. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_exec_parallel.c | 60 +++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c index d3dd06a65..9cb299733 100644 --- a/tests/i915/gem_exec_parallel.c +++ b/tests/i915/gem_exec_parallel.c @@ -48,6 +48,7 @@ static inline uint32_t hash32(uint32_t val) #define USERPTR 0x4 #define NUMOBJ 16 +#define MAXTHREADS 4096 struct thread { pthread_t thread; @@ -64,15 +65,15 @@ struct thread { static void *thread(void *data) { struct thread *t = data; - struct drm_i915_gem_exec_object2 obj[2]; - struct drm_i915_gem_relocation_entry reloc; + struct drm_i915_gem_exec_object2 obj[2], tmp; + struct drm_i915_gem_relocation_entry reloc[2]; struct drm_i915_gem_execbuffer2 execbuf; uint32_t batch[16]; uint16_t used; int fd, i; pthread_mutex_lock(t->mutex); - while (*t->go == 0) + while (READ_ONCE(*t->go) == 0) pthread_cond_wait(t->cond, t->mutex); pthread_mutex_unlock(t->mutex); @@ -101,18 +102,25 @@ static void *thread(void *data) memset(obj, 0, sizeof(obj)); obj[0].flags = EXEC_OBJECT_WRITE; - memset(&reloc, 0, sizeof(reloc)); - reloc.offset = sizeof(uint32_t); + memset(reloc, 0, sizeof(reloc)); + reloc[0].offset = sizeof(uint32_t); if (t->gen < 8 && t->gen >= 4) - reloc.offset += sizeof(uint32_t); - reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION; - reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; - reloc.delta = 4*t->id; + reloc[0].offset += sizeof(uint32_t); + reloc[0].read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].write_domain = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].delta = 4*t->id; + reloc[1] = reloc[0]; + obj[1].handle = gem_create(fd, 4096); - obj[1].relocs_ptr = to_user_pointer(&reloc); + obj[1].relocs_ptr = to_user_pointer(&reloc[0]); obj[1].relocation_count = 1; gem_write(fd, obj[1].handle, 0, batch, sizeof(batch)); + tmp.handle = gem_create(fd, 4096); + tmp.relocs_ptr = to_user_pointer(&reloc[1]); + tmp.relocation_count = 1; + gem_write(fd, tmp.handle, 0, batch, sizeof(batch)); + memset(&execbuf, 0, sizeof(execbuf)); execbuf.buffers_ptr = to_user_pointer(obj); execbuf.buffer_count = 2; @@ -129,6 +137,8 @@ static void *thread(void *data) igt_until_timeout(1) { unsigned int x = rand() % NUMOBJ; + igt_swap(obj[1], tmp); + used |= 1u << x; obj[0].handle = t->scratch[x]; @@ -139,10 +149,13 @@ static void *thread(void *data) if (t->flags & FDS) gem_close(fd, obj[0].handle); + + gem_sync(fd, tmp.handle); } if (t->flags & CONTEXTS) gem_context_destroy(fd, execbuf.rsvd1); + gem_close(fd, tmp.handle); gem_close(fd, obj[1].handle); if (t->flags & FDS) close(fd); @@ -153,7 +166,7 @@ static void *thread(void *data) static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) { - uint32_t x = hash32(handle * pass) % 1024; + uint32_t x = hash32(handle * pass) % MAXTHREADS; uint32_t result; if (!(threads[x].used & (1 << pass))) @@ -167,18 +180,20 @@ static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) static uint32_t handle_create(int fd, unsigned int flags, void **data) { + unsigned int size = MAXTHREADS * sizeof(uint32_t); + if (flags & USERPTR) { uint32_t handle; void *ptr; - posix_memalign(&ptr, 4096, 4096); - gem_userptr(fd, ptr, 4096, 0, 0, &handle); + posix_memalign(&ptr, 4096, size); + gem_userptr(fd, ptr, size, 0, 0, &handle); *data = ptr; return handle; } - return gem_create(fd, 4096); + return gem_create(fd, size); } static void handle_close(int fd, unsigned int flags, uint32_t handle, void *data) @@ -197,7 +212,9 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) struct thread *threads; pthread_mutex_t mutex; pthread_cond_t cond; + struct timespec tv; void *arg[NUMOBJ]; + int count; int go; int i; @@ -227,7 +244,7 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) scratch[i] = gem_flink(fd, handle[i]); } - threads = calloc(1024, sizeof(struct thread)); + threads = calloc(MAXTHREADS, sizeof(struct thread)); igt_assert(threads); intel_detect_and_clear_missed_interrupts(fd); @@ -235,7 +252,8 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) pthread_cond_init(&cond, 0); go = 0; - for (i = 0; i < 1024; i++) { + memset(&tv, 0, sizeof(tv)); + for (i = 0; i < MAXTHREADS && !igt_seconds_elapsed(&tv); i++) { threads[i].id = i; threads[i].fd = fd; threads[i].gen = gen; @@ -246,15 +264,19 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) threads[i].cond = &cond; threads[i].go = &go; - pthread_create(&threads[i].thread, 0, thread, &threads[i]); + if (pthread_create(&threads[i].thread, 0, thread, &threads[i])) + break; } + count = i; + igt_info("Launched %d threads\n", count); + igt_require(count); pthread_mutex_lock(&mutex); - go = 1024; + WRITE_ONCE(go, count); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); - for (i = 0; i < 1024; i++) + for (i = 0; i < count; i++) pthread_join(threads[i].thread, NULL); for (i = 0; i < NUMOBJ; i++) { -- 2.30.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [PATCH i-g-t] i915/gem_exec_parallel: Launch 1s worth of threads @ 2021-01-19 23:17 ` Chris Wilson 0 siblings, 0 replies; 6+ messages in thread From: Chris Wilson @ 2021-01-19 23:17 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev, Chris Wilson Let's not assume that the thread execution is instantaneous, but apply a time limit as well as a maximum number so that the test should always run in bounded time. Also limit each thread to submitting only two pieces of outstanding work, to minimise over-saturation. We use two alternating batches as a generic way of tracking their fences. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_exec_parallel.c | 60 +++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c index d3dd06a65..9cb299733 100644 --- a/tests/i915/gem_exec_parallel.c +++ b/tests/i915/gem_exec_parallel.c @@ -48,6 +48,7 @@ static inline uint32_t hash32(uint32_t val) #define USERPTR 0x4 #define NUMOBJ 16 +#define MAXTHREADS 4096 struct thread { pthread_t thread; @@ -64,15 +65,15 @@ struct thread { static void *thread(void *data) { struct thread *t = data; - struct drm_i915_gem_exec_object2 obj[2]; - struct drm_i915_gem_relocation_entry reloc; + struct drm_i915_gem_exec_object2 obj[2], tmp; + struct drm_i915_gem_relocation_entry reloc[2]; struct drm_i915_gem_execbuffer2 execbuf; uint32_t batch[16]; uint16_t used; int fd, i; pthread_mutex_lock(t->mutex); - while (*t->go == 0) + while (READ_ONCE(*t->go) == 0) pthread_cond_wait(t->cond, t->mutex); pthread_mutex_unlock(t->mutex); @@ -101,18 +102,25 @@ static void *thread(void *data) memset(obj, 0, sizeof(obj)); obj[0].flags = EXEC_OBJECT_WRITE; - memset(&reloc, 0, sizeof(reloc)); - reloc.offset = sizeof(uint32_t); + memset(reloc, 0, sizeof(reloc)); + reloc[0].offset = sizeof(uint32_t); if (t->gen < 8 && t->gen >= 4) - reloc.offset += sizeof(uint32_t); - reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION; - reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; - reloc.delta = 4*t->id; + reloc[0].offset += sizeof(uint32_t); + reloc[0].read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].write_domain = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].delta = 4*t->id; + reloc[1] = reloc[0]; + obj[1].handle = gem_create(fd, 4096); - obj[1].relocs_ptr = to_user_pointer(&reloc); + obj[1].relocs_ptr = to_user_pointer(&reloc[0]); obj[1].relocation_count = 1; gem_write(fd, obj[1].handle, 0, batch, sizeof(batch)); + tmp.handle = gem_create(fd, 4096); + tmp.relocs_ptr = to_user_pointer(&reloc[1]); + tmp.relocation_count = 1; + gem_write(fd, tmp.handle, 0, batch, sizeof(batch)); + memset(&execbuf, 0, sizeof(execbuf)); execbuf.buffers_ptr = to_user_pointer(obj); execbuf.buffer_count = 2; @@ -129,6 +137,8 @@ static void *thread(void *data) igt_until_timeout(1) { unsigned int x = rand() % NUMOBJ; + igt_swap(obj[1], tmp); + used |= 1u << x; obj[0].handle = t->scratch[x]; @@ -139,10 +149,13 @@ static void *thread(void *data) if (t->flags & FDS) gem_close(fd, obj[0].handle); + + gem_sync(fd, tmp.handle); } if (t->flags & CONTEXTS) gem_context_destroy(fd, execbuf.rsvd1); + gem_close(fd, tmp.handle); gem_close(fd, obj[1].handle); if (t->flags & FDS) close(fd); @@ -153,7 +166,7 @@ static void *thread(void *data) static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) { - uint32_t x = hash32(handle * pass) % 1024; + uint32_t x = hash32(handle * pass) % MAXTHREADS; uint32_t result; if (!(threads[x].used & (1 << pass))) @@ -167,18 +180,20 @@ static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) static uint32_t handle_create(int fd, unsigned int flags, void **data) { + unsigned int size = MAXTHREADS * sizeof(uint32_t); + if (flags & USERPTR) { uint32_t handle; void *ptr; - posix_memalign(&ptr, 4096, 4096); - gem_userptr(fd, ptr, 4096, 0, 0, &handle); + posix_memalign(&ptr, 4096, size); + gem_userptr(fd, ptr, size, 0, 0, &handle); *data = ptr; return handle; } - return gem_create(fd, 4096); + return gem_create(fd, size); } static void handle_close(int fd, unsigned int flags, uint32_t handle, void *data) @@ -197,7 +212,9 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) struct thread *threads; pthread_mutex_t mutex; pthread_cond_t cond; + struct timespec tv; void *arg[NUMOBJ]; + int count; int go; int i; @@ -227,7 +244,7 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) scratch[i] = gem_flink(fd, handle[i]); } - threads = calloc(1024, sizeof(struct thread)); + threads = calloc(MAXTHREADS, sizeof(struct thread)); igt_assert(threads); intel_detect_and_clear_missed_interrupts(fd); @@ -235,7 +252,8 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) pthread_cond_init(&cond, 0); go = 0; - for (i = 0; i < 1024; i++) { + memset(&tv, 0, sizeof(tv)); + for (i = 0; i < MAXTHREADS && !igt_seconds_elapsed(&tv); i++) { threads[i].id = i; threads[i].fd = fd; threads[i].gen = gen; @@ -246,15 +264,19 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) threads[i].cond = &cond; threads[i].go = &go; - pthread_create(&threads[i].thread, 0, thread, &threads[i]); + if (pthread_create(&threads[i].thread, 0, thread, &threads[i])) + break; } + count = i; + igt_info("Launched %d threads\n", count); + igt_require(count); pthread_mutex_lock(&mutex); - go = 1024; + WRITE_ONCE(go, count); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); - for (i = 0; i < 1024; i++) + for (i = 0; i < count; i++) pthread_join(threads[i].thread, NULL); for (i = 0; i < NUMOBJ; i++) { -- 2.30.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_exec_parallel: Launch 1s worth of threads 2021-01-19 23:17 ` [igt-dev] " Chris Wilson (?) @ 2021-01-20 0:45 ` Patchwork -1 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2021-01-20 0:45 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev [-- Attachment #1.1: Type: text/plain, Size: 5375 bytes --] == Series Details == Series: i915/gem_exec_parallel: Launch 1s worth of threads URL : https://patchwork.freedesktop.org/series/86062/ State : failure == Summary == CI Bug Log - changes from CI_DRM_9647 -> IGTPW_5404 ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with IGTPW_5404 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in IGTPW_5404, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/index.html Possible new issues ------------------- Here are the unknown changes that may have been introduced in IGTPW_5404: ### IGT changes ### #### Possible regressions #### * igt@gem_exec_parallel@engines@basic: - fi-bxt-dsi: [PASS][1] -> [FAIL][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-bxt-dsi/igt@gem_exec_parallel@engines@basic.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-bxt-dsi/igt@gem_exec_parallel@engines@basic.html - fi-glk-dsi: [PASS][3] -> [FAIL][4] [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-glk-dsi/igt@gem_exec_parallel@engines@basic.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-glk-dsi/igt@gem_exec_parallel@engines@basic.html - fi-apl-guc: [PASS][5] -> [FAIL][6] [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-apl-guc/igt@gem_exec_parallel@engines@basic.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-apl-guc/igt@gem_exec_parallel@engines@basic.html * igt@gem_exec_suspend@basic-s0: - fi-glk-dsi: [PASS][7] -> [DMESG-WARN][8] [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-glk-dsi/igt@gem_exec_suspend@basic-s0.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-glk-dsi/igt@gem_exec_suspend@basic-s0.html * igt@i915_selftest@live@late_gt_pm: - fi-bsw-nick: [PASS][9] -> [DMESG-FAIL][10] [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-bsw-nick/igt@i915_selftest@live@late_gt_pm.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-bsw-nick/igt@i915_selftest@live@late_gt_pm.html Known issues ------------ Here are the changes found in IGTPW_5404 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_exec_suspend@basic-s0: - fi-tgl-u2: [PASS][11] -> [FAIL][12] ([i915#1888]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html * igt@kms_chamelium@hdmi-edid-read: - fi-kbl-7500u: [PASS][13] -> [DMESG-FAIL][14] ([i915#165]) [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-kbl-7500u/igt@kms_chamelium@hdmi-edid-read.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-kbl-7500u/igt@kms_chamelium@hdmi-edid-read.html * igt@prime_vgem@basic-fence-flip: - fi-tgl-y: [PASS][15] -> [DMESG-WARN][16] ([i915#402]) +1 similar issue [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-tgl-y/igt@prime_vgem@basic-fence-flip.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-tgl-y/igt@prime_vgem@basic-fence-flip.html * igt@runner@aborted: - fi-bsw-nick: NOTRUN -> [FAIL][17] ([i915#1436]) [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-bsw-nick/igt@runner@aborted.html - fi-bdw-5557u: NOTRUN -> [FAIL][18] ([i915#1602] / [i915#2029] / [i915#2369]) [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-bdw-5557u/igt@runner@aborted.html #### Possible fixes #### * igt@debugfs_test@read_all_entries: - fi-tgl-y: [DMESG-WARN][19] ([i915#402]) -> [PASS][20] +2 similar issues [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9647/fi-tgl-y/igt@debugfs_test@read_all_entries.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/fi-tgl-y/igt@debugfs_test@read_all_entries.html [i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436 [i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602 [i915#165]: https://gitlab.freedesktop.org/drm/intel/issues/165 [i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888 [i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029 [i915#2369]: https://gitlab.freedesktop.org/drm/intel/issues/2369 [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402 Participating hosts (43 -> 37) ------------------------------ Missing (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-dg1-1 fi-bdw-samus Build changes ------------- * CI: CI-20190529 -> None * IGT: IGT_5960 -> IGTPW_5404 CI-20190529: 20190529 CI_DRM_9647: bf84e89a0accc900a7c42035226a811a24737f51 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_5404: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/index.html IGT_5960: ace82fcd5f3623f8dde7c220a825873dc53dfae4 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5404/index.html [-- Attachment #1.2: Type: text/html, Size: 6300 bytes --] [-- Attachment #2: Type: text/plain, Size: 154 bytes --] _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] [PATCH i-g-t] i915/gem_exec_parallel: Launch 1s worth of threads 2021-01-19 23:17 ` [igt-dev] " Chris Wilson @ 2021-01-20 10:38 ` Chris Wilson -1 siblings, 0 replies; 6+ messages in thread From: Chris Wilson @ 2021-01-20 10:38 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev, Chris Wilson Let's not assume that the thread execution is instantaneous, but apply a time limit as well as a maximum number so that the test should always run in bounded time. Also limit each thread to submitting only two pieces of outstanding work, to minimise over-saturation. We use two alternating batches as a generic way of tracking their fences. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_exec_parallel.c | 62 +++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c index d3dd06a65..4f0fbdd02 100644 --- a/tests/i915/gem_exec_parallel.c +++ b/tests/i915/gem_exec_parallel.c @@ -48,6 +48,7 @@ static inline uint32_t hash32(uint32_t val) #define USERPTR 0x4 #define NUMOBJ 16 +#define MAXTHREADS 4096 struct thread { pthread_t thread; @@ -64,15 +65,15 @@ struct thread { static void *thread(void *data) { struct thread *t = data; - struct drm_i915_gem_exec_object2 obj[2]; - struct drm_i915_gem_relocation_entry reloc; + struct drm_i915_gem_exec_object2 obj[3]; + struct drm_i915_gem_relocation_entry reloc[2]; struct drm_i915_gem_execbuffer2 execbuf; uint32_t batch[16]; uint16_t used; int fd, i; pthread_mutex_lock(t->mutex); - while (*t->go == 0) + while (READ_ONCE(*t->go) == 0) pthread_cond_wait(t->cond, t->mutex); pthread_mutex_unlock(t->mutex); @@ -101,21 +102,28 @@ static void *thread(void *data) memset(obj, 0, sizeof(obj)); obj[0].flags = EXEC_OBJECT_WRITE; - memset(&reloc, 0, sizeof(reloc)); - reloc.offset = sizeof(uint32_t); + memset(reloc, 0, sizeof(reloc)); + reloc[0].offset = sizeof(uint32_t); if (t->gen < 8 && t->gen >= 4) - reloc.offset += sizeof(uint32_t); - reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION; - reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; - reloc.delta = 4*t->id; + reloc[0].offset += sizeof(uint32_t); + reloc[0].read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].write_domain = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].delta = 4*t->id; + reloc[1] = reloc[0]; + obj[1].handle = gem_create(fd, 4096); - obj[1].relocs_ptr = to_user_pointer(&reloc); + obj[1].relocs_ptr = to_user_pointer(&reloc[0]); obj[1].relocation_count = 1; gem_write(fd, obj[1].handle, 0, batch, sizeof(batch)); + obj[2].handle = gem_create(fd, 4096); + obj[2].relocs_ptr = to_user_pointer(&reloc[1]); + obj[2].relocation_count = 1; + gem_write(fd, obj[2].handle, 0, batch, sizeof(batch)); + memset(&execbuf, 0, sizeof(execbuf)); execbuf.buffers_ptr = to_user_pointer(obj); - execbuf.buffer_count = 2; + execbuf.buffer_count = 2; /* NB !ARRAY_SIZE(obj), keep one in reserve */ execbuf.flags = t->engine; execbuf.flags |= I915_EXEC_HANDLE_LUT; execbuf.flags |= I915_EXEC_NO_RELOC; @@ -129,6 +137,8 @@ static void *thread(void *data) igt_until_timeout(1) { unsigned int x = rand() % NUMOBJ; + igt_swap(obj[1], obj[2]); + used |= 1u << x; obj[0].handle = t->scratch[x]; @@ -139,10 +149,13 @@ static void *thread(void *data) if (t->flags & FDS) gem_close(fd, obj[0].handle); + + gem_sync(fd, obj[2].handle); } if (t->flags & CONTEXTS) gem_context_destroy(fd, execbuf.rsvd1); + gem_close(fd, obj[2].handle); gem_close(fd, obj[1].handle); if (t->flags & FDS) close(fd); @@ -153,7 +166,7 @@ static void *thread(void *data) static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) { - uint32_t x = hash32(handle * pass) % 1024; + uint32_t x = hash32(handle * pass) % MAXTHREADS; uint32_t result; if (!(threads[x].used & (1 << pass))) @@ -167,18 +180,20 @@ static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) static uint32_t handle_create(int fd, unsigned int flags, void **data) { + unsigned int size = MAXTHREADS * sizeof(uint32_t); + if (flags & USERPTR) { uint32_t handle; void *ptr; - posix_memalign(&ptr, 4096, 4096); - gem_userptr(fd, ptr, 4096, 0, 0, &handle); + posix_memalign(&ptr, 4096, size); + gem_userptr(fd, ptr, size, 0, 0, &handle); *data = ptr; return handle; } - return gem_create(fd, 4096); + return gem_create(fd, size); } static void handle_close(int fd, unsigned int flags, uint32_t handle, void *data) @@ -197,7 +212,9 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) struct thread *threads; pthread_mutex_t mutex; pthread_cond_t cond; + struct timespec tv; void *arg[NUMOBJ]; + int count; int go; int i; @@ -227,7 +244,7 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) scratch[i] = gem_flink(fd, handle[i]); } - threads = calloc(1024, sizeof(struct thread)); + threads = calloc(MAXTHREADS, sizeof(struct thread)); igt_assert(threads); intel_detect_and_clear_missed_interrupts(fd); @@ -235,7 +252,8 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) pthread_cond_init(&cond, 0); go = 0; - for (i = 0; i < 1024; i++) { + memset(&tv, 0, sizeof(tv)); + for (i = 0; i < MAXTHREADS && !igt_seconds_elapsed(&tv); i++) { threads[i].id = i; threads[i].fd = fd; threads[i].gen = gen; @@ -246,15 +264,19 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) threads[i].cond = &cond; threads[i].go = &go; - pthread_create(&threads[i].thread, 0, thread, &threads[i]); + if (pthread_create(&threads[i].thread, 0, thread, &threads[i])) + break; } + count = i; + igt_info("Launched %d threads\n", count); + igt_require(count); pthread_mutex_lock(&mutex); - go = 1024; + WRITE_ONCE(go, count); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); - for (i = 0; i < 1024; i++) + for (i = 0; i < count; i++) pthread_join(threads[i].thread, NULL); for (i = 0; i < NUMOBJ; i++) { -- 2.30.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [PATCH i-g-t] i915/gem_exec_parallel: Launch 1s worth of threads @ 2021-01-20 10:38 ` Chris Wilson 0 siblings, 0 replies; 6+ messages in thread From: Chris Wilson @ 2021-01-20 10:38 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev, Chris Wilson Let's not assume that the thread execution is instantaneous, but apply a time limit as well as a maximum number so that the test should always run in bounded time. Also limit each thread to submitting only two pieces of outstanding work, to minimise over-saturation. We use two alternating batches as a generic way of tracking their fences. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- tests/i915/gem_exec_parallel.c | 62 +++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c index d3dd06a65..4f0fbdd02 100644 --- a/tests/i915/gem_exec_parallel.c +++ b/tests/i915/gem_exec_parallel.c @@ -48,6 +48,7 @@ static inline uint32_t hash32(uint32_t val) #define USERPTR 0x4 #define NUMOBJ 16 +#define MAXTHREADS 4096 struct thread { pthread_t thread; @@ -64,15 +65,15 @@ struct thread { static void *thread(void *data) { struct thread *t = data; - struct drm_i915_gem_exec_object2 obj[2]; - struct drm_i915_gem_relocation_entry reloc; + struct drm_i915_gem_exec_object2 obj[3]; + struct drm_i915_gem_relocation_entry reloc[2]; struct drm_i915_gem_execbuffer2 execbuf; uint32_t batch[16]; uint16_t used; int fd, i; pthread_mutex_lock(t->mutex); - while (*t->go == 0) + while (READ_ONCE(*t->go) == 0) pthread_cond_wait(t->cond, t->mutex); pthread_mutex_unlock(t->mutex); @@ -101,21 +102,28 @@ static void *thread(void *data) memset(obj, 0, sizeof(obj)); obj[0].flags = EXEC_OBJECT_WRITE; - memset(&reloc, 0, sizeof(reloc)); - reloc.offset = sizeof(uint32_t); + memset(reloc, 0, sizeof(reloc)); + reloc[0].offset = sizeof(uint32_t); if (t->gen < 8 && t->gen >= 4) - reloc.offset += sizeof(uint32_t); - reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION; - reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; - reloc.delta = 4*t->id; + reloc[0].offset += sizeof(uint32_t); + reloc[0].read_domains = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].write_domain = I915_GEM_DOMAIN_INSTRUCTION; + reloc[0].delta = 4*t->id; + reloc[1] = reloc[0]; + obj[1].handle = gem_create(fd, 4096); - obj[1].relocs_ptr = to_user_pointer(&reloc); + obj[1].relocs_ptr = to_user_pointer(&reloc[0]); obj[1].relocation_count = 1; gem_write(fd, obj[1].handle, 0, batch, sizeof(batch)); + obj[2].handle = gem_create(fd, 4096); + obj[2].relocs_ptr = to_user_pointer(&reloc[1]); + obj[2].relocation_count = 1; + gem_write(fd, obj[2].handle, 0, batch, sizeof(batch)); + memset(&execbuf, 0, sizeof(execbuf)); execbuf.buffers_ptr = to_user_pointer(obj); - execbuf.buffer_count = 2; + execbuf.buffer_count = 2; /* NB !ARRAY_SIZE(obj), keep one in reserve */ execbuf.flags = t->engine; execbuf.flags |= I915_EXEC_HANDLE_LUT; execbuf.flags |= I915_EXEC_NO_RELOC; @@ -129,6 +137,8 @@ static void *thread(void *data) igt_until_timeout(1) { unsigned int x = rand() % NUMOBJ; + igt_swap(obj[1], obj[2]); + used |= 1u << x; obj[0].handle = t->scratch[x]; @@ -139,10 +149,13 @@ static void *thread(void *data) if (t->flags & FDS) gem_close(fd, obj[0].handle); + + gem_sync(fd, obj[2].handle); } if (t->flags & CONTEXTS) gem_context_destroy(fd, execbuf.rsvd1); + gem_close(fd, obj[2].handle); gem_close(fd, obj[1].handle); if (t->flags & FDS) close(fd); @@ -153,7 +166,7 @@ static void *thread(void *data) static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) { - uint32_t x = hash32(handle * pass) % 1024; + uint32_t x = hash32(handle * pass) % MAXTHREADS; uint32_t result; if (!(threads[x].used & (1 << pass))) @@ -167,18 +180,20 @@ static void check_bo(int fd, uint32_t handle, int pass, struct thread *threads) static uint32_t handle_create(int fd, unsigned int flags, void **data) { + unsigned int size = MAXTHREADS * sizeof(uint32_t); + if (flags & USERPTR) { uint32_t handle; void *ptr; - posix_memalign(&ptr, 4096, 4096); - gem_userptr(fd, ptr, 4096, 0, 0, &handle); + posix_memalign(&ptr, 4096, size); + gem_userptr(fd, ptr, size, 0, 0, &handle); *data = ptr; return handle; } - return gem_create(fd, 4096); + return gem_create(fd, size); } static void handle_close(int fd, unsigned int flags, uint32_t handle, void *data) @@ -197,7 +212,9 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) struct thread *threads; pthread_mutex_t mutex; pthread_cond_t cond; + struct timespec tv; void *arg[NUMOBJ]; + int count; int go; int i; @@ -227,7 +244,7 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) scratch[i] = gem_flink(fd, handle[i]); } - threads = calloc(1024, sizeof(struct thread)); + threads = calloc(MAXTHREADS, sizeof(struct thread)); igt_assert(threads); intel_detect_and_clear_missed_interrupts(fd); @@ -235,7 +252,8 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) pthread_cond_init(&cond, 0); go = 0; - for (i = 0; i < 1024; i++) { + memset(&tv, 0, sizeof(tv)); + for (i = 0; i < MAXTHREADS && !igt_seconds_elapsed(&tv); i++) { threads[i].id = i; threads[i].fd = fd; threads[i].gen = gen; @@ -246,15 +264,19 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) threads[i].cond = &cond; threads[i].go = &go; - pthread_create(&threads[i].thread, 0, thread, &threads[i]); + if (pthread_create(&threads[i].thread, 0, thread, &threads[i])) + break; } + count = i; + igt_info("Launched %d threads\n", count); + igt_require(count); pthread_mutex_lock(&mutex); - go = 1024; + WRITE_ONCE(go, count); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); - for (i = 0; i < 1024; i++) + for (i = 0; i < count; i++) pthread_join(threads[i].thread, NULL); for (i = 0; i < NUMOBJ; i++) { -- 2.30.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_exec_parallel: Launch 1s worth of threads (rev2) 2021-01-19 23:17 ` [igt-dev] " Chris Wilson ` (2 preceding siblings ...) (?) @ 2021-01-20 12:26 ` Patchwork -1 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2021-01-20 12:26 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev [-- Attachment #1.1: Type: text/plain, Size: 4355 bytes --] == Series Details == Series: i915/gem_exec_parallel: Launch 1s worth of threads (rev2) URL : https://patchwork.freedesktop.org/series/86062/ State : failure == Summary == CI Bug Log - changes from CI_DRM_9650 -> IGTPW_5406 ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with IGTPW_5406 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in IGTPW_5406, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/index.html Possible new issues ------------------- Here are the unknown changes that may have been introduced in IGTPW_5406: ### IGT changes ### #### Possible regressions #### * igt@i915_selftest@live@hangcheck: - fi-bsw-nick: [PASS][1] -> [INCOMPLETE][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9650/fi-bsw-nick/igt@i915_selftest@live@hangcheck.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-bsw-nick/igt@i915_selftest@live@hangcheck.html Known issues ------------ Here are the changes found in IGTPW_5406 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy: - fi-snb-2600: NOTRUN -> [SKIP][3] ([fdo#109271]) +30 similar issues [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-snb-2600/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html * igt@kms_chamelium@hdmi-crc-fast: - fi-snb-2600: NOTRUN -> [SKIP][4] ([fdo#109271] / [fdo#111827]) +8 similar issues [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-snb-2600/igt@kms_chamelium@hdmi-crc-fast.html * igt@prime_vgem@basic-fence-flip: - fi-tgl-y: [PASS][5] -> [DMESG-WARN][6] ([i915#402]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9650/fi-tgl-y/igt@prime_vgem@basic-fence-flip.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-tgl-y/igt@prime_vgem@basic-fence-flip.html * igt@runner@aborted: - fi-bsw-nick: NOTRUN -> [FAIL][7] ([i915#1436]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-bsw-nick/igt@runner@aborted.html #### Possible fixes #### * igt@gem_exec_suspend@basic-s3: - fi-snb-2600: [DMESG-WARN][8] ([i915#2772]) -> [PASS][9] [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9650/fi-snb-2600/igt@gem_exec_suspend@basic-s3.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-snb-2600/igt@gem_exec_suspend@basic-s3.html * igt@prime_self_import@basic-with_one_bo_two_files: - fi-tgl-y: [DMESG-WARN][10] ([i915#402]) -> [PASS][11] [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9650/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315 [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827 [i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436 [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575 [i915#2772]: https://gitlab.freedesktop.org/drm/intel/issues/2772 [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402 Participating hosts (43 -> 37) ------------------------------ Missing (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-dg1-1 fi-bdw-samus Build changes ------------- * CI: CI-20190529 -> None * IGT: IGT_5960 -> IGTPW_5406 CI-20190529: 20190529 CI_DRM_9650: 3f989d1bb4cfd91e25549f9fd7a750412581dcc4 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_5406: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/index.html IGT_5960: ace82fcd5f3623f8dde7c220a825873dc53dfae4 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5406/index.html [-- Attachment #1.2: Type: text/html, Size: 5137 bytes --] [-- Attachment #2: Type: text/plain, Size: 154 bytes --] _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-20 12:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-19 23:17 [Intel-gfx] [PATCH i-g-t] i915/gem_exec_parallel: Launch 1s worth of threads Chris Wilson 2021-01-19 23:17 ` [igt-dev] " Chris Wilson 2021-01-20 0:45 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork 2021-01-20 10:38 ` [Intel-gfx] [PATCH i-g-t] " Chris Wilson 2021-01-20 10:38 ` [igt-dev] " Chris Wilson 2021-01-20 12:26 ` [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_exec_parallel: Launch 1s worth of threads (rev2) Patchwork
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.