Skip to contentSkip to conversation

drm/i915: Check engine->default_state mapping on module load

PATCH In review Chris Wilson 3 participants 8 messages Sep 14, 2018

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

PATCH 1/1 drm/i915: Check engine->default_state mapping on module load

Check we can indeed acquire a WB mapping of the context image on module load. Later this will give us the opportunity to validate that we can switch from WC to WB as required.

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +11 -0
index be9d012d851b..37353afec66e 100644
@@ -5424,6 +5424,7 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 
 	for_each_engine(engine, i915, id) {
 		struct i915_vma *state;
+		void *vaddr;
 
 		state = to_intel_context(ctx, engine)->state;
 		if (!state)
@@ -5446,6 +5447,16 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 			goto err_active;
 
 		engine->default_state = i915_gem_object_get(state->obj);
+
+		/* Check we can acquire the image of the context state */
+		vaddr = i915_gem_object_pin_map(engine->default_state,
+						I915_MAP_WB);
+		if (IS_ERR(vaddr)) {
+			err = PTR_ERR(vaddr);
+			goto err_active;
+		}
+
+		i915_gem_object_unpin_map(engine->default_state);
 	}
 
 	if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) {
Signature · 6 lines
2.19.0

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

Check we can indeed acquire a WB mapping of the context image on module load. Later this will give us the opportunity to validate that we can switch from WC to WB as required.

Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index be9d012d851b..37353afec66e 100644
@@ -5424,6 +5424,7 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 
  	for_each_engine(engine, i915, id) {
  		struct i915_vma *state;
+		void *vaddr;
 
  		state = to_intel_context(ctx, engine)->state;
  		if (!state)
@@ -5446,6 +5447,16 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
  			goto err_active;
 
  		engine->default_state = i915_gem_object_get(state->obj);

drivers/gpu/drm/i915/i915_gem.c static int __intel_engines_record_defaults(struct drm_i915_private *i915) · line 5459

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
+
+		/* Check we can acquire the image of the context state */
+		vaddr = i915_gem_object_pin_map(engine->default_state,
+						I915_MAP_WB);
+		if (IS_ERR(vaddr)) {
+			err = PTR_ERR(vaddr);
+			goto err_active;
+		}
+
+		i915_gem_object_unpin_map(engine->default_state);

Ah this perhaps strengthens the argument to have __intel_engines_pin_default_state? (And the unpin pair.)

And I guess you made this patch come before the switch to WC since it is not FORCE_WB here?

Regards,

Tvrtko

drivers/gpu/drm/i915/i915_gem.c static int __intel_engines_record_defaults(struct drm_i915_private *i915) · line 5462

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
  	}
 
  	if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) {

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

#2 lore raw

Quoting Tvrtko Ursulin (2018-09-14 10:43:12)

Quoted 27 lines · Chris Wilson
Quoted 25 lines

Check we can indeed acquire a WB mapping of the context image on module load. Later this will give us the opportunity to validate that we can switch from WC to WB as required.

Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index be9d012d851b..37353afec66e 100644
@@ -5424,6 +5424,7 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 
      for_each_engine(engine, i915, id) {
              struct i915_vma *state;
+             void *vaddr;
 
              state = to_intel_context(ctx, engine)->state;
              if (!state)
@@ -5446,6 +5447,16 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
                      goto err_active;
 
Quoted 14 lines

drivers/gpu/drm/i915/i915_gem.c static int __intel_engines_record_defaults(struct drm_i915_private *i915) · line 5459

Quoted 11 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
              engine->default_state = i915_gem_object_get(state->obj);
+
+             /* Check we can acquire the image of the context state */
+             vaddr = i915_gem_object_pin_map(engine->default_state,
+                                             I915_MAP_WB);
+             if (IS_ERR(vaddr)) {
+                     err = PTR_ERR(vaddr);
+                     goto err_active;
+             }
+
+             i915_gem_object_unpin_map(engine->default_state);

Ah this perhaps strengthens the argument to have __intel_engines_pin_default_state? (And the unpin pair.)

I hope it doesn't come to making this into an interface :) Definitely not an idea I endorse, random manipulation of the default_state.

Quoted 2 lines

And I guess you made this patch come before the switch to WC since it is not FORCE_WB here?

Yes, full sequence of patches in your inbox.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 43 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-09-14 10:43:12)

Quoted 27 lines · Chris Wilson
Quoted 25 lines

Check we can indeed acquire a WB mapping of the context image on module load. Later this will give us the opportunity to validate that we can switch from WC to WB as required.

Cc Tvrtko Ursulin <[email protected]>
---
   drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++
   1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index be9d012d851b..37353afec66e 100644
@@ -5424,6 +5424,7 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 
       for_each_engine(engine, i915, id) {
               struct i915_vma *state;
+             void *vaddr;
 
               state = to_intel_context(ctx, engine)->state;
               if (!state)
@@ -5446,6 +5447,16 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
                       goto err_active;
 
Quoted 14 lines

drivers/gpu/drm/i915/i915_gem.c static int __intel_engines_record_defaults(struct drm_i915_private *i915) · line 5459

Quoted 11 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
               engine->default_state = i915_gem_object_get(state->obj);
+
+             /* Check we can acquire the image of the context state */
+             vaddr = i915_gem_object_pin_map(engine->default_state,
+                                             I915_MAP_WB);
+             if (IS_ERR(vaddr)) {
+                     err = PTR_ERR(vaddr);
+                     goto err_active;
+             }
+
+             i915_gem_object_unpin_map(engine->default_state);

Ah this perhaps strengthens the argument to have __intel_engines_pin_default_state? (And the unpin pair.)

Quoted 3 lines

I hope it doesn't come to making this into an interface :) Definitely not an idea I endorse, random manipulation of the default_state.

Double underscore alleviates those concerns, no? :)

Would makes it only one place the following patch needed to switch to MAP_FORCE_WB.

Regards,

Tvrtko

Quoted 6 lines
Quoted 2 lines

And I guess you made this patch come before the switch to WC since it is not FORCE_WB here?

Yes, full sequence of patches in your inbox.
-Chris

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

#4 lore raw

Quoting Tvrtko Ursulin (2018-09-14 11:03:18)

Quoted 45 lines · Chris Wilson
Quoted 43 lines

Quoting Tvrtko Ursulin (2018-09-14 10:43:12)

Quoted 41 lines · Chris Wilson
Quoted 26 lines

Check we can indeed acquire a WB mapping of the context image on module load. Later this will give us the opportunity to validate that we can switch from WC to WB as required.

Cc Tvrtko Ursulin <[email protected]>
---
   drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++
   1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index be9d012d851b..37353afec66e 100644
@@ -5424,6 +5424,7 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 
       for_each_engine(engine, i915, id) {
               struct i915_vma *state;
+             void *vaddr;
 
               state = to_intel_context(ctx, engine)->state;
               if (!state)
@@ -5446,6 +5447,16 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
                       goto err_active;
 
               engine->default_state = i915_gem_object_get(state->obj);

drivers/gpu/drm/i915/i915_gem.c static int __intel_engines_record_defaults(struct drm_i915_private *i915) · line 5459

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
+
+             /* Check we can acquire the image of the context state */
+             vaddr = i915_gem_object_pin_map(engine->default_state,
+                                             I915_MAP_WB);
+             if (IS_ERR(vaddr)) {
+                     err = PTR_ERR(vaddr);
+                     goto err_active;
+             }
+
+             i915_gem_object_unpin_map(engine->default_state);

Ah this perhaps strengthens the argument to have __intel_engines_pin_default_state? (And the unpin pair.)

Quoted 5 lines
Quoted 3 lines

I hope it doesn't come to making this into an interface :) Definitely not an idea I endorse, random manipulation of the default_state.

Double underscore alleviates those concerns, no? :)

Bah, did you see the EXPORT_SYMBOL_GPL(__i915_gem_object_set_pages), nothing is safe!

Quoted 2 lines

Would makes it only one place the following patch needed to switch to MAP_FORCE_WB.

But that was the point of having a separate step here. This is then the only mapping of default_state that needs to do the force. I liked that. The other one we need is the initialisation of the lrc state. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#5 lore raw
Quoted 55 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-09-14 11:03:18)

Quoted 45 lines · Chris Wilson
Quoted 43 lines

Quoting Tvrtko Ursulin (2018-09-14 10:43:12)

Quoted 41 lines · Chris Wilson
Quoted 26 lines

Check we can indeed acquire a WB mapping of the context image on module load. Later this will give us the opportunity to validate that we can switch from WC to WB as required.

Cc Tvrtko Ursulin <[email protected]>
---
    drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++
    1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
index be9d012d851b..37353afec66e 100644
@@ -5424,6 +5424,7 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
 
        for_each_engine(engine, i915, id) {
                struct i915_vma *state;
+             void *vaddr;
 
                state = to_intel_context(ctx, engine)->state;
                if (!state)
@@ -5446,6 +5447,16 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
                        goto err_active;
 
                engine->default_state = i915_gem_object_get(state->obj);

drivers/gpu/drm/i915/i915_gem.c static int __intel_engines_record_defaults(struct drm_i915_private *i915) · line 5459

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
+
+             /* Check we can acquire the image of the context state */
+             vaddr = i915_gem_object_pin_map(engine->default_state,
+                                             I915_MAP_WB);
+             if (IS_ERR(vaddr)) {
+                     err = PTR_ERR(vaddr);
+                     goto err_active;
+             }
+
+             i915_gem_object_unpin_map(engine->default_state);

Ah this perhaps strengthens the argument to have __intel_engines_pin_default_state? (And the unpin pair.)

Quoted 5 lines
Quoted 3 lines

I hope it doesn't come to making this into an interface :) Definitely not an idea I endorse, random manipulation of the default_state.

Double underscore alleviates those concerns, no? :)

Bah, did you see the EXPORT_SYMBOL_GPL(__i915_gem_object_set_pages), nothing is safe!

Quoted 6 lines
Quoted 2 lines

Would makes it only one place the following patch needed to switch to MAP_FORCE_WB.

But that was the point of having a separate step here. This is then the only mapping of default_state that needs to do the force. I liked that. The other one we need is the initialisation of the lrc state.

Hmm true.. makes some sense as much as I like avoiding code duplication. Okay..

Regards,

Tvrtko

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

#6 lore raw

✓ Fi.CI.BAT: success for drm/i915: Check engine->default_state mapping on module load

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Check engine->default_state mapping on module load
URL : https://patchwork.freedesktop.org/series/49694/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4824 -> Patchwork_10189 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/49694/revisions/1/mbox/

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    igt@prime_vgem@basic-fence-flip:
      fi-skl-iommu:       PASS -> FAIL (fdo#104008)

    
    ==== Possible fixes ====

    igt@drv_getparams_basic@basic-subslice-total:
      fi-snb-2520m:       DMESG-WARN (fdo#103713) -> PASS +9

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718

== Participating hosts (47 -> 44) ==

Additional (1): fi-hsw-4770r
Missing (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* Linux: CI_DRM_4824 -> Patchwork_10189

CI_DRM_4824: 110556c298bfe6ce81b453869e60dedbd4f0f182 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4640: 9a8da36e708f9ed15b20689dfe305e41f9a19008 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10189: 63a477bb5bb11c76748afaacfd43f4d456d4a24c @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

63a477bb5bb1 drm/i915: Check engine->default_state mapping on module load

== Logs ==

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

#7 lore raw

✓ Fi.CI.IGT: success for drm/i915: Check engine->default_state mapping on module load

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Check engine->default_state mapping on module load
URL : https://patchwork.freedesktop.org/series/49694/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4824_full -> Patchwork_10189_full =

== Summary - SUCCESS ==

No regressions found.

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-gtt:
      shard-glk:          PASS -> FAIL (fdo#103167)

    igt@kms_setmode@basic:
      shard-kbl:          PASS -> FAIL (fdo#99912)

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

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4824 -> Patchwork_10189
* Piglit: None -> piglit_4509

CI_DRM_4824: 110556c298bfe6ce81b453869e60dedbd4f0f182 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4640: 9a8da36e708f9ed15b20689dfe305e41f9a19008 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10189: 63a477bb5bb11c76748afaacfd43f4d456d4a24c @ 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_10189/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx