Re: [igt-dev] [RFC] tests/gem_watchdog: Initial set of tests for GPU watchdog

Chris Wilson
2019-04-16T20:21:37Z

Quoting Antonio Argenziano (2019-04-16 21:16:35)
>
>
> On 15/04/19 19:02, Carlos Santa wrote:
> > On Mon, 2019-04-15 at 14:50 -0700, Antonio Argenziano wrote:
> >>
> >> On 15/04/19 11:22, Carlos Santa wrote:
> >>> +{
> >>> + struct drm_i915_gem_exec_object2 obj[2];
> >>> + struct drm_i915_gem_relocation_entry reloc;
> >>> + struct drm_i915_gem_execbuffer2 execbuf;
> >>> + igt_spin_t *spin = NULL;
> >>> +
> >>> + const uint32_t bbe = MI_BATCH_BUFFER_END;
> >>> + int i = 0;
> >>> + int fence;
> >>> +
> >>> + gem_quiescent_gpu(fd);
> >>> +
> >>> + memset(&execbuf, 0, sizeof(execbuf));
> >>> + memset(&obj, 0, sizeof(obj));
> >>> + memset(&reloc, 0, sizeof(reloc));
> >>> +
> >>> + execbuf.buffers_ptr = to_user_pointer(obj);
> >>> +
> >>> + execbuf.buffer_count = 2;
> >>> + execbuf.flags = exec_id | LOCAL_EXEC_FENCE_OUT;
> >>> +
> >>> + obj[0].handle = target;
> >>> + obj[1].handle = gem_create(fd, 4096);
> >>> +
> >>> + obj[1].relocation_count = 1;
> >>> + obj[1].relocs_ptr = to_user_pointer(&reloc);
> >>> +
> >>> + reloc.target_handle = obj[0].handle;
> >>> + reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
> >>> + reloc.write_domain = I915_GEM_DOMAIN_COMMAND;
> >>> + reloc.delta = offset * sizeof(uint32_t);
> >>> +
> >>> + reloc.offset = i * sizeof(uint32_t);
> >>> + gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
> >>> +
> >>> + __sync_synchronize();
> >>> +
> >>> + if (handle) {
> >>> + *handle = obj[1].handle;
> >>> + return;
> >>> + }
> >>> + gem_sync(fd, obj[1].handle);
> >>> + execbuf.rsvd1 = ctx_id;
> >>> + execbuf.rsvd2 = -1;
> >>> +
> >>> + spin = igt_spin_batch_new(fd, .dependency = obj[0].handle);
> >>> + igt_spin_batch_set_timeout(spin, timeout);
> >>> + igt_assert(gem_bo_busy(fd, obj[0].handle));
> >>> +
> >>> + gem_execbuf_wr(fd, &execbuf);
> >>> + igt_spin_batch_free(fd, spin);
> >>> +
> >>> + fence = execbuf.rsvd2 >> 32;
> >>> +
> >>> +#if 0
> >>> + igt_info("fence:%d, fence status : %d EIO: %d
> >>> ctx_id:%d\n",fence, sync_fence_status(fence),-EIO, ctx_id);
> >>> +#endif
> >>> +
> >
> > Any ideas why would the fence wouldn't signal correctly (i.e., EIO)
> > after resetting? I need help with this...
>
> Not sure, it looks correct on this end, just one small comment would be
> to use I915_EXEC_FENCE_OUT instead of the local flag.

Hint: it doesn't run to the timeout.
-Chris