From patchwork Wed Feb 22 11:46:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9586647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 397716020B for ; Wed, 22 Feb 2017 11:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15B2728845 for ; Wed, 22 Feb 2017 11:46:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A916288BC; Wed, 22 Feb 2017 11:46:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 79F0928845 for ; Wed, 22 Feb 2017 11:46:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED5A56E7CB; Wed, 22 Feb 2017 11:46:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5AB2A6E7CB for ; Wed, 22 Feb 2017 11:46:21 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id s27so17197wrb.0 for ; Wed, 22 Feb 2017 03:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ReGevaOotslNcnrIQm93uV0qIr/UaS+/YbMCCj/K4LI=; b=fvMi4ZhIpBsQYwCjxWLokXCkohYwoH3vipD1V2AIilqkv1I5B6hJMdHOWNydj56OYJ fExSm1kJQ/1JQyglhTeP8Mj51hVlrXHOlbhTSs8il7j7U4PZKLH2xVGV2mr7UoomUmUQ /lFAWuVUuLGDEG6SPGuFuXcYVmuXOQE/eoMslsRJgscIqCmaKIIRbdSgrOwmLv4ZGAZ0 J2Ajmi6Jx8LmNyRNENCdNjXcQQ2AQ4nqDdv8AXwOIBWsHIkyd85jIvPcke2ynSsn2Yhd TMKA6T9pwr1MWuFQ2iEY1LrHJRW5KfW4pExIkKMh/6EKflXwXXvaqpvAnaV3d7b0nnku Q2MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ReGevaOotslNcnrIQm93uV0qIr/UaS+/YbMCCj/K4LI=; b=dGi6ytiWhQ9HGCVZf0BqkvreG09VK33BlOfHL5aFUOkfudFO7VThPIVQazRCD4GLn9 X0br0y+x8XEViEUi75JPHgiGDTtfpuisgn3rFvv/JPCLdh8O7c8TV3rb1Eul6u/rFMuf 64SzWcOE9eBSUmOFrvPg+s4AJlBCBBcv4mlXgddl0RR8Kd+yHPy+UydsiDT4zOIj0qv/ Lq72vCoizJPUlxR6CoL/yikX9y5q2jl+JlUyOHT6OO0NDSgbpPi58JO+9GNxPYJ+/5Me c9jMNs5jDPiQW9z/qNocETY3OgBTgsedYAB/WQGRUn/ZstRPRVYTiPOtuLyFGsivBIlh Ysmg== X-Gm-Message-State: AMke39lea2RO9MhGOMz+WtAxUlqNXxQ3zcIHZIJMu/xk0jYkj5IsOhGpnSfagEqwhpsBXw== X-Received: by 10.223.166.72 with SMTP id k66mr22298936wrc.52.1487763980000; Wed, 22 Feb 2017 03:46:20 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id 10sm1439889wrw.13.2017.02.22.03.46.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Feb 2017 03:46:19 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 22 Feb 2017 11:46:00 +0000 Message-Id: <20170222114610.5819-6-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170222114610.5819-1-chris@chris-wilson.co.uk> References: <20170222114610.5819-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH v2 05/15] drm/i915: Inline __i915_gem_request_wait_for_execute() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP It had only one callsite and existed to keep the code clearer. Now having shared the wait-on-error between phases and with plans to change the wait-for-execute in the next few patches, remove the out of line wait loop and move it into the main body of i915_wait_request. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_gem_request.c | 78 ++++++++++++--------------------- 1 file changed, 29 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index ed1d42e7a206..88139dbf8fcc 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -1005,54 +1005,6 @@ bool __i915_spin_request(const struct drm_i915_gem_request *req, return false; } -static long -__i915_request_wait_for_execute(struct drm_i915_gem_request *request, - unsigned int flags, - long timeout) -{ - const int state = flags & I915_WAIT_INTERRUPTIBLE ? - TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE; - wait_queue_head_t *q = &request->i915->gpu_error.wait_queue; - DEFINE_WAIT(reset); - DEFINE_WAIT(wait); - - if (flags & I915_WAIT_LOCKED) - add_wait_queue(q, &reset); - - do { - prepare_to_wait(&request->execute.wait, &wait, state); - - if (i915_sw_fence_done(&request->execute)) - break; - - if (flags & I915_WAIT_LOCKED && - i915_reset_in_progress(&request->i915->gpu_error)) { - __set_current_state(TASK_RUNNING); - i915_reset(request->i915); - reset_wait_queue(q, &reset); - continue; - } - - if (signal_pending_state(state, current)) { - timeout = -ERESTARTSYS; - break; - } - - if (!timeout) { - timeout = -ETIME; - break; - } - - timeout = io_schedule_timeout(timeout); - } while (1); - finish_wait(&request->execute.wait, &wait); - - if (flags & I915_WAIT_LOCKED) - remove_wait_queue(q, &reset); - - return timeout; -} - /** * i915_wait_request - wait until execution of request has finished * @req: the request to wait upon @@ -1102,7 +1054,35 @@ long i915_wait_request(struct drm_i915_gem_request *req, add_wait_queue(errq, &reset); if (!i915_sw_fence_done(&req->execute)) { - timeout = __i915_request_wait_for_execute(req, flags, timeout); + DEFINE_WAIT(exec); + + do { + prepare_to_wait(&req->execute.wait, &exec, state); + if (i915_sw_fence_done(&req->execute)) + break; + + if (flags & I915_WAIT_LOCKED && + 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; + } + + if (!timeout) { + timeout = -ETIME; + break; + } + + timeout = io_schedule_timeout(timeout); + } while (1); + finish_wait(&req->execute.wait, &exec); + if (timeout < 0) goto complete;