Skip to contentSkip to conversation

drm/i915: Reduce i915_request_alloc retirement to local context

CI Chris Wilson 2 participants 4 messages Jan 9, 2019 – Jan 10, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

In the continual quest to reduce the amount of global work required when submitting requests, replace i915_retire_requests() after allocation failure to retiring just our ring.

v2: Don't forget the list iteration included an early break, so we would never throttle on the last request in the ring/timeline.
v3: Use the common ring_retire_requests()

References: 11abf0c5a021 ("drm/i915: Limit the backpressure for i915_request allocation")

---
 drivers/gpu/drm/i915/i915_request.c | 55 +++++++++++++++++------------
 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_request.c +33 -22
index 1e158eb8cb97..d1355154886a 100644
@@ -477,6 +477,38 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 	return NOTIFY_DONE;
 }
 
+static void ring_retire_requests(struct intel_ring *ring)
+{
+	struct i915_request *rq, *rn;
+
+	list_for_each_entry_safe(rq, rn, &ring->request_list, ring_link) {
+		if (!i915_request_completed(rq))
+			break;
+
+		i915_request_retire(rq);
+	}
+}
+
+static noinline struct i915_request *
+i915_request_alloc_slow(struct intel_context *ce)
+{
+	struct intel_ring *ring = ce->ring;
+	struct i915_request *rq;
+
+	if (list_empty(&ring->request_list))
+		goto out;
+
+	/* Ratelimit ourselves to prevent oom from malicious clients */
+	rq = list_last_entry(&ring->request_list, typeof(*rq), ring_link);
+	cond_synchronize_rcu(rq->rcustate);
+
+	/* Retire our old requests in the hope that we free some */
+	ring_retire_requests(ring);
+
+out:
+	return kmem_cache_alloc(ce->gem_context->i915->requests, GFP_KERNEL);
+}
+
 /**
  * i915_request_alloc - allocate a request structure
  *
@@ -559,15 +591,7 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
 	rq = kmem_cache_alloc(i915->requests,
 			      GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
 	if (unlikely(!rq)) {
-		i915_retire_requests(i915);
-
-		/* Ratelimit ourselves to prevent oom from malicious clients */
-		rq = i915_gem_active_raw(&ce->ring->timeline->last_request,
-					 &i915->drm.struct_mutex);
-		if (rq)
-			cond_synchronize_rcu(rq->rcustate);
-
-		rq = kmem_cache_alloc(i915->requests, GFP_KERNEL);
+		rq = i915_request_alloc_slow(ce);
 		if (!rq) {
 			ret = -ENOMEM;
 			goto err_unreserve;
@@ -1218,19 +1242,6 @@ long i915_request_wait(struct i915_request *rq,
 	return timeout;
 }
 
-static void ring_retire_requests(struct intel_ring *ring)
-{
-	struct i915_request *request, *next;
-
-	list_for_each_entry_safe(request, next,
-				 &ring->request_list, ring_link) {
-		if (!i915_request_completed(request))
-			break;
-
-		i915_request_retire(request);
-	}
-}
-
 void i915_retire_requests(struct drm_i915_private *i915)
 {
 	struct intel_ring *ring, *tmp;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.CHECKPATCH: warning for drm/i915: Reduce i915_request_alloc retirement to local context (rev3)

== Series Details ==

== Series Details ==

Series: drm/i915: Reduce i915_request_alloc retirement to local context (rev3)
URL : https://patchwork.freedesktop.org/series/54820/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
4f7a98cdc73c drm/i915: Reduce i915_request_alloc retirement to local context
-:15: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#15: 
References: 11abf0c5a021 ("drm/i915: Limit the backpressure for i915_request allocation")

-:15: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 11abf0c5a021 ("drm/i915: Limit the backpressure for i915_request allocation")' #15:
References: 11abf0c5a021 ("drm/i915: Limit the backpressure for i915_request allocation")

total: 1 errors, 1 warnings, 0 checks, 73 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.BAT: success for drm/i915: Reduce i915_request_alloc retirement to local context (rev3)

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Reduce i915_request_alloc retirement to local context (rev3)
URL : https://patchwork.freedesktop.org/series/54820/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5386 -> Patchwork_11270
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with Patchwork_11270 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_11270, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/54820/revisions/3/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_11270:

### IGT changes ###

#### Warnings ####

* igt@pm_rpm@basic-pci-d3-state:
- fi-bsw-kefka: SKIP -> PASS

Known issues
------------

Here are the changes found in Patchwork_11270 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]

* igt@i915_selftest@live_hangcheck:
- fi-skl-iommu: PASS -> INCOMPLETE [fdo#108602] / [fdo#108744]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362]

#### Possible fixes ####

* igt@pm_rpm@basic-rte:
- fi-bsw-kefka: FAIL [fdo#108800] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
[fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
[fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800
[fdo#109241]: https://bugs.freedesktop.org/show_bug.cgi?id=109241

Participating hosts (48 -> 43)
------------------------------

Additional (3): fi-byt-j1900 fi-hsw-peppy fi-apl-guc
Missing (8): fi-kbl-soraka fi-hsw-4770r fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-icl-y fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_5386 -> Patchwork_11270

CI_DRM_5386: c7b430c73b52681e3b7206a53c0d5d6f8000ebe2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4757: 738f43a54d626f08e250c926a5aeec53458fbd3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11270: 4f7a98cdc73cfd43d7bf1284098bdf096e9be7d4 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

4f7a98cdc73c drm/i915: Reduce i915_request_alloc retirement to local context

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11270/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.IGT: success for drm/i915: Reduce i915_request_alloc retirement to local context (rev3)

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Reduce i915_request_alloc retirement to local context (rev3)
URL : https://patchwork.freedesktop.org/series/54820/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5386_full -> Patchwork_11270_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_11270_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_atomic_transition@1x-modeset-transitions-fencing:
- shard-skl: PASS -> FAIL [fdo#107815] / [fdo#108470]

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#107956]

* igt@kms_color@pipe-b-ctm-negative:
- shard-skl: PASS -> FAIL [fdo#107361]

* igt@kms_cursor_crc@cursor-64x64-random:
- shard-glk: PASS -> FAIL [fdo#103232]

* igt@kms_fbcon_fbt@psr:
- shard-skl: NOTRUN -> FAIL [fdo#107882]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
- shard-apl: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-wc:
- shard-glk: PASS -> FAIL [fdo#103167]

* igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
- shard-skl: PASS -> FAIL [fdo#103191] / [fdo#107362]

* igt@kms_plane@pixel-format-pipe-b-planes-source-clamping:
- shard-apl: PASS -> FAIL [fdo#108948]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-apl: PASS -> FAIL [fdo#108145]

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: PASS -> FAIL [fdo#107815]

* igt@kms_plane_multiple@atomic-pipe-b-tiling-none:
- shard-glk: PASS -> FAIL [fdo#103166] +4

* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: PASS -> FAIL [fdo#103166] +6

* igt@kms_rotation_crc@sprite-rotation-90-pos-100-0:
- shard-glk: PASS -> INCOMPLETE [fdo#103359] / [k.org#198133]

* igt@pm_backlight@fade_with_suspend:
- shard-skl: NOTRUN -> FAIL [fdo#107847]

#### Possible fixes ####

* igt@kms_busy@extended-modeset-hang-newfb-render-c:
- shard-skl: DMESG-WARN [fdo#107956] -> PASS

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-apl: FAIL [fdo#106510] / [fdo#108145] -> PASS

* igt@kms_color@pipe-a-ctm-0-5:
- shard-skl: FAIL [fdo#108682] -> PASS

* igt@kms_color@pipe-a-ctm-max:
- shard-skl: FAIL [fdo#108147] -> PASS

* igt@kms_color@pipe-a-legacy-gamma:
- shard-apl: FAIL [fdo#104782] / [fdo#108145] -> PASS

* igt@kms_color@pipe-c-legacy-gamma:
- shard-apl: FAIL [fdo#104782] -> PASS

* igt@kms_cursor_crc@cursor-256x256-suspend:
- shard-glk: FAIL [fdo#103232] -> PASS +1

* igt@kms_cursor_crc@cursor-64x21-random:
- shard-apl: FAIL [fdo#103232] -> PASS +1

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS

* igt@kms_draw_crc@draw-method-rgb565-mmap-wc-untiled:
- shard-skl: FAIL [fdo#103184] -> PASS

* igt@kms_draw_crc@draw-method-xrgb8888-pwrite-ytiled:
- shard-skl: FAIL [fdo#108222] -> PASS

* igt@kms_flip@busy-flip-interruptible:
- shard-skl: FAIL [fdo#103257] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-apl: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-glk: FAIL [fdo#103167] -> PASS +2

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-shrfb-pgflip-blt:
- shard-skl: FAIL [fdo#105682] -> PASS

* igt@kms_frontbuffer_tracking@fbcpsr-farfromfence:
- shard-skl: FAIL [fdo#103167] -> PASS +4

* igt@kms_plane@pixel-format-pipe-b-planes:
- shard-glk: FAIL [fdo#103166] -> PASS

* igt@kms_plane@plane-position-covered-pipe-b-planes:
- shard-apl: FAIL [fdo#103166] -> PASS

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: FAIL [fdo#107815] / [fdo#108145] -> PASS

* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-kbl: DMESG-FAIL [fdo#108950] -> PASS

* igt@pm_rpm@debugfs-read:
- shard-skl: INCOMPLETE [fdo#107807] -> PASS

#### Warnings ####

* igt@gem_cpu_reloc@full:
- shard-skl: INCOMPLETE [fdo#108248] -> TIMEOUT [fdo#108248]

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103257]: https://bugs.freedesktop.org/show_bug.cgi?id=103257
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#106510]: https://bugs.freedesktop.org/show_bug.cgi?id=106510
[fdo#107361]: https://bugs.freedesktop.org/show_bug.cgi?id=107361
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107847]: https://bugs.freedesktop.org/show_bug.cgi?id=107847
[fdo#107882]: https://bugs.freedesktop.org/show_bug.cgi?id=107882
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
[fdo#108222]: https://bugs.freedesktop.org/show_bug.cgi?id=108222
[fdo#108248]: https://bugs.freedesktop.org/show_bug.cgi?id=108248
[fdo#108470]: https://bugs.freedesktop.org/show_bug.cgi?id=108470
[fdo#108682]: https://bugs.freedesktop.org/show_bug.cgi?id=108682
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (7 -> 6)
------------------------------

Missing (1): shard-iclb

Build changes
-------------

* Linux: CI_DRM_5386 -> Patchwork_11270

CI_DRM_5386: c7b430c73b52681e3b7206a53c0d5d6f8000ebe2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4757: 738f43a54d626f08e250c926a5aeec53458fbd3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11270: 4f7a98cdc73cfd43d7bf1284098bdf096e9be7d4 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11270/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx