All of lore.kernel.org
 help / color / mirror / Atom feed
* [CI] drm/i915: Refactor unsettting obj->mm.pages
@ 2018-06-11  7:55 Chris Wilson
  2018-06-11  9:09 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chris Wilson @ 2018-06-11  7:55 UTC (permalink / raw)
  To: intel-gfx

As i915_gem_object_phys_attach() wants to play dirty and mess around
with obj->mm.pages itself (replacing the shmemfs with a DMA allocation),
refactor the gubbins so into i915_gem_object_unset_pages() that we don't
have to duplicate all the secrets.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 68 ++++++++++++++++++---------------
 1 file changed, 37 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 4187e0688e50..026a27afa65c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2401,29 +2401,15 @@ static void __i915_gem_object_reset_page_iter(struct drm_i915_gem_object *obj)
 	rcu_read_unlock();
 }
 
-void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
-				 enum i915_mm_subclass subclass)
+static struct sg_table *
+__i915_gem_object_unset_pages(struct drm_i915_gem_object *obj)
 {
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	struct sg_table *pages;
 
-	if (i915_gem_object_has_pinned_pages(obj))
-		return;
-
-	GEM_BUG_ON(obj->bind_count);
-	if (!i915_gem_object_has_pages(obj))
-		return;
-
-	/* May be called by shrinker from within get_pages() (on another bo) */
-	mutex_lock_nested(&obj->mm.lock, subclass);
-	if (unlikely(atomic_read(&obj->mm.pages_pin_count)))
-		goto unlock;
-
-	/* ->put_pages might need to allocate memory for the bit17 swizzle
-	 * array, hence protect them from being reaped by removing them from gtt
-	 * lists early. */
 	pages = fetch_and_zero(&obj->mm.pages);
-	GEM_BUG_ON(!pages);
+	if (!pages)
+		return NULL;
 
 	spin_lock(&i915->mm.obj_lock);
 	list_del(&obj->mm.link);
@@ -2442,12 +2428,37 @@ void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
 	}
 
 	__i915_gem_object_reset_page_iter(obj);
+	obj->mm.page_sizes.phys = obj->mm.page_sizes.sg = 0;
+
+	return pages;
+}
 
+void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
+				 enum i915_mm_subclass subclass)
+{
+	struct sg_table *pages;
+
+	if (i915_gem_object_has_pinned_pages(obj))
+		return;
+
+	GEM_BUG_ON(obj->bind_count);
+	if (!i915_gem_object_has_pages(obj))
+		return;
+
+	/* May be called by shrinker from within get_pages() (on another bo) */
+	mutex_lock_nested(&obj->mm.lock, subclass);
+	if (unlikely(atomic_read(&obj->mm.pages_pin_count)))
+		goto unlock;
+
+	/*
+	 * ->put_pages might need to allocate memory for the bit17 swizzle
+	 * array, hence protect them from being reaped by removing them from gtt
+	 * lists early.
+	 */
+	pages = __i915_gem_object_unset_pages(obj);
 	if (!IS_ERR(pages))
 		obj->ops->put_pages(obj, pages);
 
-	obj->mm.page_sizes.phys = obj->mm.page_sizes.sg = 0;
-
 unlock:
 	mutex_unlock(&obj->mm.lock);
 }
@@ -6090,16 +6101,7 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align)
 		goto err_unlock;
 	}
 
-	pages = fetch_and_zero(&obj->mm.pages);
-	if (pages) {
-		struct drm_i915_private *i915 = to_i915(obj->base.dev);
-
-		__i915_gem_object_reset_page_iter(obj);
-
-		spin_lock(&i915->mm.obj_lock);
-		list_del(&obj->mm.link);
-		spin_unlock(&i915->mm.obj_lock);
-	}
+	pages = __i915_gem_object_unset_pages(obj);
 
 	obj->ops = &i915_gem_phys_ops;
 
@@ -6117,7 +6119,11 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align)
 
 err_xfer:
 	obj->ops = &i915_gem_object_ops;
-	obj->mm.pages = pages;
+	if (!IS_ERR_OR_NULL(pages)) {
+		unsigned int sg_page_sizes = i915_sg_page_sizes(pages->sgl);
+
+		__i915_gem_object_set_pages(obj, pages, sg_page_sizes);
+	}
 err_unlock:
 	mutex_unlock(&obj->mm.lock);
 	return err;
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Refactor unsettting obj->mm.pages
  2018-06-11  7:55 [CI] drm/i915: Refactor unsettting obj->mm.pages Chris Wilson
@ 2018-06-11  9:09 ` Patchwork
  2018-06-11  9:26 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-06-11  9:09 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Refactor unsettting obj->mm.pages
URL   : https://patchwork.freedesktop.org/series/44554/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
45bef5e342e0 drm/i915: Refactor unsettting obj->mm.pages
-:57: CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided
#57: FILE: drivers/gpu/drm/i915/i915_gem.c:2431:
+	obj->mm.page_sizes.phys = obj->mm.page_sizes.sg = 0;

total: 0 errors, 0 warnings, 1 checks, 101 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Refactor unsettting obj->mm.pages
  2018-06-11  7:55 [CI] drm/i915: Refactor unsettting obj->mm.pages Chris Wilson
  2018-06-11  9:09 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2018-06-11  9:26 ` Patchwork
  2018-06-11 11:08 ` ✓ Fi.CI.IGT: " Patchwork
  2018-06-11 12:35 ` [CI] " Jani Nikula
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-06-11  9:26 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Refactor unsettting obj->mm.pages
URL   : https://patchwork.freedesktop.org/series/44554/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4299 -> Patchwork_9254 =

== Summary - SUCCESS ==

  No regressions found.

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

== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
      fi-glk-j4005:       PASS -> FAIL (fdo#106765)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106000)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-hsw-peppy:       FAIL (fdo#105900) -> PASS
      fi-kbl-7500u:       DMESG-WARN (fdo#105128) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
      fi-glk-j4005:       FAIL (fdo#103481) -> PASS

    
  fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
  fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
  fdo#106765 https://bugs.freedesktop.org/show_bug.cgi?id=106765


== Participating hosts (43 -> 38) ==

  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-skl-6700hq 


== Build changes ==

    * Linux: CI_DRM_4299 -> Patchwork_9254

  CI_DRM_4299: 10a8bdb2fb3dd197c3e2e69d90c58f4aa0abc515 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4513: 7b6838781441cfbc7f6c18f421f127dfb02b44cf @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9254: 45bef5e342e0495240fe2cbdf50e5de4314ba482 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

45bef5e342e0 drm/i915: Refactor unsettting obj->mm.pages

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9254/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Refactor unsettting obj->mm.pages
  2018-06-11  7:55 [CI] drm/i915: Refactor unsettting obj->mm.pages Chris Wilson
  2018-06-11  9:09 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
  2018-06-11  9:26 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-06-11 11:08 ` Patchwork
  2018-06-11 12:35 ` [CI] " Jani Nikula
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-06-11 11:08 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Refactor unsettting obj->mm.pages
URL   : https://patchwork.freedesktop.org/series/44554/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4299_full -> Patchwork_9254_full =

== Summary - WARNING ==

  Minor unknown changes coming with Patchwork_9254_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_9254_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_9254_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_mocs_settings@mocs-rc6-blt:
      shard-kbl:          PASS -> SKIP

    igt@gem_mocs_settings@mocs-rc6-vebox:
      shard-kbl:          SKIP -> PASS +1

    igt@kms_vblank@pipe-a-wait-forked:
      shard-snb:          SKIP -> PASS

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      shard-glk:          NOTRUN -> DMESG-FAIL (fdo#106560)

    igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
      shard-hsw:          PASS -> FAIL (fdo#105767)

    igt@kms_cursor_legacy@flip-vs-cursor-varying-size:
      shard-hsw:          PASS -> FAIL (fdo#102670)

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          PASS -> FAIL (fdo#104724, fdo#103822) +1

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

    
    ==== Possible fixes ====

    igt@drv_selftest@live_gtt:
      shard-glk:          INCOMPLETE (k.org#198133, fdo#103359) -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking-fencing:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#102887) -> PASS

    igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_flip@modeset-vs-vblank-race:
      shard-hsw:          FAIL (fdo#103060) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-shrfb-draw-mmap-wc:
      shard-glk:          FAIL (fdo#103167, fdo#104724) -> PASS +1

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
  fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
  fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
  fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
  fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
  fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


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

  No changes in participating hosts


== Build changes ==

    * Linux: CI_DRM_4299 -> Patchwork_9254

  CI_DRM_4299: 10a8bdb2fb3dd197c3e2e69d90c58f4aa0abc515 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4513: 7b6838781441cfbc7f6c18f421f127dfb02b44cf @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_9254: 45bef5e342e0495240fe2cbdf50e5de4314ba482 @ 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_9254/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [CI] drm/i915: Refactor unsettting obj->mm.pages
  2018-06-11  7:55 [CI] drm/i915: Refactor unsettting obj->mm.pages Chris Wilson
                   ` (2 preceding siblings ...)
  2018-06-11 11:08 ` ✓ Fi.CI.IGT: " Patchwork
@ 2018-06-11 12:35 ` Jani Nikula
  3 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2018-06-11 12:35 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Mon, 11 Jun 2018, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> As i915_gem_object_phys_attach() wants to play dirty and mess around
> with obj->mm.pages itself (replacing the shmemfs with a DMA allocation),
> refactor the gubbins so into i915_gem_object_unset_pages() that we don't
> have to duplicate all the secrets.

Triple t in "unsettting" in the subject. Can be fixed while applying.

BR,
Jani.

>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 68 ++++++++++++++++++---------------
>  1 file changed, 37 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 4187e0688e50..026a27afa65c 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2401,29 +2401,15 @@ static void __i915_gem_object_reset_page_iter(struct drm_i915_gem_object *obj)
>  	rcu_read_unlock();
>  }
>  
> -void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
> -				 enum i915_mm_subclass subclass)
> +static struct sg_table *
> +__i915_gem_object_unset_pages(struct drm_i915_gem_object *obj)
>  {
>  	struct drm_i915_private *i915 = to_i915(obj->base.dev);
>  	struct sg_table *pages;
>  
> -	if (i915_gem_object_has_pinned_pages(obj))
> -		return;
> -
> -	GEM_BUG_ON(obj->bind_count);
> -	if (!i915_gem_object_has_pages(obj))
> -		return;
> -
> -	/* May be called by shrinker from within get_pages() (on another bo) */
> -	mutex_lock_nested(&obj->mm.lock, subclass);
> -	if (unlikely(atomic_read(&obj->mm.pages_pin_count)))
> -		goto unlock;
> -
> -	/* ->put_pages might need to allocate memory for the bit17 swizzle
> -	 * array, hence protect them from being reaped by removing them from gtt
> -	 * lists early. */
>  	pages = fetch_and_zero(&obj->mm.pages);
> -	GEM_BUG_ON(!pages);
> +	if (!pages)
> +		return NULL;
>  
>  	spin_lock(&i915->mm.obj_lock);
>  	list_del(&obj->mm.link);
> @@ -2442,12 +2428,37 @@ void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
>  	}
>  
>  	__i915_gem_object_reset_page_iter(obj);
> +	obj->mm.page_sizes.phys = obj->mm.page_sizes.sg = 0;
> +
> +	return pages;
> +}
>  
> +void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
> +				 enum i915_mm_subclass subclass)
> +{
> +	struct sg_table *pages;
> +
> +	if (i915_gem_object_has_pinned_pages(obj))
> +		return;
> +
> +	GEM_BUG_ON(obj->bind_count);
> +	if (!i915_gem_object_has_pages(obj))
> +		return;
> +
> +	/* May be called by shrinker from within get_pages() (on another bo) */
> +	mutex_lock_nested(&obj->mm.lock, subclass);
> +	if (unlikely(atomic_read(&obj->mm.pages_pin_count)))
> +		goto unlock;
> +
> +	/*
> +	 * ->put_pages might need to allocate memory for the bit17 swizzle
> +	 * array, hence protect them from being reaped by removing them from gtt
> +	 * lists early.
> +	 */
> +	pages = __i915_gem_object_unset_pages(obj);
>  	if (!IS_ERR(pages))
>  		obj->ops->put_pages(obj, pages);
>  
> -	obj->mm.page_sizes.phys = obj->mm.page_sizes.sg = 0;
> -
>  unlock:
>  	mutex_unlock(&obj->mm.lock);
>  }
> @@ -6090,16 +6101,7 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align)
>  		goto err_unlock;
>  	}
>  
> -	pages = fetch_and_zero(&obj->mm.pages);
> -	if (pages) {
> -		struct drm_i915_private *i915 = to_i915(obj->base.dev);
> -
> -		__i915_gem_object_reset_page_iter(obj);
> -
> -		spin_lock(&i915->mm.obj_lock);
> -		list_del(&obj->mm.link);
> -		spin_unlock(&i915->mm.obj_lock);
> -	}
> +	pages = __i915_gem_object_unset_pages(obj);
>  
>  	obj->ops = &i915_gem_phys_ops;
>  
> @@ -6117,7 +6119,11 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align)
>  
>  err_xfer:
>  	obj->ops = &i915_gem_object_ops;
> -	obj->mm.pages = pages;
> +	if (!IS_ERR_OR_NULL(pages)) {
> +		unsigned int sg_page_sizes = i915_sg_page_sizes(pages->sgl);
> +
> +		__i915_gem_object_set_pages(obj, pages, sg_page_sizes);
> +	}
>  err_unlock:
>  	mutex_unlock(&obj->mm.lock);
>  	return err;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-11 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11  7:55 [CI] drm/i915: Refactor unsettting obj->mm.pages Chris Wilson
2018-06-11  9:09 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-06-11  9:26 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-11 11:08 ` ✓ Fi.CI.IGT: " Patchwork
2018-06-11 12:35 ` [CI] " Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.