From patchwork Thu Feb 2 15:13:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9552239 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 D32C760236 for ; Thu, 2 Feb 2017 15:13:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D03042818E for ; Thu, 2 Feb 2017 15:13:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4B5D28425; Thu, 2 Feb 2017 15:13: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 77FF42818E for ; Thu, 2 Feb 2017 15:13:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3A816EA36; Thu, 2 Feb 2017 15:13:23 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wj0-x243.google.com (mail-wj0-x243.google.com [IPv6:2a00:1450:400c:c01::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA3EC6EA35 for ; Thu, 2 Feb 2017 15:13:21 +0000 (UTC) Received: by mail-wj0-x243.google.com with SMTP id kq3so1333651wjc.3 for ; Thu, 02 Feb 2017 07:13: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=Hf5vBWgtvGM9nHxsJo/L2Qn0O1NQSnrxy1c0CaTzZs0=; b=AMey4DY9O0A7DzAIjE+aRsb4viiKIh1HmKOC8rv88yWeAkP24QnczufJnb5Z8R9hGA e9k+RIKSqfxvH0IF5q7+RU8n1THUV+1dM3buO+XJ85cCAKMLoEirCvKKMrJ4lZCmJHDl aYmxxGT0A4PXo4E8Ioi9PVXFH/UI96giqBv2hlvKWbzE9LQ62zHvFUtyfVIdgBy2Jkf9 /aZuDsGhZvELMerZgyAUcDFJ2fqBoJ02Y3D5xaFM90/y+RUBPG3LDeBZRcQLGV6/cPBV 62vLJqxMrFXt11gUcHj7F7xs8tjIMP+VQ87TP3M0TVNirbCOrLddeNZdj0kOGXvf21hi 9shA== 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=Hf5vBWgtvGM9nHxsJo/L2Qn0O1NQSnrxy1c0CaTzZs0=; b=S9wFZ5fZ4W1xiKTfRMcFv2Bm8oS/8z/pSaB/Hs42D5ed5LCVFYfkz/AKruiYjdjy5s xPnYXcLhwCOO7ECNbVPld95e2zdypFUaJtXERjdAh51zQIE3AliWOQenVRtB6EzUtzt7 4H4b2xc5jGEhGqwkvVCYLpzlD6jjaedp8TuZHeQIjUU7dgHRh/OU8WBFmsuut10y0Xs2 a/P2mi/nGRtVxzuZ+acVKCALC/c+UOFAzNCyhnhx0YsKihZnj5qdnksoJx4/A+mwqb7V gTMzqArZzae3c8kth/fy25+oqjPllmfLaHOY9/C5+P7FQmVnkRMEz9GOmceGNK7CdQfu M6rg== X-Gm-Message-State: AIkVDXKn1h+3ZzqF6S8M72fwxLYXY0LBHhOdEHnkeOlV7dSmKcuQTLV/w2sEMdx8Q7UauA== X-Received: by 10.223.131.34 with SMTP id 31mr9441862wrd.119.1486048400166; Thu, 02 Feb 2017 07:13:20 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id o81sm3624020wmb.14.2017.02.02.07.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2017 07:13:19 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 2 Feb 2017 15:13:02 +0000 Message-Id: <20170202151312.31406-4-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170202151312.31406-1-chris@chris-wilson.co.uk> References: <20170202151312.31406-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 04/14] 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 --- drivers/gpu/drm/i915/i915_gem_request.c | 68 ++++++++++++--------------------- 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 8d4f0c859fee..e4eeb5f5453c 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -988,49 +988,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; - } - - timeout = io_schedule_timeout(timeout); - } while (timeout); - 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 @@ -1080,7 +1037,30 @@ 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; + } + + timeout = io_schedule_timeout(timeout); + } while (timeout); + finish_wait(&req->execute.wait, &exec); + if (timeout < 0) goto complete;