From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/9] drm/i915/selftests: Take a ref to the request we wait upon Date: Wed, 20 Nov 2019 09:32:54 +0000 [thread overview] Message-ID: <20191120093302.3723715-1-chris@chris-wilson.co.uk> (raw) i915_request_add() consumes the passed in reference to the i915_request, so if the selftest caller wishes to wait upon it afterwards, it needs to take a reference for itself. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- .../drm/i915/gem/selftests/i915_gem_context.c | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c index 9a509c18b7c7..16df814f3efd 100644 --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c @@ -73,25 +73,34 @@ static int live_nop_switch(void *arg) } for_each_uabi_engine(engine, i915) { - struct i915_request *rq; + struct i915_request *rq = NULL; unsigned long end_time, prime; ktime_t times[2] = {}; times[0] = ktime_get_raw(); for (n = 0; n < nctx; n++) { - rq = igt_request_alloc(ctx[n], engine); - if (IS_ERR(rq)) { - err = PTR_ERR(rq); + struct i915_request *this; + + this = igt_request_alloc(ctx[n], engine); + if (IS_ERR(this)) { + err = PTR_ERR(this); goto out_file; } - i915_request_add(rq); + if (rq) { + i915_request_await_dma_fence(this, &rq->fence); + i915_request_put(rq); + } + rq = i915_request_get(this); + i915_request_add(this); } if (i915_request_wait(rq, 0, HZ / 5) < 0) { pr_err("Failed to populated %d contexts\n", nctx); intel_gt_set_wedged(&i915->gt); + i915_request_put(rq); err = -EIO; goto out_file; } + i915_request_put(rq); times[1] = ktime_get_raw(); @@ -106,13 +115,21 @@ static int live_nop_switch(void *arg) for_each_prime_number_from(prime, 2, 8192) { times[1] = ktime_get_raw(); + rq = NULL; for (n = 0; n < prime; n++) { - rq = igt_request_alloc(ctx[n % nctx], engine); - if (IS_ERR(rq)) { - err = PTR_ERR(rq); + struct i915_request *this; + + this = igt_request_alloc(ctx[n % nctx], engine); + if (IS_ERR(this)) { + err = PTR_ERR(this); goto out_file; } + if (this) { /* Force submission order */ + i915_request_await_dma_fence(this, &rq->fence); + i915_request_put(rq); + } + /* * This space is left intentionally blank. * @@ -127,14 +144,17 @@ static int live_nop_switch(void *arg) * for latency. */ - i915_request_add(rq); + i915_request_add(this); } + GEM_BUG_ON(!rq); if (i915_request_wait(rq, 0, HZ / 5) < 0) { pr_err("Switching between %ld contexts timed out\n", prime); intel_gt_set_wedged(&i915->gt); + i915_request_put(rq); break; } + i915_request_put(rq); times[1] = ktime_sub(ktime_get_raw(), times[1]); if (prime == 2) -- 2.24.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 1/9] drm/i915/selftests: Take a ref to the request we wait upon Date: Wed, 20 Nov 2019 09:32:54 +0000 [thread overview] Message-ID: <20191120093302.3723715-1-chris@chris-wilson.co.uk> (raw) Message-ID: <20191120093254.TUn1w41uHPNQiUS36WsjBrwsTYIQZqReBA-TkG7FPCc@z> (raw) i915_request_add() consumes the passed in reference to the i915_request, so if the selftest caller wishes to wait upon it afterwards, it needs to take a reference for itself. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- .../drm/i915/gem/selftests/i915_gem_context.c | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c index 9a509c18b7c7..16df814f3efd 100644 --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c @@ -73,25 +73,34 @@ static int live_nop_switch(void *arg) } for_each_uabi_engine(engine, i915) { - struct i915_request *rq; + struct i915_request *rq = NULL; unsigned long end_time, prime; ktime_t times[2] = {}; times[0] = ktime_get_raw(); for (n = 0; n < nctx; n++) { - rq = igt_request_alloc(ctx[n], engine); - if (IS_ERR(rq)) { - err = PTR_ERR(rq); + struct i915_request *this; + + this = igt_request_alloc(ctx[n], engine); + if (IS_ERR(this)) { + err = PTR_ERR(this); goto out_file; } - i915_request_add(rq); + if (rq) { + i915_request_await_dma_fence(this, &rq->fence); + i915_request_put(rq); + } + rq = i915_request_get(this); + i915_request_add(this); } if (i915_request_wait(rq, 0, HZ / 5) < 0) { pr_err("Failed to populated %d contexts\n", nctx); intel_gt_set_wedged(&i915->gt); + i915_request_put(rq); err = -EIO; goto out_file; } + i915_request_put(rq); times[1] = ktime_get_raw(); @@ -106,13 +115,21 @@ static int live_nop_switch(void *arg) for_each_prime_number_from(prime, 2, 8192) { times[1] = ktime_get_raw(); + rq = NULL; for (n = 0; n < prime; n++) { - rq = igt_request_alloc(ctx[n % nctx], engine); - if (IS_ERR(rq)) { - err = PTR_ERR(rq); + struct i915_request *this; + + this = igt_request_alloc(ctx[n % nctx], engine); + if (IS_ERR(this)) { + err = PTR_ERR(this); goto out_file; } + if (this) { /* Force submission order */ + i915_request_await_dma_fence(this, &rq->fence); + i915_request_put(rq); + } + /* * This space is left intentionally blank. * @@ -127,14 +144,17 @@ static int live_nop_switch(void *arg) * for latency. */ - i915_request_add(rq); + i915_request_add(this); } + GEM_BUG_ON(!rq); if (i915_request_wait(rq, 0, HZ / 5) < 0) { pr_err("Switching between %ld contexts timed out\n", prime); intel_gt_set_wedged(&i915->gt); + i915_request_put(rq); break; } + i915_request_put(rq); times[1] = ktime_sub(ktime_get_raw(), times[1]); if (prime == 2) -- 2.24.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2019-11-20 9:33 UTC|newest] Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-11-20 9:32 Chris Wilson [this message] 2019-11-20 9:32 ` [Intel-gfx] [PATCH 1/9] drm/i915/selftests: Take a ref to the request we wait upon Chris Wilson 2019-11-20 9:32 ` [PATCH 2/9] drm/i915/gt: Close race between engine_park and intel_gt_retire_requests Chris Wilson 2019-11-20 9:32 ` [Intel-gfx] " Chris Wilson 2019-11-20 13:19 ` Tvrtko Ursulin 2019-11-20 13:19 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 9:32 ` [PATCH 3/9] drm/i915/gt: Unlock engine-pm after queuing the kernel context switch Chris Wilson 2019-11-20 9:32 ` [Intel-gfx] " Chris Wilson 2019-11-20 11:58 ` Tvrtko Ursulin 2019-11-20 11:58 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 12:07 ` Chris Wilson 2019-11-20 12:07 ` [Intel-gfx] " Chris Wilson 2019-11-20 12:40 ` Tvrtko Ursulin 2019-11-20 12:40 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 12:44 ` Chris Wilson 2019-11-20 12:44 ` [Intel-gfx] " Chris Wilson 2019-11-20 13:19 ` Tvrtko Ursulin 2019-11-20 13:19 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 9:32 ` [PATCH 4/9] drm/i915: Mark up the calling context for intel_wakeref_put() Chris Wilson 2019-11-20 9:32 ` [Intel-gfx] " Chris Wilson 2019-11-20 12:46 ` Tvrtko Ursulin 2019-11-20 12:46 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 9:32 ` [PATCH 5/9] drm/i915/gt: Declare timeline.lock to be irq-free Chris Wilson 2019-11-20 9:32 ` [Intel-gfx] " Chris Wilson 2019-11-20 9:32 ` [PATCH 6/9] drm/i915/selftests: Force bonded submission to overlap Chris Wilson 2019-11-20 9:32 ` [Intel-gfx] " Chris Wilson 2019-11-20 12:55 ` Tvrtko Ursulin 2019-11-20 12:55 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 12:59 ` Chris Wilson 2019-11-20 12:59 ` [Intel-gfx] " Chris Wilson 2019-11-20 13:18 ` Tvrtko Ursulin 2019-11-20 13:18 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 13:29 ` Chris Wilson 2019-11-20 13:29 ` [Intel-gfx] " Chris Wilson 2019-11-22 9:34 ` Tvrtko Ursulin 2019-11-22 9:34 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-22 10:03 ` Chris Wilson 2019-11-22 10:03 ` [Intel-gfx] " Chris Wilson 2019-11-22 10:43 ` [PATCH] " Chris Wilson 2019-11-22 10:43 ` [Intel-gfx] " Chris Wilson 2019-11-20 9:33 ` [PATCH 7/9] drm/i915/selftests: Flush the active callbacks Chris Wilson 2019-11-20 9:33 ` [Intel-gfx] " Chris Wilson 2019-11-20 9:33 ` [PATCH 8/9] drm/i915/selftests: Be explicit in ERR_PTR handling Chris Wilson 2019-11-20 9:33 ` [Intel-gfx] " Chris Wilson 2019-11-20 10:23 ` Matthew Auld 2019-11-20 10:23 ` [Intel-gfx] " Matthew Auld 2019-11-20 9:33 ` [PATCH 9/9] drm/i915/gt: Schedule request retirement when timeline idles Chris Wilson 2019-11-20 9:33 ` [Intel-gfx] " Chris Wilson 2019-11-20 13:16 ` Tvrtko Ursulin 2019-11-20 13:16 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 13:39 ` Chris Wilson 2019-11-20 13:39 ` [Intel-gfx] " Chris Wilson 2019-11-20 14:16 ` Tvrtko Ursulin 2019-11-20 14:16 ` [Intel-gfx] " Tvrtko Ursulin 2019-11-20 14:25 ` Chris Wilson 2019-11-20 14:25 ` [Intel-gfx] " Chris Wilson 2019-11-20 10:19 ` [PATCH 1/9] drm/i915/selftests: Take a ref to the request we wait upon Matthew Auld 2019-11-20 10:19 ` [Intel-gfx] " Matthew Auld 2019-11-20 10:25 ` Chris Wilson 2019-11-20 10:25 ` [Intel-gfx] " Chris Wilson 2019-11-20 10:27 ` [PATCH] " Chris Wilson 2019-11-20 10:27 ` [Intel-gfx] " Chris Wilson 2019-11-20 10:34 ` Matthew Auld 2019-11-20 10:34 ` [Intel-gfx] " Matthew Auld 2019-11-20 13:51 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with drm/i915/selftests: Take a ref to the request we wait upon (rev2) Patchwork 2019-11-20 13:51 ` [Intel-gfx] " Patchwork 2019-11-20 14:19 ` ✗ Fi.CI.BAT: failure " Patchwork 2019-11-20 14:19 ` [Intel-gfx] " Patchwork 2019-11-20 14:20 ` Chris Wilson 2019-11-20 14:20 ` [Intel-gfx] " Chris Wilson 2019-11-22 12:33 ` ✗ Fi.CI.BUILD: failure for series starting with drm/i915/selftests: Take a ref to the request we wait upon (rev3) Patchwork 2019-11-22 12:33 ` [Intel-gfx] " Patchwork
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20191120093302.3723715-1-chris@chris-wilson.co.uk \ --to=chris@chris-wilson.co.uk \ --cc=intel-gfx@lists.freedesktop.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.