All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tursulin@ursulin.net>, Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/7] drm/i915: Keep a count of requests waiting for a slot on GPU
Date: Fri, 06 Apr 2018 21:16:51 +0100	[thread overview]
Message-ID: <152304581164.23749.5574576484215087231@mail.alporthouse.com> (raw)
In-Reply-To: <20180405123923.22671-3-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2018-04-05 13:39:18)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Keep a per-engine number of runnable (waiting for GPU time) requests.
> 
> v2:
>  * Move queued increment from insert_request to execlist_submit_request to
>    avoid bumping when re-ordering for priority.
>  * Support the counter on the ringbuffer submission path as well, albeit
>    just notionally. (Chris Wilson)
> 
> v3:
>  * Rebase.
> 
> v4:
>  * Rename and move the stats into a container structure. (Chris Wilson)
> 
> v5:
>  * Re-order fields in struct intel_engine_cs. (Chris Wilson)
> 
> v6-v8:
>  * Rebases.
> 
> v9:
>  * Fix accounting during wedging.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c         | 1 +
>  drivers/gpu/drm/i915/i915_request.c     | 7 +++++++
>  drivers/gpu/drm/i915/intel_engine_cs.c  | 5 +++--
>  drivers/gpu/drm/i915/intel_lrc.c        | 1 +
>  drivers/gpu/drm/i915/intel_ringbuffer.h | 9 +++++++++
>  5 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 9650a7b10c5f..63f334d5f7fd 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3211,6 +3211,7 @@ static void nop_complete_submit_request(struct i915_request *request)
>         dma_fence_set_error(&request->fence, -EIO);
>  
>         spin_lock_irqsave(&request->engine->timeline->lock, flags);
> +       request->engine->request_stats.runnable++;
>         __i915_request_submit(request);
>         intel_engine_init_global_seqno(request->engine, request->global_seqno);
>         spin_unlock_irqrestore(&request->engine->timeline->lock, flags);
> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index 585242831974..5c01291ad1cc 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -540,6 +540,9 @@ void __i915_request_submit(struct i915_request *request)
>         /* Transfer from per-context onto the global per-engine timeline */
>         move_to_timeline(request, engine->timeline);
>  
> +       GEM_BUG_ON(engine->request_stats.runnable == 0);
> +       engine->request_stats.runnable--;
> +
>         trace_i915_request_execute(request);
>  
>         wake_up_all(&request->execute);
> @@ -553,6 +556,8 @@ void i915_request_submit(astruct i915_request *request)
>         /* Will be called from irq-context when using foreign fences. */
>         spin_lock_irqsave(&engine->timeline->lock, flags);
>  
> +       engine->request_stats.runnable++;

Hmm, I was thinking this should be in submit_notify(), as you want to
count from when all fences are signaled.

But you are using the timeline lock as its guard?

The only downside is having to repeat the inc in each path. And with the
slight disparity for unsubmit. Not a blocker, just had to actually think
about what you were doing, so maybe discuss that upfront in the commit
msg.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-04-06 20:16 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 12:39 [PATCH v5 0/7] Queued/runnable/running engine stats Tvrtko Ursulin
2018-04-05 12:39 ` [PATCH 1/7] drm/i915/pmu: Fix enable count array size and bounds checking Tvrtko Ursulin
2018-04-05 12:39 ` [PATCH 2/7] drm/i915: Keep a count of requests waiting for a slot on GPU Tvrtko Ursulin
2018-04-06 20:16   ` Chris Wilson [this message]
2018-04-09 16:37   ` [PATCH v10 " Tvrtko Ursulin
2018-04-05 12:39 ` [PATCH 3/7] drm/i915: Keep a count of requests submitted from userspace Tvrtko Ursulin
2018-04-06 20:17   ` Chris Wilson
2018-04-09  9:11     ` Tvrtko Ursulin
2018-04-09  9:25       ` Chris Wilson
2018-04-09 10:17         ` Tvrtko Ursulin
2018-04-09 10:27           ` Chris Wilson
2018-04-09 10:29             ` Chris Wilson
2018-04-09 10:40             ` Tvrtko Ursulin
2018-04-09 10:51               ` Chris Wilson
2018-04-09 11:43                 ` Tvrtko Ursulin
2018-04-09 11:54                   ` Chris Wilson
2018-04-09 16:38   ` [PATCH v4 " Tvrtko Ursulin
2018-04-05 12:39 ` [PATCH 4/7] drm/i915/pmu: Add queued counter Tvrtko Ursulin
2018-04-06 20:19   ` Chris Wilson
2018-04-05 12:39 ` [PATCH 5/7] drm/i915/pmu: Add runnable counter Tvrtko Ursulin
2018-04-06 20:22   ` Chris Wilson
2018-04-05 12:39 ` [PATCH 6/7] drm/i915/pmu: Add running counter Tvrtko Ursulin
2018-04-06 20:24   ` Chris Wilson
2018-04-09  9:13     ` Tvrtko Ursulin
2018-04-05 12:39 ` [PATCH 7/7] drm/i915: Engine queues query Tvrtko Ursulin
2018-04-05 13:05   ` Lionel Landwerlin
2018-04-06 20:25     ` Chris Wilson
2018-04-09 16:38   ` [PATCH v3 " Tvrtko Ursulin
2018-04-05 13:49 ` ✓ Fi.CI.BAT: success for Queued/runnable/running engine stats (rev4) Patchwork
2018-04-05 16:08 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-04-09 17:12 ` ✗ Fi.CI.BAT: failure for Queued/runnable/running engine stats (rev7) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-06-06 12:48 [PATCH v6 0/7] Queued/runnable/running engine stats Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 2/7] drm/i915: Keep a count of requests waiting for a slot on GPU Tvrtko Ursulin
2018-03-19 18:16 [PATCH v4 0/7] Queued/runnable/running engine stats Tvrtko Ursulin
2018-03-19 18:16 ` [PATCH 2/7] drm/i915: Keep a count of requests waiting for a slot on GPU Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152304581164.23749.5574576484215087231@mail.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.