From patchwork Wed Jun 6 12:48:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10450167 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 9F7ED60375 for ; Wed, 6 Jun 2018 12:50:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B030294C3 for ; Wed, 6 Jun 2018 12:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F68129C26; Wed, 6 Jun 2018 12:50:52 +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 7A17F294C3 for ; Wed, 6 Jun 2018 12:49:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09BE86EFFB; Wed, 6 Jun 2018 12:49:08 +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 3D5766EFDF for ; Wed, 6 Jun 2018 12:48:58 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id a12-v6so6175014wro.1 for ; Wed, 06 Jun 2018 05:48:58 -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=1sKUNUzwI/PL6/iYOb15CXbpTsfWi7iEN1QswzjYVNs=; b=n6gtf4AqqkntAg9Dsf28wXkpJWGWCQZMj8IRrmsCKSagkLoxZefW+dDfyt6dKBDE5l JnB4bSdGihKV5R9S2IOEtoEOfgfbSTyQ37uAVxJmDU9uU6ypbdkWadtWYXU4cqk0ncT+ 0TLrWlWUzkS6jJyome0Vonx8yXrJrrioIdFlPZuJNaGvtybwPAGz4DRqQ/0BnqW63lbC bSxO0ZEzBMoitXuo1hS9/jDwKzu9ASNyi+5Eib2TmIlR9CD1H0bV11xF8ETlbvrv3ouh EXRXAgBNAzzOh2zU2JwmAmWkdBPUxDrIMOEeph3wcN90My4KDAi4al2kXf29gsA2g6eN 5G4Q== X-Gm-Message-State: APt69E3ASuMKSdi32zhMfGtJxIkVdG4ipxjq4RurlMGSSB5mmkMmME2O Ng4jVA9dZanqiuokZU9Hx2kZUXIz X-Google-Smtp-Source: ADUXVKLXOHBVC52pSL7bjgnDAYZI4OJyW86PouQusnY3s1YAxv35s3eEEg8KFkYyt/daHzts5svnow== X-Received: by 2002:adf:8e30:: with SMTP id n45-v6mr2152649wrb.27.1528289336707; Wed, 06 Jun 2018 05:48:56 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id v14-v6sm24982999wro.33.2018.06.06.05.48.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 05:48:56 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 6 Jun 2018 13:48:44 +0100 Message-Id: <20180606124848.13050-4-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180606124848.13050-1-tvrtko.ursulin@linux.intel.com> References: <20180606124848.13050-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH 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 b8ddcd23a6f3..53ba70ea7af3 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -558,6 +558,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); @@ -1109,6 +1110,8 @@ void __i915_request_add(struct i915_request *request, bool flush_caches) } 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 1bb3be96ca08..d2a51aefed38 100644 --- a/drivers/gpu/drm/i915/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/intel_engine_cs.c @@ -1420,11 +1420,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 ed90f7a46e9a..cac9888376b0 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -1201,7 +1201,9 @@ static void execlists_submit_request(struct i915_request *request) queue_request(engine, &request->sched, 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->sched.link)); diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 3e0cfac49755..eeb7f3662195 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -345,6 +345,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. *