Skip to contentSkip to conversation

drm/i915/guc: Do not use wait_for_atomic in host2guc_action

PATCH In review Tvrtko Ursulin 3 participants 7 messages Jun 28, 2016 – Jun 29, 2016

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

PATCH 1/1 drm/i915/guc: Do not use wait_for_atomic in host2guc_action

From: Tvrtko Ursulin <[email protected]>

host2guc_action does not appear to be called from atomic context so a more polite wait_for macro should be used. Especially since the timeout is 10ms.

---
 drivers/gpu/drm/i915/i915_guc_submission.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
index 355b6475e74c..fcc7982f8141 100644
@@ -98,7 +98,7 @@ 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);
+	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
#1 lore raw

✗ Ro.CI.BAT: failure for drm/i915/guc: Do not use wait_for_atomic in host2guc_action

== Series Details ==

== Series Details ==

Series: drm/i915/guc: Do not use wait_for_atomic in host2guc_action
URL : https://patchwork.freedesktop.org/series/9233/
State : failure

== Summary ==

Series 9233v1 drm/i915/guc: Do not use wait_for_atomic in host2guc_action
http://patchwork.freedesktop.org/api/1.0/series/9233/revisions/1/mbox

Test kms_pipe_crc_basic:

        Subgroup nonblocking-crc-pipe-c:
                pass       -> SKIP       (fi-skl-i5-6260u)
        Subgroup suspend-read-crc-pipe-b:
                skip       -> DMESG-WARN (ro-bdw-i7-5557U)
                skip       -> DMESG-WARN (ro-bdw-i5-5250u)
        Subgroup suspend-read-crc-pipe-c:
                pass       -> INCOMPLETE (fi-hsw-i7-4770k)
fi-hsw-i7-4770k  total:203  pass:182  dwarn:0   dfail:0   fail:2   skip:18 
fi-skl-i5-6260u  total:229  pass:201  dwarn:0   dfail:0   fail:2   skip:26 
fi-skl-i7-6700k  total:229  pass:188  dwarn:0   dfail:0   fail:2   skip:39 
fi-snb-i7-2600   total:229  pass:174  dwarn:0   dfail:0   fail:2   skip:53 
ro-bdw-i5-5250u  total:229  pass:202  dwarn:4   dfail:1   fail:2   skip:20 
ro-bdw-i7-5557U  total:229  pass:202  dwarn:2   dfail:1   fail:2   skip:22 
ro-bdw-i7-5600u  total:229  pass:190  dwarn:0   dfail:1   fail:0   skip:38 
ro-bsw-n3050     total:229  pass:176  dwarn:0   dfail:1   fail:3   skip:49 
ro-byt-n2820     total:229  pass:178  dwarn:0   dfail:1   fail:5   skip:45 
ro-hsw-i3-4010u  total:229  pass:195  dwarn:0   dfail:1   fail:2   skip:31 
ro-hsw-i7-4770r  total:229  pass:195  dwarn:0   dfail:1   fail:2   skip:31 
ro-ilk-i7-620lm  total:229  pass:155  dwarn:0   dfail:1   fail:3   skip:70 
ro-ilk1-i5-650   total:224  pass:155  dwarn:0   dfail:1   fail:3   skip:65 
ro-ivb-i7-3770   total:229  pass:186  dwarn:0   dfail:1   fail:2   skip:40 
ro-ivb2-i7-3770  total:229  pass:190  dwarn:0   dfail:1   fail:2   skip:36 
ro-skl3-i5-6260u total:229  pass:206  dwarn:1   dfail:1   fail:2   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_1321/

3a50b42 drm-intel-nightly: 2016y-06m-28d-11h-06m-59s UTC integration manifest 937b35d drm/i915/guc: Do not use wait_for_atomic in host2guc_action

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

#2 lore raw
In reply to Tvrtko Ursulin
Quoted 5 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

host2guc_action does not appear to be called from atomic context so a more polite wait_for macro should be used. Especially since the timeout is 10ms.

Maybe. However we don't really want to sleep if the action takes only a few microseconds, which some of them do. Maybe we need an optimistic spin for a few uS to handle the quick commands followed by a sleeping wait in the cases where it takes long enough that we don't mind the extra wakeup latency?

.Dave.

Quoted 14 lines
---
  drivers/gpu/drm/i915/i915_guc_submission.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -0
index 355b6475e74c..fcc7982f8141 100644

drivers/gpu/drm/i915/i915_guc_submission.c static int host2guc_action(struct intel_guc *guc, u32 *data, u32 len) · line 104

Quoted 8 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
@@ -98,7 +98,7 @@ 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);
+	ret = wait_for(host2guc_action_response(dev_priv, &status), 10);
  	if (status != GUC2HOST_STATUS_SUCCESS) {
  		/*
  		 * Either the GuC explicitly returned an error (which

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

#3 lore raw
Quoted 7 lines · Dave Gordon
Quoted 5 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

host2guc_action does not appear to be called from atomic context so a more polite wait_for macro should be used. Especially since the timeout is 10ms.

Quoted 5 lines

Maybe. However we don't really want to sleep if the action takes only a few microseconds, which some of them do. Maybe we need an optimistic spin for a few uS to handle the quick commands followed by a sleeping wait in the cases where it takes long enough that we don't mind the extra wakeup latency?

I believe Mika is working on smart waits similar to what you describe. Adaptive back-off etc.

In the meantime how about calling _wait_for directly and setting the re-check period to something you think is more appropriate for the GuC?

Shouldn't be less than 10us since usleep_range recommends against it.

Regards,

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

#4 lore raw

RFC 1/1 drm/i915: hybrid wait-for macro

Part spin-wait, part sleep-wait.
Plus one example of where it might be used.

---
 drivers/gpu/drm/i915/i915_guc_submission.c |  2 +-
 drivers/gpu/drm/i915/intel_drv.h           | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
index 355b647..ff99910 100644
@@ -98,7 +98,7 @@ 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);
+	ret = wait_for_hybrid(host2guc_action_response(dev_priv, &status), 10, 10);
 	if (status != GUC2HOST_STATUS_SUCCESS) {
 		/*
 		 * Either the GuC explicitly returned an error (which
drivers/gpu/drm/i915/intel_drv.h +10 -0
index 3156d8d..096e07c 100644
@@ -103,6 +103,16 @@
 #define wait_for_atomic(COND, MS)	_wait_for_atomic((COND), (MS) * 1000)
 #define wait_for_atomic_us(COND, US)	_wait_for_atomic((COND), (US))
 
+/* Hybrid wait:
+ * 	first spin-wait for up to <US> microseconds,
+ * 	if <COND> still not true, sleep-wait for MS milliseconds
+ */
+#define	wait_for_hybrid(COND, US, MS)	({				\
+		int ret__ = wait_for_atomic_us(COND, US);		\
+		if (ret__) ret__ = wait_for(COND, MS);			\
+		ret__;							\
+	})
+
 #define KHz(x) (1000 * (x))
 #define MHz(x) KHz(1000 * (x))
 
Signature · 6 lines
1.9.1

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

Re: [RFC] drm/i915: hybrid wait-for macro

Quoted 32 lines · Dave Gordon

Part spin-wait, part sleep-wait.
Plus one example of where it might be used.

---
  drivers/gpu/drm/i915/i915_guc_submission.c |  2 +-
  drivers/gpu/drm/i915/intel_drv.h           | 10 ++++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_guc_submission.c +1 -1
index 355b647..ff99910 100644
@@ -98,7 +98,7 @@ 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);
+	ret = wait_for_hybrid(host2guc_action_response(dev_priv, &status), 10, 10);
  	if (status != GUC2HOST_STATUS_SUCCESS) {
  		/*
  		 * Either the GuC explicitly returned an error (which
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 3156d8d..096e07c 100644
@@ -103,6 +103,16 @@
  #define wait_for_atomic(COND, MS)	_wait_for_atomic((COND), (MS) * 1000)
  #define wait_for_atomic_us(COND, US)	_wait_for_atomic((COND), (US))
 
+/* Hybrid wait:
+ * 	first spin-wait for up to <US> microseconds,

drivers/gpu/drm/i915/intel_drv.h line 117

Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +8 -0
+ * 	if <COND> still not true, sleep-wait for MS milliseconds
+ */
+#define	wait_for_hybrid(COND, US, MS)	({				\
+		int ret__ = wait_for_atomic_us(COND, US);		\
+		if (ret__) ret__ = wait_for(COND, MS);			\
+		ret__;							\
+	})
+
  #define KHz(x) (1000 * (x))
  #define MHz(x) KHz(1000 * (x))

Wouldn't harm anything if you know typical GuC response time is under 10us and 10ms timeout is backed with some documentation.

Another idea could be a wait_for variant which takes those values, so typical and maximum response time, and then it could decide statically in the macro what to do.

Regards,

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

#6 lore raw

✗ Ro.CI.BAT: failure for drm/i915: hybrid wait-for macro

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: hybrid wait-for macro
URL : https://patchwork.freedesktop.org/series/9237/
State : failure

== Summary ==

Series 9237v1 drm/i915: hybrid wait-for macro
http://patchwork.freedesktop.org/api/1.0/series/9237/revisions/1/mbox

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-cmd:
                fail       -> PASS       (ro-byt-n2820)
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (ro-hsw-i3-4010u)
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (ro-bdw-i7-5557U)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c-frame-sequence:
                pass       -> SKIP       (fi-skl-i5-6260u)
        Subgroup suspend-read-crc-pipe-b:
                skip       -> DMESG-WARN (ro-bdw-i5-5250u)
        Subgroup suspend-read-crc-pipe-c:
                dmesg-warn -> SKIP       (ro-bdw-i5-5250u)
fi-skl-i5-6260u  total:229  pass:201  dwarn:0   dfail:0   fail:2   skip:26 
fi-skl-i7-6700k  total:229  pass:188  dwarn:0   dfail:0   fail:2   skip:39 
fi-snb-i7-2600   total:229  pass:174  dwarn:0   dfail:0   fail:2   skip:53 
ro-bdw-i5-5250u  total:229  pass:202  dwarn:3   dfail:1   fail:2   skip:21 
ro-bdw-i7-5557U  total:229  pass:201  dwarn:1   dfail:1   fail:3   skip:23 
ro-bdw-i7-5600u  total:229  pass:190  dwarn:0   dfail:1   fail:0   skip:38 
ro-byt-n2820     total:229  pass:179  dwarn:0   dfail:1   fail:4   skip:45 
ro-hsw-i3-4010u  total:229  pass:194  dwarn:1   dfail:1   fail:2   skip:31 
ro-hsw-i7-4770r  total:229  pass:195  dwarn:0   dfail:1   fail:2   skip:31 
ro-ilk-i7-620lm  total:229  pass:155  dwarn:0   dfail:1   fail:3   skip:70 
ro-ilk1-i5-650   total:224  pass:155  dwarn:0   dfail:1   fail:3   skip:65 
ro-ivb-i7-3770   total:229  pass:186  dwarn:0   dfail:1   fail:2   skip:40 
ro-ivb2-i7-3770  total:229  pass:190  dwarn:0   dfail:1   fail:2   skip:36 
ro-skl3-i5-6260u total:229  pass:206  dwarn:1   dfail:1   fail:2   skip:19 
ro-snb-i7-2620M  total:229  pass:179  dwarn:0   dfail:1   fail:1   skip:48 

fi-hsw-i7-4770k failed to connect after reboot
ro-bsw-n3050 failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1325/

3a50b42 drm-intel-nightly: 2016y-06m-28d-11h-06m-59s UTC integration manifest 8c5df49 drm/i915: hybrid wait-for macro

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