From patchwork Mon Apr 9 16:38:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10331747 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 E09C960236 for ; Mon, 9 Apr 2018 16:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1D0420952 for ; Mon, 9 Apr 2018 16:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C667828619; Mon, 9 Apr 2018 16:38:38 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 668AE20952 for ; Mon, 9 Apr 2018 16:38:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F01E789E38; Mon, 9 Apr 2018 16:38:17 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA2BA89E38 for ; Mon, 9 Apr 2018 16:38:16 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id d1so10211101wrj.13 for ; Mon, 09 Apr 2018 09:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NIcKJ/lnkLa34LhNloIeLH63zHZ/Yrp+sce1JDI6JNw=; b=1jaFFkmge+s43MTgpuVzpH6j1COuptsnLAYpYjmkqLlhPhGml83V59W6pDgtYFOccT uMjsry2GRJuoU7fHtvkZjnjCDWrqCjNcweq/gEH9q6PHwXjK8n2EQmaWwOJMnY0wLXk8 8EVccuQOj4HRFLXF0iNUbAaVeVPK2OQ3IEb8fNyeTtn5N/BQr7raViJ8e7MqXCP8oda9 DGx6ZBNJEarKeOhNCEqHR8TJW7dPP1Wn3MPcHt748izySZs1BBVolsRj9/Sh0LantZ8M e+VDbs8WKej5WStudI3oJMY3+QVVX2W2P8U6aP9qv2VkNAaepfWAoUOYqGbGsEgGj6Qm uWkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NIcKJ/lnkLa34LhNloIeLH63zHZ/Yrp+sce1JDI6JNw=; b=QVwo+rny0F52PSQA5p1my0qGoTPa3S8ZBRqV379bx6wEoDFCMLqv2CbzNAyVopcPxh 03BNQ5fs30SOy4df/AAzvMUoc2YS0NlRq/66444mCvCusLfc//hzViraa5ysIa/dejeG QKHX4yoYMbYCVsVvdQtPWLV4YKkz/6EiCEeV3pzqMgLmFrbTeQehSAApcbohuZKvdBmF 5SSN+lldhBIZXE9x/YGcCJNy8QWnoTF/vvGflL480zn9cKaUlaRPRmprBgc/F9wzUiQ2 rBkNtI6UOb/2SibrxfN3fqc13W5GbORI1UtQ0LpuPtzTxdsb1CcpG1jdvNe78bOjfAeM UT1Q== X-Gm-Message-State: AElRT7HDPF43m6IQt4Lm2tzq9E/bt4tL9+3xtDGKRLFNVUpLctcbDvfr DfXgMh6QSRWTcpxdqvRKnCeM7/k7 X-Google-Smtp-Source: AIpwx4/h7BM4pM8dVPeKkKVshNbUYZVClKUevYZQvWdtkdTyU8wnOEqOdykew0O/CSfvkyHS4xKG3A== X-Received: by 10.223.141.143 with SMTP id o15mr28384765wrb.272.1523291895166; Mon, 09 Apr 2018 09:38:15 -0700 (PDT) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id g185sm1674044wmf.40.2018.04.09.09.38.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 09:38:14 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Mon, 9 Apr 2018 17:38:06 +0100 Message-Id: <20180409163806.14165-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180405123923.22671-4-tvrtko.ursulin@linux.intel.com> References: <20180405123923.22671-4-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH v4 3/7] drm/i915: Keep a count of requests submitted from userspace X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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 From: Tvrtko Ursulin Keep a count of requests submitted from userspace and not yet runnable due unresolved dependencies. v2: Rename and move under the container struct. (Chris Wilson) v3: Rebase. v4: Move decrement site to the backend to shrink the window of double- accounting as much as possible. (Chris Wilson) Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_request.c | 3 +++ drivers/gpu/drm/i915/intel_engine_cs.c | 3 ++- drivers/gpu/drm/i915/intel_lrc.c | 2 ++ drivers/gpu/drm/i915/intel_ringbuffer.h | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index 2617bd008845..997be595d7e7 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -511,6 +511,7 @@ void i915_request_submit(struct i915_request *request) spin_lock_irqsave(&engine->timeline->lock, flags); engine->request_stats.runnable++; + atomic_dec(&engine->request_stats.queued); __i915_request_submit(request); @@ -1072,6 +1073,8 @@ void __i915_request_add(struct i915_request *request, bool flush_caches) engine->schedule(request, request->ctx->priority); rcu_read_unlock(); + atomic_inc(&engine->request_stats.queued); + local_bh_disable(); i915_sw_fence_commit(&request->submit); local_bh_enable(); /* Kick the execlists tasklet if just scheduled */ diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c index 98254ff92785..e4992c2e23a4 100644 --- a/drivers/gpu/drm/i915/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/intel_engine_cs.c @@ -1934,12 +1934,13 @@ void intel_engine_dump(struct intel_engine_cs *engine, if (i915_terminally_wedged(&engine->i915->gpu_error)) drm_printf(m, "*** WEDGED ***\n"); - drm_printf(m, "\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d, runnable %u\n", + drm_printf(m, "\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d, queued %u, runnable %u\n", intel_engine_get_seqno(engine), intel_engine_last_submit(engine), engine->hangcheck.seqno, jiffies_to_msecs(jiffies - engine->hangcheck.action_timestamp), engine->timeline->inflight_seqnos, + atomic_read(&engine->request_stats.queued), engine->request_stats.runnable); drm_printf(m, "\tReset count: %d (global %d)\n", i915_reset_engine_count(error, engine), diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 16ea95ff7c51..ddd14e30be6c 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -1124,7 +1124,9 @@ static void execlists_submit_request(struct i915_request *request) queue_request(engine, &request->priotree, rq_prio(request)); submit_queue(engine, rq_prio(request)); + engine->request_stats.runnable++; + atomic_dec(&engine->request_stats.queued); GEM_BUG_ON(!engine->execlists.first); GEM_BUG_ON(list_empty(&request->priotree.link)); diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 54d2ad1c8daa..616066f536c9 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -339,6 +339,14 @@ struct intel_engine_cs { struct drm_i915_gem_object *default_state; struct { + /** + * @queued: Number of submitted requests with dependencies. + * + * Count of requests waiting for dependencies before they can be + * submitted to the backend. + */ + atomic_t queued; + /** * @runnable: Number of runnable requests sent to the backend. *