All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Keep a count of requests waiting for a slot on GPU
Date: Wed, 22 Nov 2017 14:00:07 +0000	[thread overview]
Message-ID: <7bbd9048-f397-dad0-eb45-e2efe649a6c3@linux.intel.com> (raw)
In-Reply-To: <151135773793.9619.39604338455802492@mail.alporthouse.com>


On 22/11/2017 13:35, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2017-11-22 13:31:56)
>>
>> On 22/11/2017 12:59, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2017-11-22 12:46:21)
>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>
>>>> Keep a per-engine number of runnable (waiting for GPU time) requests.
>>>>
>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>> ---
>>>>    drivers/gpu/drm/i915/i915_gem_request.c | 5 +++++
>>>>    drivers/gpu/drm/i915/intel_engine_cs.c  | 5 +++--
>>>>    drivers/gpu/drm/i915/intel_lrc.c        | 1 +
>>>>    drivers/gpu/drm/i915/intel_ringbuffer.h | 8 ++++++++
>>>>    4 files changed, 17 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
>>>> index 7325469ce754..e3c74cafa7d4 100644
>>>> --- a/drivers/gpu/drm/i915/i915_gem_request.c
>>>> +++ b/drivers/gpu/drm/i915/i915_gem_request.c
>>>> @@ -480,6 +480,9 @@ void __i915_gem_request_submit(struct drm_i915_gem_request *request)
>>>>           engine->emit_breadcrumb(request,
>>>>                                   request->ring->vaddr + request->postfix);
>>>>    
>>>> +       GEM_BUG_ON(engine->queued == 0);
>>>> +       engine->queued--;
>>>
>>> Ok, so under engine->timeline->lock.
>>>
>>>> +
>>>>           spin_lock(&request->timeline->lock);
>>>>           list_move_tail(&request->link, &timeline->requests);
>>>>           spin_unlock(&request->timeline->lock);
>>>> @@ -525,6 +528,8 @@ void __i915_gem_request_unsubmit(struct drm_i915_gem_request *request)
>>>>           timeline = request->timeline;
>>>>           GEM_BUG_ON(timeline == engine->timeline);
>>>>    
>>>> +       engine->queued++;
>>>> +
>>>>           spin_lock(&timeline->lock);
>>>>           list_move(&request->link, &timeline->requests);
>>>>           spin_unlock(&timeline->lock);
>>>> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
>>>> index d53680c08cb0..cc9d60130ddd 100644
>>>> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
>>>> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
>>>> @@ -1675,12 +1675,13 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m)
>>>>           u64 addr;
>>>>    
>>>>           drm_printf(m, "%s\n", engine->name);
>>>> -       drm_printf(m, "    current seqno %x, last %x, hangcheck %x [%d ms], inflight %d\n",
>>>> +       drm_printf(m, "    current seqno %x, last %x, hangcheck %x [%d ms], inflight %d, queued %d\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);
>>>> +                  engine->timeline->inflight_seqnos,
>>>> +                  INTEL_GEN(dev_priv) >= 8 ? engine->queued : -1);
>>>
>>> Not gen8 specific, just add engine->queued++ to i9xx_submit_request().
>>
>> But where to put the decrement, and more importantly, how not make it
>> lag the reality from the retire worker? :(
> 
> The decrement is in __i915_gem_request_submit as before.
> So basically it should remain 0, since we aren't keeping a queue of work
> for the HW and just submitting into the ringbuffer as soon as we are
> ready. (This may not always remain so...) Hence why the (last_seqno -
> current_seqno) was so important.

I keep getting lost in these callbacks...

Right, so if we put the increment in i9xx_submit_request, it calls 
i915_gem_request_submit which immediately decrements it, and as you say 
it remains at zero then.

So you just want to look at the last_seqno - current_seqno on <gen8. 
Which will be the totality of submitted stuff so sounds OK. Makes the 
metric usable on those platforms as well. Sorry for the confusion.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2017-11-22 14:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 12:46 [PATCH 1/2] drm/i915: Keep a count of requests waiting for a slot on GPU Tvrtko Ursulin
2017-11-22 12:46 ` [PATCH 2/2] drm/i915/pmu: Add queued counter Tvrtko Ursulin
2017-11-22 13:01   ` Chris Wilson
2017-11-22 21:15   ` Rogozhkin, Dmitry V
2017-11-22 21:38     ` Chris Wilson
2017-11-24  8:14       ` Tvrtko Ursulin
2017-11-22 12:59 ` [PATCH 1/2] drm/i915: Keep a count of requests waiting for a slot on GPU Chris Wilson
2017-11-22 13:31   ` Tvrtko Ursulin
2017-11-22 13:35     ` Chris Wilson
2017-11-22 14:00       ` Tvrtko Ursulin [this message]

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=7bbd9048-f397-dad0-eb45-e2efe649a6c3@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --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.