* [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch
@ 2018-07-09 18:47 Antonio Argenziano
2018-07-09 19:12 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2018-07-09 19:53 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
0 siblings, 2 replies; 6+ messages in thread
From: Antonio Argenziano @ 2018-07-09 18:47 UTC (permalink / raw)
To: igt-dev
An hanging batch is nothing more than a spinning batch that never gets
stopped, so re-use the routines implemented in dummyload.c.
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/igt_gt.c | 57 ++++++++-------------------------------------------------
lib/igt_gt.h | 1 +
2 files changed, 9 insertions(+), 49 deletions(-)
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 4569fd36..25b7f1c4 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -264,14 +264,10 @@ igt_hang_t igt_hang_ctx(int fd,
unsigned flags,
uint64_t *offset)
{
- struct drm_i915_gem_relocation_entry reloc;
- struct drm_i915_gem_execbuffer2 execbuf;
- struct drm_i915_gem_exec_object2 exec;
+ igt_spin_t *spinning_batch;
+ struct igt_spin_factory opts = {};
struct drm_i915_gem_context_param param;
- uint32_t b[16];
unsigned ban;
- unsigned len;
- int gen;
igt_require_hang_ring(fd, ring);
@@ -295,52 +291,15 @@ igt_hang_t igt_hang_ctx(int fd,
if ((flags & HANG_ALLOW_BAN) == 0)
context_set_ban(fd, ctx, 0);
- memset(&reloc, 0, sizeof(reloc));
- memset(&exec, 0, sizeof(exec));
- memset(&execbuf, 0, sizeof(execbuf));
-
- exec.handle = gem_create(fd, 4096);
- exec.relocation_count = 1;
- exec.relocs_ptr = to_user_pointer(&reloc);
-
- memset(b, 0xc5, sizeof(b));
-
- len = 0;
- gen = intel_gen(intel_get_drm_devid(fd));
- if (gen >= 8) {
- b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
- b[len++] = 0;
- b[len++] = 0;
- } else if (gen >= 6) {
- b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
- b[len++] = 0;
- } else {
- b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
- b[len] = 0;
- if (gen < 4) {
- b[len] |= 1;
- reloc.delta = 1;
- }
- len++;
- }
- b[len++] = MI_BATCH_BUFFER_END;
- b[len] = MI_NOOP;
- gem_write(fd, exec.handle, 0, b, sizeof(b));
-
- reloc.offset = sizeof(uint32_t);
- reloc.target_handle = exec.handle;
- reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
-
- execbuf.buffers_ptr = to_user_pointer(&exec);
- execbuf.buffer_count = 1;
- execbuf.flags = ring;
- i915_execbuffer2_set_context_id(execbuf, ctx);
- gem_execbuf(fd, &execbuf);
+ opts.ctx = ctx;
+ opts.engine = ring;
+ opts.flags = IGT_SPIN_FAST; /* Current driver hangs faster */
+ spinning_batch = igt_spin_batch_factory(fd, &opts);
if (offset)
- *offset = exec.offset;
+ *offset = (*spinning_batch).obj[1].offset; /* The batch is the last object */
- return (igt_hang_t){ exec.handle, ctx, ban, flags };
+ return (igt_hang_t){ (*spinning_batch).obj[1].handle, ctx, ban, flags };
}
/**
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index d44b7552..75722995 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -26,6 +26,7 @@
#include "igt_debugfs.h"
#include "igt_core.h"
+#include "igt_dummyload.h"
#include "i915_drm.h"
--
2.16.2
_______________________________________________
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 lib/hang_ctx: Make use of dummyload library to create recursive batch
2018-07-09 18:47 [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch Antonio Argenziano
@ 2018-07-09 19:12 ` Patchwork
2018-07-09 19:53 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
1 sibling, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-07-09 19:12 UTC (permalink / raw)
To: Antonio Argenziano; +Cc: igt-dev
== Series Details ==
Series: lib/hang_ctx: Make use of dummyload library to create recursive batch
URL : https://patchwork.freedesktop.org/series/46209/
State : failure
== Summary ==
IGT patchset build failed on latest successful build
764160f214cd916ddb79408b9f28ac0ad2df40e0 lib/igt_draw: Zero initalize the igt_bufs
[71/764] Linking static target lib/libigt-rendercopy_gen7_c.a.
[72/764] Compiling C object 'lib/igt-rendercopy_gen8_c@sta/rendercopy_gen8.c.o'.
[73/764] Linking static target lib/libigt-rendercopy_gen8_c.a.
[74/764] Compiling C object 'lib/igt-rendercopy_gen9_c@sta/rendercopy_gen9.c.o'.
[75/764] Linking static target lib/libigt-rendercopy_gen9_c.a.
[76/764] Compiling C object 'lib/igt-sw_sync_c@sta/sw_sync.c.o'.
[77/764] Linking static target lib/libigt-sw_sync_c.a.
[78/764] Compiling C object 'lib/igt-intel_reg_map_c@sta/intel_reg_map.c.o'.
[79/764] Linking static target lib/libigt-intel_reg_map_c.a.
[80/764] Compiling C object 'lib/igt-intel_iosf_c@sta/intel_iosf.c.o'.
[81/764] Linking static target lib/libigt-intel_iosf_c.a.
[82/764] Compiling C object 'lib/igt-igt_kms_c@sta/igt_kms.c.o'.
[83/764] Linking static target lib/libigt-igt_kms_c.a.
[84/764] Compiling C object 'lib/igt-igt_fb_c@sta/igt_fb.c.o'.
[85/764] Linking static target lib/libigt-igt_fb_c.a.
[86/764] Compiling C object 'lib/igt-igt_core_c@sta/igt_core.c.o'.
[87/764] Linking static target lib/libigt-igt_core_c.a.
[88/764] Compiling C object 'lib/igt-igt_draw_c@sta/igt_draw.c.o'.
[89/764] Linking static target lib/libigt-igt_draw_c.a.
[90/764] Compiling C object 'lib/igt-igt_pm_c@sta/igt_pm.c.o'.
[91/764] Linking static target lib/libigt-igt_pm_c.a.
[92/764] Compiling C object 'lib/igt-igt_dummyload_c@sta/igt_dummyload.c.o'.
[93/764] Linking static target lib/libigt-igt_dummyload_c.a.
[94/764] Compiling C object 'lib/igt-uwildmat_uwildmat_c@sta/uwildmat_uwildmat.c.o'.
[95/764] Linking static target lib/libigt-uwildmat_uwildmat_c.a.
[96/764] Compiling C object 'lib/igt-igt_kmod_c@sta/igt_kmod.c.o'.
[97/764] Linking static target lib/libigt-igt_kmod_c.a.
[98/764] Compiling C object 'lib/igt-igt_vc4_c@sta/igt_vc4.c.o'.
[99/764] Linking static target lib/libigt-igt_vc4_c.a.
[100/764] Compiling C object 'lib/igt-igt_frame_c@sta/igt_frame.c.o'.
[101/764] Linking static target lib/libigt-igt_frame_c.a.
[102/764] Compiling C object 'lib/igt-igt_audio_c@sta/igt_audio.c.o'.
[103/764] Linking static target lib/libigt-igt_audio_c.a.
[104/764] Compiling C object 'lib/igt-igt_chamelium_c@sta/igt_chamelium.c.o'.
[105/764] Linking static target lib/libigt-igt_chamelium_c.a.
[106/764] Linking target lib/libigt.so.
[107/764] Generating symbol file 'lib/igt@sha/lib/libigt.so.symbols'.
[108/764] Linking target lib/tests/igt_fork_helper.
[109/764] Compiling C object 'lib/igt_perf@sta/igt_perf.c.o'.
FAILED: lib/igt_perf@sta/igt_perf.c.o
ccache cc -Ilib/igt_perf@sta -Ilib -I../lib -I. -I../ -I../include/drm-uapi -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O0 -g -D_GNU_SOURCE -include config.h -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers -Wno-clobbered -Wno-type-limits -Wimplicit-fallthrough=0 -fPIC -MD -MQ 'lib/igt_perf@sta/igt_perf.c.o' -MF 'lib/igt_perf@sta/igt_perf.c.o.d' -o 'lib/igt_perf@sta/igt_perf.c.o' -c ../lib/igt_perf.c
In file included from ../lib/igt_dummyload.h:31:0,
from ../lib/igt_gt.h:29,
from ../lib/igt_perf.h:32,
from ../lib/igt_perf.c:9:
../lib/igt_aux.h:31:10: fatal error: intel_bufmgr.h: No such file or directory
#include <intel_bufmgr.h>
^~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
_______________________________________________
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
* Re: [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch
2018-07-09 18:47 [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch Antonio Argenziano
2018-07-09 19:12 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
@ 2018-07-09 19:53 ` Chris Wilson
2018-07-09 20:20 ` Antonio Argenziano
1 sibling, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2018-07-09 19:53 UTC (permalink / raw)
To: Antonio Argenziano, igt-dev
Quoting Antonio Argenziano (2018-07-09 19:47:04)
> An hanging batch is nothing more than a spinning batch that never gets
> stopped, so re-use the routines implemented in dummyload.c.
>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_gt.c | 57 ++++++++-------------------------------------------------
> lib/igt_gt.h | 1 +
> 2 files changed, 9 insertions(+), 49 deletions(-)
>
> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> index 4569fd36..25b7f1c4 100644
> --- a/lib/igt_gt.c
> +++ b/lib/igt_gt.c
> @@ -264,14 +264,10 @@ igt_hang_t igt_hang_ctx(int fd,
> unsigned flags,
> uint64_t *offset)
> {
> - struct drm_i915_gem_relocation_entry reloc;
> - struct drm_i915_gem_execbuffer2 execbuf;
> - struct drm_i915_gem_exec_object2 exec;
> + igt_spin_t *spinning_batch;
> + struct igt_spin_factory opts = {};
> struct drm_i915_gem_context_param param;
> - uint32_t b[16];
> unsigned ban;
> - unsigned len;
> - int gen;
>
> igt_require_hang_ring(fd, ring);
>
> @@ -295,52 +291,15 @@ igt_hang_t igt_hang_ctx(int fd,
> if ((flags & HANG_ALLOW_BAN) == 0)
> context_set_ban(fd, ctx, 0);
>
> - memset(&reloc, 0, sizeof(reloc));
> - memset(&exec, 0, sizeof(exec));
> - memset(&execbuf, 0, sizeof(execbuf));
> -
> - exec.handle = gem_create(fd, 4096);
> - exec.relocation_count = 1;
> - exec.relocs_ptr = to_user_pointer(&reloc);
> -
> - memset(b, 0xc5, sizeof(b));
> -
> - len = 0;
> - gen = intel_gen(intel_get_drm_devid(fd));
> - if (gen >= 8) {
> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
> - b[len++] = 0;
> - b[len++] = 0;
> - } else if (gen >= 6) {
> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
> - b[len++] = 0;
> - } else {
> - b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
> - b[len] = 0;
> - if (gen < 4) {
> - b[len] |= 1;
> - reloc.delta = 1;
> - }
> - len++;
> - }
> - b[len++] = MI_BATCH_BUFFER_END;
> - b[len] = MI_NOOP;
> - gem_write(fd, exec.handle, 0, b, sizeof(b));
> -
> - reloc.offset = sizeof(uint32_t);
> - reloc.target_handle = exec.handle;
> - reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
> -
> - execbuf.buffers_ptr = to_user_pointer(&exec);
> - execbuf.buffer_count = 1;
> - execbuf.flags = ring;
> - i915_execbuffer2_set_context_id(execbuf, ctx);
> - gem_execbuf(fd, &execbuf);
> + opts.ctx = ctx;
> + opts.engine = ring;
> + opts.flags = IGT_SPIN_FAST; /* Current driver hangs faster */
Be careful, the hanging batch is where we first encountered the
traumatic experience from spinning too fast. Use IGT_SPIN_FAST with
care, and probably best left to the caller's discretion.
-Chris
_______________________________________________
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
* Re: [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch
2018-07-09 19:53 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
@ 2018-07-09 20:20 ` Antonio Argenziano
2018-07-09 20:36 ` Chris Wilson
0 siblings, 1 reply; 6+ messages in thread
From: Antonio Argenziano @ 2018-07-09 20:20 UTC (permalink / raw)
To: Chris Wilson, igt-dev
On 09/07/18 12:53, Chris Wilson wrote:
> Quoting Antonio Argenziano (2018-07-09 19:47:04)
>> An hanging batch is nothing more than a spinning batch that never gets
>> stopped, so re-use the routines implemented in dummyload.c.
>>
>> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> ---
>> lib/igt_gt.c | 57 ++++++++-------------------------------------------------
>> lib/igt_gt.h | 1 +
>> 2 files changed, 9 insertions(+), 49 deletions(-)
>>
>> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
>> index 4569fd36..25b7f1c4 100644
>> --- a/lib/igt_gt.c
>> +++ b/lib/igt_gt.c
>> @@ -264,14 +264,10 @@ igt_hang_t igt_hang_ctx(int fd,
>> unsigned flags,
>> uint64_t *offset)
>> {
>> - struct drm_i915_gem_relocation_entry reloc;
>> - struct drm_i915_gem_execbuffer2 execbuf;
>> - struct drm_i915_gem_exec_object2 exec;
>> + igt_spin_t *spinning_batch;
>> + struct igt_spin_factory opts = {};
>> struct drm_i915_gem_context_param param;
>> - uint32_t b[16];
>> unsigned ban;
>> - unsigned len;
>> - int gen;
>>
>> igt_require_hang_ring(fd, ring);
>>
>> @@ -295,52 +291,15 @@ igt_hang_t igt_hang_ctx(int fd,
>> if ((flags & HANG_ALLOW_BAN) == 0)
>> context_set_ban(fd, ctx, 0);
>>
>> - memset(&reloc, 0, sizeof(reloc));
>> - memset(&exec, 0, sizeof(exec));
>> - memset(&execbuf, 0, sizeof(execbuf));
>> -
>> - exec.handle = gem_create(fd, 4096);
>> - exec.relocation_count = 1;
>> - exec.relocs_ptr = to_user_pointer(&reloc);
>> -
>> - memset(b, 0xc5, sizeof(b));
>> -
>> - len = 0;
>> - gen = intel_gen(intel_get_drm_devid(fd));
>> - if (gen >= 8) {
>> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
>> - b[len++] = 0;
>> - b[len++] = 0;
>> - } else if (gen >= 6) {
>> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
>> - b[len++] = 0;
>> - } else {
>> - b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
>> - b[len] = 0;
>> - if (gen < 4) {
>> - b[len] |= 1;
>> - reloc.delta = 1;
>> - }
>> - len++;
>> - }
>> - b[len++] = MI_BATCH_BUFFER_END;
>> - b[len] = MI_NOOP;
>> - gem_write(fd, exec.handle, 0, b, sizeof(b));
>> -
>> - reloc.offset = sizeof(uint32_t);
>> - reloc.target_handle = exec.handle;
>> - reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
>> -
>> - execbuf.buffers_ptr = to_user_pointer(&exec);
>> - execbuf.buffer_count = 1;
>> - execbuf.flags = ring;
>> - i915_execbuffer2_set_context_id(execbuf, ctx);
>> - gem_execbuf(fd, &execbuf);
>> + opts.ctx = ctx;
>> + opts.engine = ring;
>> + opts.flags = IGT_SPIN_FAST; /* Current driver hangs faster */
>
> Be careful, the hanging batch is where we first encountered the
> traumatic experience from spinning too fast. Use IGT_SPIN_FAST with
> care, and probably best left to the caller's discretion.
I'll leave it to the caller to spin faster. I actually wanted to add
both hanging batches: fast and slow. My idea would be to have, even if
only basics, hang tests for all situations: Moving Head; Still HEAD;
Idle engine are the ones that come to mind. We could have a require()
for gen version if needed.
Thanks,
Antonio
> -Chris
>
_______________________________________________
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
* Re: [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch
2018-07-09 20:20 ` Antonio Argenziano
@ 2018-07-09 20:36 ` Chris Wilson
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-07-09 20:36 UTC (permalink / raw)
To: Antonio Argenziano, igt-dev
Quoting Antonio Argenziano (2018-07-09 21:20:00)
>
>
> On 09/07/18 12:53, Chris Wilson wrote:
> > Quoting Antonio Argenziano (2018-07-09 19:47:04)
> >> An hanging batch is nothing more than a spinning batch that never gets
> >> stopped, so re-use the routines implemented in dummyload.c.
> >>
> >> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> >> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >> ---
> >> lib/igt_gt.c | 57 ++++++++-------------------------------------------------
> >> lib/igt_gt.h | 1 +
> >> 2 files changed, 9 insertions(+), 49 deletions(-)
> >>
> >> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> >> index 4569fd36..25b7f1c4 100644
> >> --- a/lib/igt_gt.c
> >> +++ b/lib/igt_gt.c
> >> @@ -264,14 +264,10 @@ igt_hang_t igt_hang_ctx(int fd,
> >> unsigned flags,
> >> uint64_t *offset)
> >> {
> >> - struct drm_i915_gem_relocation_entry reloc;
> >> - struct drm_i915_gem_execbuffer2 execbuf;
> >> - struct drm_i915_gem_exec_object2 exec;
> >> + igt_spin_t *spinning_batch;
> >> + struct igt_spin_factory opts = {};
> >> struct drm_i915_gem_context_param param;
> >> - uint32_t b[16];
> >> unsigned ban;
> >> - unsigned len;
> >> - int gen;
> >>
> >> igt_require_hang_ring(fd, ring);
> >>
> >> @@ -295,52 +291,15 @@ igt_hang_t igt_hang_ctx(int fd,
> >> if ((flags & HANG_ALLOW_BAN) == 0)
> >> context_set_ban(fd, ctx, 0);
> >>
> >> - memset(&reloc, 0, sizeof(reloc));
> >> - memset(&exec, 0, sizeof(exec));
> >> - memset(&execbuf, 0, sizeof(execbuf));
> >> -
> >> - exec.handle = gem_create(fd, 4096);
> >> - exec.relocation_count = 1;
> >> - exec.relocs_ptr = to_user_pointer(&reloc);
> >> -
> >> - memset(b, 0xc5, sizeof(b));
> >> -
> >> - len = 0;
> >> - gen = intel_gen(intel_get_drm_devid(fd));
> >> - if (gen >= 8) {
> >> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
> >> - b[len++] = 0;
> >> - b[len++] = 0;
> >> - } else if (gen >= 6) {
> >> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
> >> - b[len++] = 0;
> >> - } else {
> >> - b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
> >> - b[len] = 0;
> >> - if (gen < 4) {
> >> - b[len] |= 1;
> >> - reloc.delta = 1;
> >> - }
> >> - len++;
> >> - }
> >> - b[len++] = MI_BATCH_BUFFER_END;
> >> - b[len] = MI_NOOP;
> >> - gem_write(fd, exec.handle, 0, b, sizeof(b));
> >> -
> >> - reloc.offset = sizeof(uint32_t);
> >> - reloc.target_handle = exec.handle;
> >> - reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
> >> -
> >> - execbuf.buffers_ptr = to_user_pointer(&exec);
> >> - execbuf.buffer_count = 1;
> >> - execbuf.flags = ring;
> >> - i915_execbuffer2_set_context_id(execbuf, ctx);
> >> - gem_execbuf(fd, &execbuf);
> >> + opts.ctx = ctx;
> >> + opts.engine = ring;
> >> + opts.flags = IGT_SPIN_FAST; /* Current driver hangs faster */
> >
> > Be careful, the hanging batch is where we first encountered the
> > traumatic experience from spinning too fast. Use IGT_SPIN_FAST with
> > care, and probably best left to the caller's discretion.
>
> I'll leave it to the caller to spin faster. I actually wanted to add
> both hanging batches: fast and slow. My idea would be to have, even if
> only basics, hang tests for all situations: Moving Head; Still HEAD;
> Idle engine are the ones that come to mind. We could have a require()
> for gen version if needed.
It's not terminal (anymore), just certain ops are slow; slow enough to
disrupt the test in some circumstances.
-Chris
_______________________________________________
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
* Re: [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch
2018-07-13 8:14 [Intel-gfx] " Chris Wilson
@ 2018-07-13 9:26 ` Chris Wilson
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-07-13 9:26 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev
Quoting Chris Wilson (2018-07-13 09:14:53)
> From: Antonio Argenziano <antonio.argenziano@intel.com>
>
> An hanging batch is nothing more than a spinning batch that never gets
> stopped, so re-use the routines implemented in dummyload.c.
>
> v2:
> - Let caller decide spin loop size
> - Now builds with meson.
> v3:
> - Only use loose loops for hangs (Chris)
> v4:
> - No requires
>
> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_gt.c | 57 ++++++++--------------------------------------------
> 1 file changed, 8 insertions(+), 49 deletions(-)
>
> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> index 89b318ae6..e2701fb21 100644
> --- a/lib/igt_gt.c
> +++ b/lib/igt_gt.c
> @@ -40,6 +40,7 @@
> #include "ioctl_wrappers.h"
> #include "intel_reg.h"
> #include "intel_chipset.h"
> +#include "igt_dummyload.h"
>
> /**
> * SECTION:igt_gt
> @@ -271,14 +272,9 @@ igt_hang_t igt_hang_ctx(int fd,
> unsigned flags,
> uint64_t *offset)
> {
> - struct drm_i915_gem_relocation_entry reloc;
> - struct drm_i915_gem_execbuffer2 execbuf;
> - struct drm_i915_gem_exec_object2 exec;
> struct drm_i915_gem_context_param param;
> - uint32_t b[16];
> + igt_spin_t *spin;
> unsigned ban;
> - unsigned len;
> - int gen;
>
> igt_require_hang_ring(fd, ring);
>
> @@ -302,52 +298,15 @@ igt_hang_t igt_hang_ctx(int fd,
> if ((flags & HANG_ALLOW_BAN) == 0)
> context_set_ban(fd, ctx, 0);
>
> - memset(&reloc, 0, sizeof(reloc));
> - memset(&exec, 0, sizeof(exec));
> - memset(&execbuf, 0, sizeof(execbuf));
> -
> - exec.handle = gem_create(fd, 4096);
> - exec.relocation_count = 1;
> - exec.relocs_ptr = to_user_pointer(&reloc);
> -
> - memset(b, 0xc5, sizeof(b));
> -
> - len = 0;
> - gen = intel_gen(intel_get_drm_devid(fd));
> - if (gen >= 8) {
> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
> - b[len++] = 0;
> - b[len++] = 0;
> - } else if (gen >= 6) {
> - b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
> - b[len++] = 0;
> - } else {
> - b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
> - b[len] = 0;
> - if (gen < 4) {
> - b[len] |= 1;
> - reloc.delta = 1;
> - }
> - len++;
> - }
> - b[len++] = MI_BATCH_BUFFER_END;
> - b[len] = MI_NOOP;
> - gem_write(fd, exec.handle, 0, b, sizeof(b));
> -
> - reloc.offset = sizeof(uint32_t);
> - reloc.target_handle = exec.handle;
> - reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
> -
> - execbuf.buffers_ptr = to_user_pointer(&exec);
> - execbuf.buffer_count = 1;
> - execbuf.flags = ring;
> - i915_execbuffer2_set_context_id(execbuf, ctx);
> - gem_execbuf(fd, &execbuf);
> + spin = __igt_spin_batch_new(fd,
> + .ctx = ctx,
> + .engine = ring,
> + .flags = IGT_SPIN_NO_PREEMPTION);
>
> if (offset)
> - *offset = exec.offset;
> + *offset = spin->obj[1].offset;
>
> - return (igt_hang_t){ exec.handle, ctx, ban, flags };
> + return (igt_hang_t){ spin->handle, ctx, ban, flags };
Oh, we shouldn't just leave it dangling. Drat.
-Chris
_______________________________________________
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:[~2018-07-13 9:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-09 18:47 [igt-dev] [PATCH i-g-t] lib/hang_ctx: Make use of dummyload library to create recursive batch Antonio Argenziano
2018-07-09 19:12 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2018-07-09 19:53 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2018-07-09 20:20 ` Antonio Argenziano
2018-07-09 20:36 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2018-07-13 8:14 [Intel-gfx] " Chris Wilson
2018-07-13 9:26 ` [igt-dev] " Chris Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox