From patchwork Thu Apr 5 12:39:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10324515 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 C4AF46053F for ; Thu, 5 Apr 2018 12:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4C7B29181 for ; Thu, 5 Apr 2018 12:39:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9A4129184; Thu, 5 Apr 2018 12:39:41 +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 57AE929181 for ; Thu, 5 Apr 2018 12:39:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05AB66E760; Thu, 5 Apr 2018 12:39:39 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39B366E760 for ; Thu, 5 Apr 2018 12:39:37 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id r191so5261256wmg.4 for ; Thu, 05 Apr 2018 05:39:36 -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=H0hoc+/WvKi29frpEIhTLWqMYhd0UuQMAsYC+sVEFSE=; b=qu4kigcBfv8ap6Xm2OekV6ErSdAOmiwiWyfiiCDTGsftGXpZZSbvMA2E0EXS29zNru P2NkDoagPg37sQBSx6HdaYLr83GdKijw7wfB7QGDJqc+FL17gHhZU+zW5kRJl+O+C3md RVPXA9EMB7N09eyn+Efd4gFRc7f8vUF4/s+FuT0vPxZ7yMj/3y571ovj4XVT0PQFf/+O WqwrKh/Q9+QPZ8WtNZezqKqkHxwldilhIz1zRllJh1oXmDaLPIPQtD0avNjCFzpCiOjn ff7Pp7PdSmyVMAVDxFvjhJ9HymuwNgTAC+i5hW6e7BpgYGh95zmiASF7Cs6DNa05FiZQ WwtQ== 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=H0hoc+/WvKi29frpEIhTLWqMYhd0UuQMAsYC+sVEFSE=; b=NJSng8vYc5dQlvN1snTCgEQoP84SLvRVy/Ims9kKp8A2nX1nbtWPN5Qa8jo55C+Y5w unXdGH0bdbgXYArE7qYeHeWjtZSN7JZUWHVAUxr+sGx95ti7owe2P3y0fVo3l5CA5AnN G1gC5opwMBAXdOAGM6vDzSTpdjgDvjJ2SbJEBM4onbZX/dtnT3wx7XxoxnIrEblqIEVN R2FwnRzWG6ytpFJG5dJwgYKhig7/XECwTdsxx43q0+1cEB+QlOThXAPahtab94Cu7RcR Qvr+BZ0ssr8U+h6P+KXjn8JxE5EAtcFGeyzDkKHFIzCf2S8+EHHvXIGJWzqJhv63UdhY fB6A== X-Gm-Message-State: ALQs6tDo70Ft0AGsxijAl3YtJpphdu494ft+UWhtCv01MJJdesn3LfhK cx/a8WlT7TS8ZQIw6IdQMJf4m07I X-Google-Smtp-Source: AIpwx48Ruvlg4VKyv7ZbAzEH2T+PfyD6BGTryHkDVcAnEcPb39Adu+cUUYTjEK/bjMX67gLn+5Ga8A== X-Received: by 10.28.195.67 with SMTP id t64mr11553740wmf.113.1522931975568; Thu, 05 Apr 2018 05:39:35 -0700 (PDT) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id n21sm9800333wmi.37.2018.04.05.05.39.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 05:39:34 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 5 Apr 2018 13:39:19 +0100 Message-Id: <20180405123923.22671-4-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180405123923.22671-1-tvrtko.ursulin@linux.intel.com> References: <20180405123923.22671-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. 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_ringbuffer.h | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index 5c01291ad1cc..152321655fe6 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -640,6 +640,7 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state) rcu_read_lock(); request->engine->submit_request(request); rcu_read_unlock(); + atomic_dec(&request->engine->request_stats.queued); break; case FENCE_FREE: @@ -1118,6 +1119,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_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. *