From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 12/15] drm/i915: Replace reset_wait_queue with default_wake_function
Date: Wed, 22 Feb 2017 14:13:09 +0000 [thread overview]
Message-ID: <c1c18fae-195e-f64e-af2d-0a0f37779a92@linux.intel.com> (raw)
In-Reply-To: <20170222114610.5819-13-chris@chris-wilson.co.uk>
On 22/02/2017 11:46, Chris Wilson wrote:
> If we change the wait_queue_t from using the autoremove_wake_function to
> the default_wake_function, we no longer have to restore the wait_queue_t
> entry on the wait_queue_head_t list after being woken up by it, as we
> are unusual in sleeping multiple times on the same wait_queue_t.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem_request.c | 30 +++++++-----------------------
> 1 file changed, 7 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
> index 97116e492d01..42250eaf56ec 100644
> --- a/drivers/gpu/drm/i915/i915_gem_request.c
> +++ b/drivers/gpu/drm/i915/i915_gem_request.c
> @@ -946,16 +946,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)
> local_bh_enable(); /* Kick the execlists tasklet if just scheduled */
> }
>
> -static void reset_wait_queue(wait_queue_head_t *q, wait_queue_t *wait)
> -{
> - unsigned long flags;
> -
> - spin_lock_irqsave(&q->lock, flags);
> - if (list_empty(&wait->task_list))
> - __add_wait_queue(q, wait);
> - spin_unlock_irqrestore(&q->lock, flags);
> -}
> -
> static unsigned long local_clock_us(unsigned int *cpu)
> {
> unsigned long t;
> @@ -1060,8 +1050,8 @@ long i915_wait_request(struct drm_i915_gem_request *req,
> const int state = flags & I915_WAIT_INTERRUPTIBLE ?
> TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;
> wait_queue_head_t *errq = &req->i915->gpu_error.wait_queue;
> - DEFINE_WAIT(reset);
> - DEFINE_WAIT(exec);
> + DEFINE_WAIT_FUNC(reset, default_wake_function);
> + DEFINE_WAIT_FUNC(exec, default_wake_function);
> struct intel_wait wait;
>
> might_sleep();
> @@ -1080,13 +1070,13 @@ long i915_wait_request(struct drm_i915_gem_request *req,
>
> trace_i915_gem_request_wait_begin(req, flags);
>
> + add_wait_queue(&req->execute, &exec);
> if (flags & I915_WAIT_LOCKED)
> add_wait_queue(errq, &reset);
>
> wait.tsk = current;
>
> restart:
> - reset_wait_queue(&req->execute, &exec);
> wait.seqno = i915_gem_request_global_seqno(req);
> if (!wait.seqno) {
> do {
> @@ -1100,26 +1090,21 @@ long i915_wait_request(struct drm_i915_gem_request *req,
> i915_reset_in_progress(&req->i915->gpu_error)) {
> __set_current_state(TASK_RUNNING);
> i915_reset(req->i915);
> - reset_wait_queue(errq, &reset);
> continue;
> }
>
> if (signal_pending_state(state, current)) {
> timeout = -ERESTARTSYS;
> - break;
> + goto complete;
> }
>
> if (!timeout) {
> timeout = -ETIME;
> - break;
> + goto complete;
> }
>
> timeout = io_schedule_timeout(timeout);
> } while (1);
> - finish_wait(&req->execute, &exec);
> -
> - if (timeout < 0)
> - goto complete;
>
> GEM_BUG_ON(!wait.seqno);
> }
> @@ -1179,7 +1164,6 @@ long i915_wait_request(struct drm_i915_gem_request *req,
> i915_reset_in_progress(&req->i915->gpu_error)) {
> __set_current_state(TASK_RUNNING);
> i915_reset(req->i915);
> - reset_wait_queue(errq, &reset);
> continue;
> }
>
> @@ -1194,11 +1178,11 @@ long i915_wait_request(struct drm_i915_gem_request *req,
> }
>
> intel_engine_remove_wait(req->engine, &wait);
> - __set_current_state(TASK_RUNNING);
> -
> complete:
> + __set_current_state(TASK_RUNNING);
> if (flags & I915_WAIT_LOCKED)
> remove_wait_queue(errq, &reset);
> + remove_wait_queue(&req->execute, &exec);
> trace_i915_gem_request_wait_end(req);
>
> return timeout;
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-02-22 14:13 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-22 11:45 Pre-emption pre-enablement Chris Wilson
2017-02-22 11:45 ` [PATCH v2 01/15] drm/i915: Keep a global seqno per-engine Chris Wilson
2017-02-22 12:24 ` Tvrtko Ursulin
2017-02-22 11:45 ` [PATCH v2 02/15] drm/i915: Move reeerve_seqno() next to unreserve_seqno() Chris Wilson
2017-02-22 12:23 ` Joonas Lahtinen
2017-02-22 11:45 ` [PATCH v2 03/15] drm/i915: Use a local to shorten req->i915->gpu_error.wait_queue Chris Wilson
2017-02-22 11:45 ` [PATCH v2 04/15] drm/i915: Add ourselves to the gpu error waitqueue for the entire wait Chris Wilson
2017-02-22 11:46 ` [PATCH v2 05/15] drm/i915: Inline __i915_gem_request_wait_for_execute() Chris Wilson
2017-02-22 11:46 ` [PATCH v2 06/15] drm/i915: Deconstruct execute fence Chris Wilson
2017-02-22 11:46 ` [PATCH v2 07/15] drm/i915: Protect the request->global_seqno with the engine->timeline lock Chris Wilson
2017-02-22 12:29 ` Tvrtko Ursulin
2017-02-22 12:45 ` Chris Wilson
2017-02-22 13:13 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 08/15] drm/i915: Take a reference whilst processing the signaler request Chris Wilson
2017-02-22 12:35 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 09/15] drm/i915: Allow an request to be cancelled Chris Wilson
2017-02-22 13:08 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 10/15] drm/i915: Remove the preempted request from the execution queue Chris Wilson
2017-02-22 13:33 ` Tvrtko Ursulin
2017-02-22 13:40 ` Chris Wilson
2017-02-22 13:50 ` Tvrtko Ursulin
2017-02-22 18:53 ` [PATCH v3] " Chris Wilson
2017-02-22 11:46 ` [PATCH v2 11/15] drm/i915: Exercise request cancellation using a mock selftest Chris Wilson
2017-02-22 13:46 ` Tvrtko Ursulin
2017-02-22 13:59 ` Chris Wilson
2017-02-22 14:03 ` Chris Wilson
2017-02-22 14:05 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 12/15] drm/i915: Replace reset_wait_queue with default_wake_function Chris Wilson
2017-02-22 14:13 ` Tvrtko Ursulin [this message]
2017-02-22 11:46 ` [PATCH v2 13/15] drm/i915: Refactor direct GPU reset from request waiters Chris Wilson
2017-02-22 14:16 ` Tvrtko Ursulin
2017-02-22 14:26 ` Chris Wilson
2017-02-22 15:07 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 14/15] drm/i915: Immediately process a reset before starting waiting Chris Wilson
2017-02-22 11:46 ` [PATCH v2 15/15] drm/i915: Remove one level of indention from wait-for-execute Chris Wilson
2017-02-22 14:22 ` Tvrtko Ursulin
2017-02-22 13:22 ` ✗ Fi.CI.BAT: failure for series starting with [v2,01/15] drm/i915: Keep a global seqno per-engine Patchwork
2017-02-22 20:52 ` ✗ Fi.CI.BAT: warning for series starting with [v2,01/15] drm/i915: Keep a global seqno per-engine (rev2) Patchwork
2017-02-22 20:56 ` Chris Wilson
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=c1c18fae-195e-f64e-af2d-0a0f37779a92@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox