Skip to contentSkip to conversation

drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()

PATCH Applied Dave Gordon 4 participants 4 messages Jul 6, 2016

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

PATCH 1/1 drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()

Rather than using wait_for_atomic() when chacking for a response from the GuC, we can get the effect of a hybrid spin/sleep wait by breaking it into two stages. First, spin-wait for up to 10us to minimise latency for "quick" commands; then, if that times out, sleep-wait for up 10ms (the maximum allowed for a "slow" command).

Being able to do this depends on the recent patch
18f4b84 drm/i915: Use atomic waits for short non-atomic ones and is similar to the hybrid approach in
1758b90 drm/i915: Use a hybrid scheme for fast register waits (although we can't use that as-is, because that interface doesn't quite match what we need here).

Cc Tvrtko Ursulin <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +8 -2
index bfc8bf6..2112e02 100644
@@ -97,8 +97,14 @@ static int host2guc_action(struct intel_guc *guc, u32 *data, u32 len)
 
 	I915_WRITE(HOST2GUC_INTERRUPT, HOST2GUC_TRIGGER);
 
-	/* No HOST2GUC command should take longer than 10ms */
-	ret = wait_for_atomic(host2guc_action_response(dev_priv, &status), 10);
+	/*
+	 * Fast commands should complete in less than 10us, so sample quickly
+	 * up to that length of time, then switch to a slower sleep-wait loop.
+	 * No HOST2GUC command should ever take longer than 10ms.
+	 */
+	ret = wait_for_us(host2guc_action_response(dev_priv, &status), 10);
+	if (ret)
+		ret = wait_for(host2guc_action_response(dev_priv, &status), 10);
 	if (status != GUC2HOST_STATUS_SUCCESS) {
 		/*
 		 * Either the GuC explicitly returned an error (which
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dave Gordon

Rather than using wait_for_atomic() when chacking for a response from the GuC, we can get the effect of a hybrid spin/sleep wait by breaking it into two stages. First, spin-wait for up to 10us to minimise latency for "quick" commands; then, if that times out, sleep-wait for up 10ms (the maximum allowed for a "slow" command).

Quoted 6 lines

Being able to do this depends on the recent patch
18f4b84 drm/i915: Use atomic waits for short non-atomic ones and is similar to the hybrid approach in
1758b90 drm/i915: Use a hybrid scheme for fast register waits (although we can't use that as-is, because that interface doesn't quite match what we need here).

Returning the status from wait_for_register would help for one other callsite (gmbus iirc), not worth the conversion.

Quoted 3 lines
Cc Tvrtko Ursulin <[email protected]>
Cc Chris Wilson <[email protected]>

This entire sequence is under the FORCEWAKE_ALL (from inspection of intel_uncore, I think you only need FORCEWAKE_BLITTER), you could use I915_WRITE_FW / I915_READ_FW here - you lose both the spinlock and auto-arming on each read, but you also lose the mmiotracing. (Though realistically we should use the general mmiotracer and fix it if it doesn't work for us.)
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✓ Ro.CI.BAT: success for drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()

In reply to Dave Gordon
== Series Details ==

== Series Details ==

Series: drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()
URL : https://patchwork.freedesktop.org/series/9565/
State : success

== Summary ==

Series 9565v1 drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()
http://patchwork.freedesktop.org/api/1.0/series/9565/revisions/1/mbox

Test drv_module_reload_basic:

                skip       -> PASS       (ro-snb-i7-2620M)
fi-kbl-qkkr      total:235  pass:163  dwarn:29  dfail:0   fail:2   skip:41 
fi-skl-i5-6260u  total:235  pass:207  dwarn:0   dfail:0   fail:2   skip:26 
fi-snb-i7-2600   total:235  pass:179  dwarn:0   dfail:0   fail:2   skip:54 
ro-bdw-i5-5250u  total:229  pass:204  dwarn:1   dfail:1   fail:0   skip:23 
ro-bdw-i7-5557U  total:229  pass:204  dwarn:2   dfail:1   fail:0   skip:22 
ro-bdw-i7-5600u  total:229  pass:190  dwarn:0   dfail:1   fail:0   skip:38 
ro-bsw-n3050     total:229  pass:177  dwarn:0   dfail:1   fail:2   skip:49 
ro-byt-n2820     total:229  pass:180  dwarn:0   dfail:1   fail:3   skip:45 
ro-hsw-i3-4010u  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31 
ro-hsw-i7-4770r  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31 
ro-ilk-i7-620lm  total:229  pass:157  dwarn:0   dfail:1   fail:1   skip:70 
ro-ilk1-i5-650   total:224  pass:157  dwarn:0   dfail:1   fail:1   skip:65 
ro-ivb-i7-3770   total:229  pass:188  dwarn:0   dfail:1   fail:0   skip:40 
ro-skl3-i5-6260u total:229  pass:208  dwarn:1   dfail:1   fail:0   skip:19 
ro-snb-i7-2620M  total:229  pass:179  dwarn:0   dfail:1   fail:1   skip:48 

Results at /archive/results/CI_IGT_test/RO_Patchwork_1438/

39b147d drm-intel-nightly: 2016y-07m-06d-12h-15m-56s UTC integration manifest 803f1c2 drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()

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

#3 lore raw

Re: ✓ Ro.CI.BAT: success for drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()

Quoted 30 lines · Patchwork

== Series Details ==

Series: drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()
URL : https://patchwork.freedesktop.org/series/9565/
State : success

== Summary ==

Series 9565v1 drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()
http://patchwork.freedesktop.org/api/1.0/series/9565/revisions/1/mbox

Test drv_module_reload_basic:

                 skip       -> PASS       (ro-snb-i7-2620M)
fi-kbl-qkkr      total:235  pass:163  dwarn:29  dfail:0   fail:2   skip:41
fi-skl-i5-6260u  total:235  pass:207  dwarn:0   dfail:0   fail:2   skip:26
fi-snb-i7-2600   total:235  pass:179  dwarn:0   dfail:0   fail:2   skip:54
ro-bdw-i5-5250u  total:229  pass:204  dwarn:1   dfail:1   fail:0   skip:23
ro-bdw-i7-5557U  total:229  pass:204  dwarn:2   dfail:1   fail:0   skip:22
ro-bdw-i7-5600u  total:229  pass:190  dwarn:0   dfail:1   fail:0   skip:38
ro-bsw-n3050     total:229  pass:177  dwarn:0   dfail:1   fail:2   skip:49
ro-byt-n2820     total:229  pass:180  dwarn:0   dfail:1   fail:3   skip:45
ro-hsw-i3-4010u  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31
ro-hsw-i7-4770r  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31
ro-ilk-i7-620lm  total:229  pass:157  dwarn:0   dfail:1   fail:1   skip:70
ro-ilk1-i5-650   total:224  pass:157  dwarn:0   dfail:1   fail:1   skip:65
ro-ivb-i7-3770   total:229  pass:188  dwarn:0   dfail:1   fail:0   skip:40
ro-skl3-i5-6260u total:229  pass:208  dwarn:1   dfail:1   fail:0   skip:19
ro-snb-i7-2620M  total:229  pass:179  dwarn:0   dfail:1   fail:1   skip:48
Quoted 4 lines

Results at /archive/results/CI_IGT_test/RO_Patchwork_1438/

39b147d drm-intel-nightly: 2016y-07m-06d-12h-15m-56s UTC integration manifest 803f1c2 drm/i915: avoid wait_for_atomic() in non-atomic host2guc_action()

Merged to dinq, thanks for the patch and review.

Regards,

Tvrtko

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