From patchwork Thu Feb 23 07:44:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9587871 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 2D87A604A2 for ; Thu, 23 Feb 2017 07:45:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A91728621 for ; Thu, 23 Feb 2017 07:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F49F286A7; Thu, 23 Feb 2017 07:45:06 +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 E963528621 for ; Thu, 23 Feb 2017 07:45:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8939C6E978; Thu, 23 Feb 2017 07:45:02 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37F326E97F for ; Thu, 23 Feb 2017 07:44:32 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id r18so1182084wmd.3 for ; Wed, 22 Feb 2017 23:44:32 -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=AwlNgSKxIalJuMaCwsNUysbW4qwV1jwihWPZkthP6YwrH0yVqThEBu+VR1NSMgmXOD lcYDOf847iExCKypJDTuMURn4/0i8ks4Y+1Stsg+DtnRR9bny/U+AnIlvsaLAtsyu7ag 3g9PQWg/zg1hUv1TImGIE3P3Vs0vjQb/cyeb2mitthpiuse7lXJRfwXn2QlD/YJRWrTM FIgtSqwTIr1h3NejC253XJ//dMy0JpZWFHXR5F2sllnmlyo13UoirVm/Kaf3UJAjz7Sk LBX7XcfCNwTWZWHx1vLrZR1LiqyX8MmsuuHL875U0NSakzY97lmq9SM5c38aB7WqlA+B qPfw== 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=lHvMMdkQVESbJ/NmtgElNn+wSWivqCGvFSSAFfxzrwgbEs+o6DZrDZdW2kHQPtlbwY jPJA0PJ1rmF8LrznJShhvv/FRPcDkAxngk3lCKgCInEP8xaPxo2pElBmOqQfBV4nhFEg /BTUe/C6r22uo4iD68Ry2W58KJc+DFX18PVu1fhKHy8s/cvo+UvfNGSJl2S84n+lmzKA OZ3V72TNR3oQt1rBgzg9YZpmENmFNkfG8xTw1BCqC/2SzDLA7acofZGLYFPTxFCpgDlw Qa9AvLb76oaSkIcWXJs8rRgXPxfhqwvgjaGUghO9zOymAkogq2lC8AfA+E7VznqyFq0V UYkg== X-Gm-Message-State: AMke39k7/Tqaxs5nmkAQPh9J7x7l46Ggh70K/cZ2l2PzD0uq4olYrytBlLo0GBMf3ZrhnQ== X-Received: by 10.28.91.1 with SMTP id p1mr1493912wmb.102.1487835870631; Wed, 22 Feb 2017 23:44:30 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id 186sm5655906wmw.24.2017.02.22.23.44.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Feb 2017 23:44:30 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 23 Feb 2017 07:44:12 +0000 Message-Id: <20170223074422.4125-7-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170223074422.4125-1-chris@chris-wilson.co.uk> References: <20170223074422.4125-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH v4 06/16] 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;