From patchwork Wed Oct 3 12:03:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10624703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 341BA14BD for ; Wed, 3 Oct 2018 12:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26D5528944 for ; Wed, 3 Oct 2018 12:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AB8328952; Wed, 3 Oct 2018 12:04:27 +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.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 9DA8528944 for ; Wed, 3 Oct 2018 12:04:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C84B6E45C; Wed, 3 Oct 2018 12:04:24 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 194AB6E454 for ; Wed, 3 Oct 2018 12:04:17 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id q8-v6so5357427wmq.4 for ; Wed, 03 Oct 2018 05:04:17 -0700 (PDT) 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=0bfB2VF+w5qCo8YcFioOX+mGTQ6w9nN1i3/+xY1dUvc=; b=gNW5cy0oSs9G/hXKS9hNGu3hc8g7WT8FhhoZnCrSYBoltzpzlkBLrR6xjzVoyIunnp TgvsvDexEvF9I3bmQELwV5zQQX3arG9TTFLSv7kbFdNPp4XBeKDPSYvKbeW/DiDPrhtF +ZYZM6+ZmKOfqehLotPK8vulHzVjwprrFi+k+RIpC3eHCSDTf137Y/YvAolpg3p1+eDR NA5Vte8RTCzvcsvkQnjNfRr2CAgARsX6Ws/TmHMJJNbra6xNVI7e5cyG17A9Dxh5TfXw URDs6S27qXabd6mhvKdXD/x2j6u7O5IYhpwG6vjR4IW/3pwDxn0BC+gg5xz/ovtU4PtE 2tNA== X-Gm-Message-State: ABuFfohIT7E8LSX31jxqh+QJIwMT50v2IB7EepF4p2gpML+g9I3OK2UX t1nB3O/F8DGQkTUC+7CiTCeufM0E5JI= X-Google-Smtp-Source: ACcGV63RvdfglGF4n8yTock7w8fQqsCMZ1WagJeLw6sM1uqPNp1OHfNVHQAUgteFlsv1jAJCK2AdCQ== X-Received: by 2002:a1c:a9d4:: with SMTP id s203-v6mr1229564wme.58.1538568255457; Wed, 03 Oct 2018 05:04:15 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id f69-v6sm866657wmf.34.2018.10.03.05.04.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 05:04:14 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 3 Oct 2018 13:03:56 +0100 Message-Id: <20181003120406.6784-4-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003120406.6784-1-tvrtko.ursulin@linux.intel.com> References: <20181003120406.6784-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [RFC 03/13] 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 | 1 + drivers/gpu/drm/i915/intel_ringbuffer.h | 8 ++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index 689f838e849c..97a157f47a87 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -474,6 +474,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); @@ -1036,6 +1037,8 @@ void i915_request_add(struct i915_request *request) } request->emitted_jiffies = jiffies; + atomic_inc(&engine->request_stats.queued); + /* * Let the backend know a new request has arrived that may need * to adjust the existing execution schedule due to a high priority diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c index f46ef765aed0..1b3f562246c9 100644 --- a/drivers/gpu/drm/i915/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/intel_engine_cs.c @@ -1460,11 +1460,12 @@ 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], runnable %u\n", + drm_printf(m, "\tcurrent seqno %x, last %x, hangcheck %x [%d ms], 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), + 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 f0c2673fce49..3e8b16ab1b33 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -1024,6 +1024,7 @@ static void queue_request(struct intel_engine_cs *engine, { list_add_tail(&node->link, i915_sched_lookup_priolist(engine, prio)); engine->request_stats.runnable++; + atomic_dec(&engine->request_stats.queued); } static void __submit_queue_imm(struct intel_engine_cs *engine) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 07491b6c7796..dc11ed10bac4 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -381,6 +381,14 @@ struct intel_engine_cs { void *pinned_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. *