drm/i915/execlists: Don't merely skip submission if maybe timeslicing
Subsystems (2)
PATCH 1/2 drm/i915/execlists: Don't merely skip submission if maybe timeslicing
Normally, we try and skip submission if ELSP[1] is filled. However, we may desire to enable timeslicing due to the queue priority, even if ELSP[1] itself does not require timeslicing. That is the queue is equal priority to ELSP[0] and higher priority then ELSP[1]. Previously, we would wait until the context switch to preempt the current ELSP[1], but with timeslicing, we want to preempt ELSP[0] and replace it with the queue.
In writing the test case, it become quickly apparent that we were also suppressing the tasklet during promotion and so failing to notice when the queue started requiring timeslicing.
--- drivers/gpu/drm/i915/gt/intel_lrc.c | 22 +++- drivers/gpu/drm/i915/gt/selftest_lrc.c | 164 ++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_scheduler.c | 17 ++- drivers/gpu/drm/i915/i915_scheduler.h | 18 --- 4 files changed, 192 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +18 -4
@@ -352,10 +352,15 @@ static inline bool need_preempt(const struct intel_engine_cs *engine,* However, the priority hint is a mere hint that we may need to * preempt. If that hint is stale or we may be trying to preempt * ourselves, ignore the request. +* +* More naturally we would write +* prio >= max(0, last); +* except that we wish to prevent triggering preemption at the same +* priority level: the task that is running should remain running +* to preserve FIFO ordering of dependencies. */ - last_prio =effective_prio (rq); -if (!i915_scheduler_need_preempt (engine->execlists.queue_priority_hint, - last_prio)) + last_prio =max (effective_prio (rq),I915_PRIORITY_NORMAL -1 ); +if (engine->execlists.queue_priority_hint <= last_prio)return false;/*
@@ -1509,8 +1514,17 @@ static void execlists_dequeue(struct intel_engine_cs *engine)* submission. */ if (!list_is_last (&last->sched.link, - &engine->active.requests)) + &engine->active.requests)) { +/* +* Even if ELSP[1] is occupied and not worthy +* of timeslices, our queue might be. +*/ +if (!execlists->timer.expires && +need_timeslice (engine, last)) +mod_timer (&execlists->timer, + jiffies +1 );return ; + }/* * WaIdleLiteRestore:bdw,skl
drivers/gpu/drm/i915/gt/selftest_lrc.c +159 -5
214 lines not on this page · raw message
drivers/gpu/drm/i915/i915_scheduler.c +15 -2
@@ -177,9 +177,22 @@ static inline int rq_prio(const struct i915_request *rq)return rq->sched.attr.priority | __NO_PREEMPTION; } +static inline bool need_preempt (int prio,int active) +{ +/* +* Allow preemption of low -> normal -> high, but we do +* not allow low priority tasks to preempt other low priority +* tasks under the impression that latency for low priority +* tasks does not matter (as much as background throughput), +* so kiss. +*/ +return prio >=max (I915_PRIORITY_NORMAL , active); +} +static void kick_submission (struct intel_engine_cs *engine,int prio) { -const struct i915_request *inflight = *engine->execlists.active; +const struct i915_request *inflight = +execlists_active (&engine->execlists);/* * If we are already the currently executing context, don't
@@ -188,7 +201,7 @@ static void kick_submission(struct intel_engine_cs *engine, int prio)* tasklet, i.e. we have not change the priority queue * sufficiently to oust the running context. */ -if (!inflight || !i915_scheduler_need_preempt (prio,rq_prio (inflight))) +if (!inflight || !need_preempt (prio,rq_prio (inflight)))return ;tasklet_hi_schedule (&engine->execlists.tasklet);
drivers/gpu/drm/i915/i915_scheduler.h +0 -18
@@ -52,22 +52,4 @@ static inline void i915_priolist_free(struct i915_priolist *p) __i915_priolist_free(p); } -static inline bool i915_scheduler_need_preempt (int prio,int active) -{ -/* -* Allow preemption of low -> normal -> high, but we do -* not allow low priority tasks to preempt other low priority -* tasks under the impression that latency for low priority -* tasks does not matter (as much as background throughput), -* so kiss. -* -* More naturally we would write -* prio >= max(0, last); -* except that we wish to prevent triggering preemption at the same -* priority level: the task that is running should remain running -* to preserve FIFO ordering of dependencies. -*/ -return prio >max (I915_PRIORITY_NORMAL -1 , active); -} -#endif /* _I915_SCHEDULER_H_ */
Signature · 6 lines
2.23.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Don't disable interrupts independently of the lock
From: Sebastian Andrzej Siewior <[email protected]>
The locks (active.lock and rq->lock) need to be taken with disabled interrupts. This is done in i915_request_retire() by disabling the interrupts independently of the locks itself.
While local_irq_disable()+spin_lock() equals spin_lock_irq() on vanilla it does not on PREEMPT_RT.
Chris Wilson confirmed that local_irq_disable() was just introduced as an optimisation to avoid enabling/disabling interrupts during lock/unlock combo.
Enable/disable interrupts as part of the locking instruction.
--- drivers/gpu/drm/i915/i915_request.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_request.c +4 -8
@@ -206,14 +206,14 @@ static void remove_from_engine(struct i915_request *rq)* check that the rq still belongs to the newly locked engine. */ locked =READ_ONCE (rq->engine); -spin_lock (&locked->active.lock); +spin_lock_irq (&locked->active.lock);while (unlikely (locked != (engine =READ_ONCE (rq->engine)))) {spin_unlock (&locked->active.lock);spin_lock (&engine->active.lock); locked = engine; }list_del (&rq->sched.link); -spin_unlock (&locked->active.lock); +spin_unlock_irq (&locked->active.lock); }bool i915_request_retire (struct i915_request *rq)
@@ -242,8 +242,6 @@ bool i915_request_retire(struct i915_request *rq) &i915_request_timeline(rq)->requests)); rq->ring->head = rq->postfix; -local_irq_disable (); -/* * We only loosely track inflight requests across preemption, * and so we may find ourselves attempting to retire a _completed_
@@ -252,7 +250,7 @@ bool i915_request_retire(struct i915_request *rq)*/ remove_from_engine (rq); -spin_lock (&rq->lock); +spin_lock_irq (&rq->lock);i915_request_mark_complete (rq);if (!i915_request_signaled (rq))dma_fence_signal_locked (&rq->fence);
@@ -267,9 +265,7 @@ bool i915_request_retire(struct i915_request *rq)__notify_execute_cb (rq); }GEM_BUG_ON (!list_empty (&rq->execute_cb)); -spin_unlock (&rq->lock); - -local_irq_enable (); +spin_unlock_irq (&rq->lock);remove_from_client (rq);list_del (&rq->link);
Signature · 6 lines
2.23.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/2] drm/i915/execlists: Don't merely skip submission if maybe timeslicing
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [CI,1/2] drm/i915/execlists: Don't merely skip submission if maybe timeslicing
URL : https://patchwork.freedesktop.org/series/68160/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 0da8e6764433 drm/i915/execlists: Don't merely skip submission if maybe timeslicing -:269: CHECK:LINE_SPACING: Please don't use multiple blank lines #269: FILE: drivers/gpu/drm/i915/gt/selftest_lrc.c:628: + +
total: 0 errors, 0 warnings, 1 checks, 303 lines checked e5053550c86d drm/i915: Don't disable interrupts independently of the lock
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [CI,1/2] drm/i915/execlists: Don't merely skip submission if maybe timeslicing
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [CI,1/2] drm/i915/execlists: Don't merely skip submission if maybe timeslicing
URL : https://patchwork.freedesktop.org/series/68160/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7122 -> Patchwork_14859
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_14859 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_14859, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_14859:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live_execlists:
- fi-skl-iommu: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-skl-iommu/igt@i915_selftest@live_execlists.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-skl-iommu/igt@i915_selftest@live_execlists.html
- fi-cml-u: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-cml-u/igt@i915_selftest@live_execlists.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-cml-u/igt@i915_selftest@live_execlists.html
- fi-kbl-guc: [PASS][5] -> [DMESG-FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-kbl-guc/igt@i915_selftest@live_execlists.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-kbl-guc/igt@i915_selftest@live_execlists.html
- fi-skl-lmem: [PASS][7] -> [DMESG-FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-skl-lmem/igt@i915_selftest@live_execlists.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-skl-lmem/igt@i915_selftest@live_execlists.html
Known issues
------------
Here are the changes found in Patchwork_14859 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_flink_basic@bad-open:
- fi-icl-u3: [PASS][9] -> [DMESG-WARN][10] ([fdo#107724])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-icl-u3/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-icl-u3/igt@[email protected]
#### Possible fixes ####
* igt@gem_ctx_switch@rcs0:
- {fi-icl-guc}: [INCOMPLETE][11] ([fdo#107713]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-icl-guc/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-icl-guc/igt@[email protected]
* igt@gem_exec_suspend@basic-s4-devices:
- fi-icl-u3: [DMESG-WARN][13] ([fdo#107724]) -> [PASS][14] +2 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-icl-u3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-icl-u3/igt@[email protected]
* igt@i915_selftest@live_execlists:
- fi-icl-u3: [DMESG-FAIL][15] -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-icl-u3/igt@i915_selftest@live_execlists.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-icl-u3/igt@i915_selftest@live_execlists.html
- fi-cfl-8109u: [DMESG-FAIL][17] -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7122/fi-cfl-8109u/igt@i915_selftest@live_execlists.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/fi-cfl-8109u/igt@i915_selftest@live_execlists.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#111747]: https://bugs.freedesktop.org/show_bug.cgi?id=111747
Participating hosts (53 -> 45)
------------------------------
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7122 -> Patchwork_14859
CI-20190529: 20190529
CI_DRM_7122: c2f6bdc09f8f046cd38e3c39c92e14e6033dbd44 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5232: bb5735423eaf6fdbf6b2f94ef0b8520e74eab993 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14859: e5053550c86d0f63067b7f1df5f0f2c589ca6455 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
e5053550c86d drm/i915: Don't disable interrupts independently of the lock 0da8e6764433 drm/i915/execlists: Don't merely skip submission if maybe timeslicing
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14859/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx