Skip to contentSkip to conversation

drm/i915: set initialised only when init_context callback is NULL

PATCH In review Chuanxiao Dong 5 participants 11 messages May 11, 2017 – May 19, 2017

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

PATCH 1/1 drm/i915: set initialised only when init_context callback is NULL

initialised is fixup by the GVT shadow context as true to avoid the init from the host because it cannot take the settings from the host. Add a check to let host driver only overwrite it when the init callback is NULL

---
 drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +2 -1
index 319d9a8..d0e9b61 100644
@@ -1956,7 +1956,8 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
 	ce->ring = ring;
 	ce->state = vma;
-	ce->initialised = engine->init_context == NULL;
+	if (!engine->init_context)
+		ce->initialised = true;
 
 	return 0;
 
Signature · 6 lines
2.7.4

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

✓ Fi.CI.BAT: success for drm/i915: set initialised only when init_context callback is NULL

== Series Details ==

== Series Details ==

Series: drm/i915: set initialised only when init_context callback is NULL
URL : https://patchwork.freedesktop.org/series/24286/
State : success

== Summary ==

Series 24286v1 drm/i915: set initialised only when init_context callback is NULL
https://patchwork.freedesktop.org/api/1.0/series/24286/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

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

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:439s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:435s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:582s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:506s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time:559s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:496s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:491s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:418s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:413s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:418s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:503s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:497s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:460s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:576s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:459s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:576s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:475s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:498s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:443s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:530s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:411s

81dbd44ab4c1331c61a971b05681473a869b3039 drm-tip: 2017y-05m-11d-09h-55m-44s UTC integration manifest 5a738b5 drm/i915: set initialised only when init_context callback is NULL

== Logs ==

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

#2 lore raw
In reply to Chuanxiao Dong
Quoted 3 lines · Chuanxiao Dong

initialised is fixup by the GVT shadow context as true to avoid the init from the host because it cannot take the settings from the host. Add a check to let host driver only overwrite it when the init callback is NULL

During execlist_context_deferred_alloc() we presumed that the context is uninitialised (we only just allocated the state object for it!) and chose to optimise away the later call to engine->init_context() if engine->init_context were NULL. This breaks with GVT's contexts that are marked as pre-initialised to avoid us annoyingly calling engine->init_context(). The fix is to not override ce->initialised if it is already true.

Quoted 11 lines
---
 drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index 319d9a8..d0e9b61 100644

drivers/gpu/drm/i915/intel_lrc.c static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, · line 1960

Quoted 6 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -1
@@ -1956,7 +1956,8 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
 	ce->ring = ring;
 	ce->state = vma;
-	ce->initialised = engine->init_context == NULL;
+	if (!engine->init_context)
+		ce->initialised = true;

Does the compiler generate a cmov?
-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
#3 lore raw
Quoted 25 lines · Chris Wilson
Quoted 3 lines · Chuanxiao Dong

initialised is fixup by the GVT shadow context as true to avoid the init from the host because it cannot take the settings from the host. Add a check to let host driver only overwrite it when the init callback is NULL

During execlist_context_deferred_alloc() we presumed that the context is uninitialised (we only just allocated the state object for it!) and chose to optimise away the later call to engine->init_context() if engine->init_context were NULL. This breaks with GVT's contexts that are marked as pre-initialised to avoid us annoyingly calling engine->init_context(). The fix is to not override ce->initialised if it is already true.

Quoted 12 lines
---
 drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index 319d9a8..d0e9b61 100644
@@ -1956,7 +1956,8 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
Quoted 7 lines

drivers/gpu/drm/i915/intel_lrc.c static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, · line 1960

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -1
 	ce->ring = ring;
 	ce->state = vma;
-	ce->initialised = engine->init_context == NULL;
+	if (!engine->init_context)
+		ce->initialised = true;

Does the compiler generate a cmov?

Test and jump, may as well just use ce->initialised |= init_context == NULL;
-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
#4 lore raw
Quoted 10 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, May 12, 2017 6:11 PM
To: Dong, Chuanxiao <[email protected]>; intel- [email protected]; [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: set initialised only when init_context callback is NULL

Quoted 16 lines
Quoted 15 lines · Chris Wilson
Quoted 4 lines · Chuanxiao Dong

initialised is fixup by the GVT shadow context as true to avoid the init from the host because it cannot take the settings from the host. Add a check to let host driver only overwrite it when the init callback is NULL

During execlist_context_deferred_alloc() we presumed that the context is uninitialised (we only just allocated the state object for it!) and chose to optimise away the later call to engine->init_context() if engine->init_context were NULL. This breaks with GVT's contexts that engine->are
marked as pre-initialised to avoid us annoyingly calling engine->init_context(). The fix is to not override ce->initialised if engine->it
is already true.

Thanks Chris, will use this as commit message

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
---
 drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index 319d9a8..d0e9b61 100644
@@ -1956,7 +1956,8 @@ static int
 execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/i915/intel_lrc.c static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, · line 1960

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -1
 	ce->ring = ring;
 	ce->state = vma;
-	ce->initialised = engine->init_context == NULL;
+	if (!engine->init_context)
+		ce->initialised = true;

Does the compiler generate a cmov?

Just get the assembly code of this change, seems no cmov. if (!engine->init_context)

ffffffff8156b6f3:       49 83 bf c0 01 00 00    cmpq   $0x0,0x1c0(%r15)
ffffffff8156b6fa:       00
ffffffff8156b6fb:       0f 84 e5 01 00 00       je     ffffffff8156b8e6 <execlists_context_pin+0x486>
.........
        ce->initialised = true;
ffffffff8156b8e6:       4d 6b ed 28             imul   $0x28,%r13,%r13
ffffffff8156b8ea:       43 c6 44 2e 7c 01       movb   $0x1,0x7c(%r14,%r13,1)
ffffffff8156b8f0:       e9 0c fe ff ff          jmpq   ffffffff8156b701 <execlists_context_pin+0x2a1>
Quoted 3 lines

Test and jump, may as well just use ce->initialised |= init_context == NULL; - Chris

This is the new assembly code for this new change:

         ce->initialised |= engine->init_context == NULL;
ffffffff8156b6f3:       49 83 bf c0 01 00 00    cmpq   $0x0,0x1c0(%r15)
ffffffff8156b6fa:       00
ffffffff8156b6fb:       0f 94 c2                sete   %dl
ffffffff8156b6fe:       08 50 7c                or     %dl,0x7c(%rax)

looks your change is better because the compiler doesn't generate a jump. :)

Will send out v2 with your idea.

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

#5 lore raw

PATCH v2 1/1 drm/i915: set initialised only when init_context callback is NULL

In reply to Chuanxiao Dong

From: Chuanxiao Dong <[email protected]>

During execlist_context_deferred_alloc() we presumed that the context is uninitialised (we only just allocated the state object for it!) and chose to optimise away the later call to engine->init_context() if engine->init_context were NULL. This breaks with GVT's contexts that are marked as pre-initialised to avoid us annoyingly calling engine->init_context(). The fix is to not override ce->initialised if it is already true.

---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 319d9a8f37ca..9a1192d61538 100644
@@ -1956,7 +1956,7 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
 	ce->ring = ring;
 	ce->state = vma;
-	ce->initialised = engine->init_context == NULL;
+	ce->initialised |= engine->init_context == NULL;
 
 	return 0;
 
Signature · 6 lines
2.11.0

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

Thanks Chris! Have a nice weekend. :)

Quoted 45 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, May 12, 2017 6:12 PM
To: [email protected]
Cc: Dong, Chuanxiao <[email protected]>; Chris Wilson <[email protected]>
Subject: [PATCH v2] drm/i915: set initialised only when init_context callback is NULL

From: Chuanxiao Dong <[email protected]>

During execlist_context_deferred_alloc() we presumed that the context is uninitialised (we only just allocated the state object for it!) and chose to optimise away the later call to engine->init_context() if engine->init_context were NULL. This breaks with GVT's contexts that are marked as pre-initialised to avoid us annoyingly calling engine->init_context(). The fix is to not override ce->initialised if it is already true.

[email protected]

---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -2
index 319d9a8f37ca..9a1192d61538 100644
@@ -1956,7 +1956,7 @@ static int execlists_context_deferred_alloc(struct
 i915_gem_context *ctx,
 
 	ce->ring = ring;
 	ce->state = vma;
-	ce->initialised = engine->init_context == NULL;
+	ce->initialised |= engine->init_context == NULL;
 
 	return 0;
 
--
Quoted 1 line

2.11.0

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

#7 lore raw

✓ Fi.CI.BAT: success for drm/i915: set initialised only when init_context callback is NULL (rev2)

In reply to Chuanxiao Dong
== Series Details ==

== Series Details ==

Series: drm/i915: set initialised only when init_context callback is NULL (rev2)
URL : https://patchwork.freedesktop.org/series/24286/
State : success

== Summary ==

Series 24286v2 drm/i915: set initialised only when init_context callback is NULL
https://patchwork.freedesktop.org/api/1.0/series/24286/revisions/2/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

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

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:438s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:437s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:576s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time:562s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:497s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:481s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:415s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:414s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:500s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:478s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:468s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:572s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:459s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:582s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:461s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:502s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:440s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:536s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:419s

fi-bxt-j4205 failed to collect. IGT log at Patchwork_4681/fi-bxt-j4205/igt.log

51350ea90d1a5c8bb7e6532eb61c64a57e83ab9b drm-tip: 2017y-05m-11d-13h-05m-06s UTC integration manifest fdaa20d drm/i915: set initialised only when init_context callback is NULL

== Logs ==

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

#8 lore raw

Re: ✓ Fi.CI.BAT: success for drm/i915: set initialised only when init_context callback is NULL (rev2)

Quoted 6 lines · Patchwork

== Series Details ==

Series: drm/i915: set initialised only when init_context callback is NULL (rev2)
URL : https://patchwork.freedesktop.org/series/24286/
State : success

Quoted 8 lines

== Summary ==

Series 24286v2 drm/i915: set initialised only when init_context callback is NULL
https://patchwork.freedesktop.org/api/1.0/series/24286/revisions/2/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

Thanks for the patch and pushed.
-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
#9 lore raw

Re: ✓ Fi.CI.BAT: success for drm/i915: set initialised only when init_context callback is NULL (rev2)

Quoted 9 lines · Chris Wilson
Quoted 8 lines · Patchwork

== Series Details ==

Series: drm/i915: set initialised only when init_context callback is NULL (rev2)
URL : https://patchwork.freedesktop.org/series/24286/
State : success

== Summary ==

Quoted 8 lines
Quoted 6 lines

Series 24286v2 drm/i915: set initialised only when init_context callback is NULL
https://patchwork.freedesktop.org/api/1.0/series/24286/revisions/2/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

Thanks for the patch and pushed.

Could this be picked to -fixes? It should be in 4.12 and apply for -stable kernel too I think.

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

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

maintainer
#10 lore raw

Re: ✓ Fi.CI.BAT: success for drm/i915: set initialised only when init_context callback is NULL (rev2)

Quoted 13 lines · Zhenyu Wang
Quoted 12 lines · Chris Wilson
Quoted 11 lines · Patchwork

== Series Details ==

Series: drm/i915: set initialised only when init_context callback is NULL (rev2)
URL : https://patchwork.freedesktop.org/series/24286/
State : success

== Summary ==

Series 24286v2 drm/i915: set initialised only when init_context callback is NULL
https://patchwork.freedesktop.org/api/1.0/series/24286/revisions/2/mbox/

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

Thanks for the patch and pushed.

Could this be picked to -fixes? It should be in 4.12 and apply for -stable kernel too I think.

Argh, you asked this to be picked up on irc, so I did. But you only mentioned 4.12 and nothing about stable backports, so it doesn't have
cc: stable now. Is this needed for stable?!

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx