Skip to contentSkip to conversation

drm/i915/execlists: WaDisableCtxRestoreArbitration is only needed in gen8

PATCH In review Michel Thierry 4 participants 8 messages Oct 5, 2017 – Oct 6, 2017

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

PATCH 1/1 drm/i915/execlists: WaDisableCtxRestoreArbitration is only needed in gen8

WaDisableCtxRestoreArbitration was only applied for bdw and chv, but this changed after the code got moved to gen8_emit_bb_start (and, at least in my tree, there is no gen9_emit_bb_start).

Fixes 3ad7b52d962e ("drm/i915/execlists: Move bdw GPGPU w/a to emit_bb")
Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +4 -1
index c5b76082d695..d2b7eac0777c 100644
@@ -1619,7 +1619,10 @@ static int gen8_emit_bb_start(struct drm_i915_gem_request *req,
 		return PTR_ERR(cs);
 
 	/* WaDisableCtxRestoreArbitration:bdw,chv */
-	*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
+	if (IS_GEN8(req->i915))
+		*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
+	else
+		*cs++ = MI_NOOP;
 
 	/* FIXME(BDW): Address space and security selectors. */
 	*cs++ = MI_BATCH_BUFFER_START_GEN8 |
Signature · 6 lines
2.14.1

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

Quoting Michel Thierry (2017-10-05 19:19:27)

Quoted 3 lines

WaDisableCtxRestoreArbitration was only applied for bdw and chv, but this changed after the code got moved to gen8_emit_bb_start (and, at least in my tree, there is no gen9_emit_bb_start).

But I need to make sure we enable arbitration at some point. :) It may not need the w/a name, but I was making very sure we didn't start a BB without ARB, or context-switch into the middle of a batch without ARB. That was my thinking, that there was no harm in overkill if we set it more often than strictly necessary.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 10 lines · Chris Wilson

Quoting Michel Thierry (2017-10-05 19:19:27)

Quoted 3 lines

WaDisableCtxRestoreArbitration was only applied for bdw and chv, but this changed after the code got moved to gen8_emit_bb_start (and, at least in my tree, there is no gen9_emit_bb_start).

But I need to make sure we enable arbitration at some point. :) It may not need the w/a name, but I was making very sure we didn't start a BB without ARB, or context-switch into the middle of a batch without ARB. That was my thinking, that there was no harm in overkill if we set it more often than strictly necessary.

Ok, thanks for the detailed explanation and yes, probably no harm in setting MI_ARB_ON.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#3 lore raw
Quoted 6 lines · Michel Thierry
Quoted 5 lines · Chris Wilson

Quoting Michel Thierry (2017-10-05 19:19:27)

Quoted 3 lines

WaDisableCtxRestoreArbitration was only applied for bdw and chv, but this changed after the code got moved to gen8_emit_bb_start (and, at least in my tree, there is no gen9_emit_bb_start).

Quoted 8 lines
Quoted 5 lines

But I need to make sure we enable arbitration at some point. :) It may not need the w/a name, but I was making very sure we didn't start a BB without ARB, or context-switch into the middle of a batch without ARB. That was my thinking, that there was no harm in overkill if we set it more often than strictly necessary.

Ok, thanks for the detailed explanation and yes, probably no harm in setting MI_ARB_ON.

Please add a comment if this is the case. W/As implementing required logic for platforms not covered by the W/A is confusing when they are being reviewed or double-checked.

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 1/1 drm/i915/execlists: Add a comment for the extra MI_ARB_ENABLE

In reply to Michel Thierry

Michel Thierry noticed that we were applying WaDisableCtxRestoreArbitration even to gen9, which does not require the w/a. The rationale is that we need to enable MI arbitration for execlists to work, and to be safe we do that before every batch (in addition to every context switch into the batch). Since this is not clear from the single line comment suggesting the MI_ARB_ENABLE is solely for the w/a, add a little more detail.

Cc Michel Thierry <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Michał Winiarski <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +17 -1
index 476881f63505..fa66e4f58642 100644
@@ -1608,7 +1608,23 @@ static int gen8_emit_bb_start(struct drm_i915_gem_request *req,
 	if (IS_ERR(cs))
 		return PTR_ERR(cs);
 
-	/* WaDisableCtxRestoreArbitration:bdw,chv */
+	/*
+	 * WaDisableCtxRestoreArbitration:bdw,chv
+	 *
+	 * We don't need to perform MI_ARB_ENABLE as often as we do (in
+	 * particular all the gen that do not need the w/a at all!), if we
+	 * took care to make sure that on every switch into this context
+	 * (both ordinary and for preemption) that arbitrartion was enabled
+	 * we would be fine. However, there doesn't seem to be a downside to
+	 * being paranoid and making sure it is set before each batch and
+	 * every context-switch.
+	 *
+	 * Note that if we fail to enable arbitration before the request
+	 * is complete, then we do not see the context-switch interrupt and
+	 * the engine hangs (with RING_HEAD == RING_TAIL).
+	 *
+	 * That satisfies both the GPGPU w/a and our heavy-handed paranoia.
+	 */
 	*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
 
 	/* FIXME(BDW): Address space and security selectors. */
Signature · 6 lines
2.14.2

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

Re: [PATCH] drm/i915/execlists: Add a comment for the extra MI_ARB_ENABLE

Quoted 11 lines · Chris Wilson

Michel Thierry noticed that we were applying WaDisableCtxRestoreArbitration even to gen9, which does not require the w/a. The rationale is that we need to enable MI arbitration for execlists to work, and to be safe we do that before every batch (in addition to every context switch into the batch). Since this is not clear from the single line comment suggesting the MI_ARB_ENABLE is solely for the w/a, add a little more detail.

Cc Michel Thierry <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Michał Winiarski <[email protected]>

It can't be clearer. Thanks!

Quoted 24 lines
---
  drivers/gpu/drm/i915/intel_lrc.c | 18 +++++++++++++++++-
  1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +10 -1
index 476881f63505..fa66e4f58642 100644
@@ -1608,7 +1608,23 @@ static int gen8_emit_bb_start(struct drm_i915_gem_request *req,
  	if (IS_ERR(cs))
  		return PTR_ERR(cs);
 
-	/* WaDisableCtxRestoreArbitration:bdw,chv */
+	/*
+	 * WaDisableCtxRestoreArbitration:bdw,chv
+	 *
+	 * We don't need to perform MI_ARB_ENABLE as often as we do (in
+	 * particular all the gen that do not need the w/a at all!), if we
+	 * took care to make sure that on every switch into this context
+	 * (both ordinary and for preemption) that arbitrartion was enabled
+	 * we would be fine. However, there doesn't seem to be a downside to
+	 * being paranoid and making sure it is set before each batch and
+	 * every context-switch.

drivers/gpu/drm/i915/intel_lrc.c static int gen8_emit_bb_start(struct drm_i915_gem_request *req, · line 1630

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +7 -0
+	 *
+	 * Note that if we fail to enable arbitration before the request
+	 * is complete, then we do not see the context-switch interrupt and
+	 * the engine hangs (with RING_HEAD == RING_TAIL).
+	 *
+	 * That satisfies both the GPGPU w/a and our heavy-handed paranoia.
+	 */
  	*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
 
  	/* FIXME(BDW): Address space and security selectors. */

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

#6 lore raw

Re: [PATCH] drm/i915/execlists: Add a comment for the extra MI_ARB_ENABLE

Quoting Michel Thierry (2017-10-05 20:41:40)

Quoted 8 lines · Chris Wilson
Quoted 7 lines

Michel Thierry noticed that we were applying WaDisableCtxRestoreArbitration even to gen9, which does not require the w/a. The rationale is that we need to enable MI arbitration for execlists to work, and to be safe we do that before every batch (in addition to every context switch into the batch). Since this is not clear from the single line comment suggesting the MI_ARB_ENABLE is solely for the w/a, add a little more detail.

Quoted 8 lines
Quoted 4 lines
Cc Michel Thierry <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Michał Winiarski <[email protected]>

It can't be clearer. Thanks!

Thanks for asking, and checking what I wrote made sense! -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

✗ Fi.CI.BAT: warning for drm/i915/execlists: WaDisableCtxRestoreArbitration is only needed in gen8 (rev2)

In reply to Michel Thierry
== Series Details ==

== Series Details ==

Series: drm/i915/execlists: WaDisableCtxRestoreArbitration is only needed in gen8 (rev2)
URL : https://patchwork.freedesktop.org/series/31452/
State : warning

== Summary ==

Series 31452v2 drm/i915/execlists: WaDisableCtxRestoreArbitration is only needed in gen8
https://patchwork.freedesktop.org/api/1.0/series/31452/revisions/2/mbox/

Test gem_exec_suspend:

        Subgroup basic-s3:
                pass       -> DMESG-FAIL (fi-kbl-r) fdo#102846 +2
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103026
Test gem_flink_basic:
        Subgroup bad-flink:
                pass       -> DMESG-WARN (fi-kbl-r)
        Subgroup bad-open:
                pass       -> DMESG-WARN (fi-kbl-r)
        Subgroup basic:
                pass       -> DMESG-WARN (fi-kbl-r)
        Subgroup double-flink:
                pass       -> DMESG-WARN (fi-kbl-r)
        Subgroup flink-lifetime:
                pass       -> DMESG-WARN (fi-kbl-r)

fdo#102846 https://bugs.freedesktop.org/show_bug.cgi?id=102846
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:460s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:472s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:395s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:575s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:287s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:529s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:534s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:546s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:541s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:568s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:619s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:436s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:598s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:437s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:422s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:463s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:509s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:475s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:507s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:581s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:499s
fi-kbl-r         total:125  pass:97   dwarn:5   dfail:2   fail:0   skip:20 
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:655s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:665s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:530s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:583s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:469s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:579s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:431s

97c9e99b242fe40bbda48ba2bcaed07c47fba085 drm-tip: 2017y-10m-06d-09h-07m-21s UTC integration manifest a9197bdfd0c3 drm/i915/execlists: Add a comment for the extra MI_ARB_ENABLE

== Logs ==

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