From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/i915/execlists: Minimalistic timeslicing
Date: Thu, 20 Jun 2019 17:13:45 +0300 [thread overview]
Message-ID: <87sgs45opy.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <156103905257.664.16152371364660528902@skylake-alporthouse-com>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> Quoting Mika Kuoppala (2019-06-20 14:51:24)
>> > +static void
>> > +defer_request(struct i915_request * const rq, struct list_head * const pl)
>> > +{
>> > + struct i915_dependency *p;
>> > +
>> > + /*
>> > + * We want to move the interrupted request to the back of
>> > + * the round-robin list (i.e. its priority level), but
>> > + * in doing so, we must then move all requests that were in
>> > + * flight and were waiting for the interrupted request to
>> > + * be run after it again.
>> > + */
>> > + list_move_tail(&rq->sched.link, pl);
>> > +
>> > + list_for_each_entry(p, &rq->sched.waiters_list, wait_link) {
>> > + struct i915_request *w =
>> > + container_of(p->waiter, typeof(*w), sched);
>> > +
>> > + /* Leave semaphores spinning on the other engines */
>> > + if (w->engine != rq->engine)
>> > + continue;
>> > +
>> > + /* No waiter should start before the active request completed */
>> > + GEM_BUG_ON(i915_request_started(w));
>> > +
>> > + GEM_BUG_ON(rq_prio(w) > rq_prio(rq));
>> > + if (rq_prio(w) < rq_prio(rq))
>> > + continue;
>> > +
>> > + if (list_empty(&w->sched.link))
>> > + continue; /* Not yet submitted; unready */
>> > +
>> > + /*
>> > + * This should be very shallow as it is limited by the
>> > + * number of requests that can fit in a ring (<64) and
>>
>> s/and/or ?
>
> I think "and" works better as each context has their own ring, so it's a
> multiplicative effect.
>
I jumped. But got clarity on irc that this are the contexts in flight.
>> > + * the number of contexts that can be in flight on this
>> > + * engine.
>> > + */
>> > + defer_request(w, pl);
>>
>> So the stack frame will be 64*(3*8 + preample/return) at worst case?
>> can be over 2k
>
> Ok, that makes it sound scary -- but we are well within the 8k irq
> limit. (Even interrupts now have 2 pages iirc, but even at 4k we are
> well within bounds.)
>
Should be safe.
>> > @@ -906,6 +982,27 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>> > */
>> > last->hw_context->lrc_desc |= CTX_DESC_FORCE_RESTORE;
>> > last = NULL;
>> > + } else if (need_timeslice(engine, last) &&
>> > + !timer_pending(&engine->execlists.timer)) {
>> > + GEM_TRACE("%s: expired last=%llx:%lld, prio=%d, hint=%d\n",
>> > + engine->name,
>> > + last->fence.context,
>> > + last->fence.seqno,
>> > + last->sched.attr.priority,
>> > + execlists->queue_priority_hint);
>> > +
>> > + ring_pause(engine) = 1;
>> > + defer_active(engine);
>> > +
>> > + /*
>> > + * Unlike for preemption, if we rewind and continue
>> > + * executing the same context as previously active,
>> > + * the order of execution will remain the same and
>> > + * the tail will only advance. We do not need to
>> > + * force a full context restore, as a lite-restore
>> > + * is sufficient to resample the monotonic TAIL.
>> > + */
>>
>> I would have asked about the force preemption without this fine comment.
>>
>> But this is a similar as the other kind of preemption. So what happens
>> when the contexts are not the same?
>
> It's just a normal preemption event. The old ring regs are saved and we
> don't try and scribble over them. Any future use of the old context will
> have the same RING_TAIL as before or later (new request) so we will
> never try to program a backwards step.
Ok,
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> -Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-06-20 14:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 7:05 [PATCH 1/3] drm/i915/execlists: Preempt-to-busy Chris Wilson
2019-06-20 7:05 ` [PATCH 2/3] drm/i915/execlists: Minimalistic timeslicing Chris Wilson
2019-06-20 13:51 ` Mika Kuoppala
2019-06-20 13:57 ` Chris Wilson
2019-06-20 14:13 ` Mika Kuoppala [this message]
2019-06-20 7:05 ` [PATCH 3/3] drm/i915/execlists: Force preemption Chris Wilson
2019-06-20 14:00 ` Mika Kuoppala
2019-06-20 14:08 ` Chris Wilson
2019-06-20 14:19 ` Mika Kuoppala
2019-06-20 7:46 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915/execlists: Preempt-to-busy Patchwork
2019-06-20 7:48 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-20 8:09 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-06-20 8:13 ` Chris Wilson
2019-06-20 8:15 ` Chris Wilson
2019-06-20 8:24 ` [PATCH] " Chris Wilson
2019-06-20 12:41 ` Mika Kuoppala
2019-06-20 13:01 ` Chris Wilson
2019-06-20 13:23 ` Mika Kuoppala
2019-06-20 9:23 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with drm/i915/execlists: Preempt-to-busy (rev2) Patchwork
2019-06-20 9:25 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-20 12:52 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-20 13:16 ` Patchwork
2019-06-20 15:38 ` ✗ Fi.CI.IGT: failure " Patchwork
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=87sgs45opy.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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.