All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization
@ 2016-05-18  8:06 Chris Wilson
  2016-05-18  8:35 ` ✗ Ro.CI.BAT: warning for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Chris Wilson @ 2016-05-18  8:06 UTC (permalink / raw)
  To: intel-gfx

During cleanup we have to synchronise with the async task we are using
to initialise and register our fbdev. Currently, we are using a full
synchronisation on the global domain, but we can restrict this to just
synchronising up to our task if we remember our cookie.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_fbdev.c | 31 ++++++++++++++++++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3536292babe0..5bb045ba608e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -159,6 +159,7 @@ struct intel_framebuffer {
 struct intel_fbdev {
 	struct drm_fb_helper helper;
 	struct intel_framebuffer *fb;
+	async_cookie_t cookie;
 	int preferred_bpp;
 };
 
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 99e27530e264..649ea7764bc2 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -538,8 +538,7 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 	.fb_probe = intelfb_create,
 };
 
-static void intel_fbdev_destroy(struct drm_device *dev,
-				struct intel_fbdev *ifbdev)
+static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 {
 	/* We rely on the object-free to release the VMA pinning for
 	 * the info->screen_base mmaping. Leaking the VMA is simpler than
@@ -554,12 +553,14 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 	if (ifbdev->fb) {
 		drm_framebuffer_unregister_private(&ifbdev->fb->base);
 
-		mutex_lock(&dev->struct_mutex);
+		mutex_lock(&ifbdev->helper.dev->struct_mutex);
 		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
-		mutex_unlock(&dev->struct_mutex);
+		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
 
 		drm_framebuffer_remove(&ifbdev->fb->base);
 	}
+
+	kfree(ifbdev);
 }
 
 /*
@@ -736,32 +737,36 @@ int intel_fbdev_init(struct drm_device *dev)
 
 static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
 {
-	struct drm_i915_private *dev_priv = data;
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = data;
+
+	ifbdev->cookie = 0;
 
 	/* Due to peculiar init order wrt to hpd handling this is separate. */
 	if (drm_fb_helper_initial_config(&ifbdev->helper,
 					 ifbdev->preferred_bpp))
-		intel_fbdev_fini(dev_priv->dev);
+		intel_fbdev_fini(ifbdev->helper.dev);
 }
 
 void intel_fbdev_initial_config_async(struct drm_device *dev)
 {
-	async_schedule(intel_fbdev_initial_config, to_i915(dev));
+	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+
+	ifbdev->cookie = async_schedule(intel_fbdev_initial_config, ifbdev);
 }
 
 void intel_fbdev_fini(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	if (!dev_priv->fbdev)
+	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+
+	if (!ifbdev)
 		return;
 
 	flush_work(&dev_priv->fbdev_suspend_work);
+	if (ifbdev->cookie && !current_is_async())
+		async_synchronize_cookie(ifbdev->cookie);
 
-	if (!current_is_async())
-		async_synchronize_full();
-	intel_fbdev_destroy(dev, dev_priv->fbdev);
-	kfree(dev_priv->fbdev);
+	intel_fbdev_destroy(ifbdev);
 	dev_priv->fbdev = NULL;
 }
 
-- 
2.8.1

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

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

* ✗ Ro.CI.BAT: warning for drm/i915/fbdev: Limit the global async-domain synchronization
  2016-05-18  8:06 [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
@ 2016-05-18  8:35 ` Patchwork
  2016-05-19  8:28 ` [PATCH v2] " Chris Wilson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2016-05-18  8:35 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/fbdev: Limit the global async-domain synchronization
URL   : https://patchwork.freedesktop.org/series/7332/
State : warning

== Summary ==

Series 7332v1 drm/i915/fbdev: Limit the global async-domain synchronization
http://patchwork.freedesktop.org/api/1.0/series/7332/revisions/1/mbox

Test drv_hangman:
        Subgroup error-state-basic:
                fail       -> PASS       (ro-ilk1-i5-650)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-wb:
                pass       -> DMESG-WARN (ro-ivb2-i7-3770)
Test gem_exec_suspend:
        Subgroup basic-s3:
                incomplete -> PASS       (fi-hsw-i7-4770k)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-c:
                pass       -> DMESG-WARN (ro-ivb2-i7-3770)
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                skip       -> PASS       (fi-hsw-i7-4770r)
Test kms_sink_crc_basic:
                skip       -> PASS       (ro-skl-i7-6700hq)

fi-bsw-n3050     total:218  pass:174  dwarn:0   dfail:0   fail:2   skip:42 
fi-byt-n2820     total:218  pass:175  dwarn:0   dfail:0   fail:2   skip:41 
fi-hsw-i7-4770k  total:219  pass:198  dwarn:0   dfail:0   fail:0   skip:21 
fi-hsw-i7-4770r  total:219  pass:193  dwarn:0   dfail:0   fail:0   skip:26 
fi-skl-i7-6700k  total:219  pass:191  dwarn:0   dfail:0   fail:0   skip:28 
ro-bdw-i5-5250u  total:219  pass:181  dwarn:0   dfail:0   fail:0   skip:38 
ro-bdw-i7-5557U  total:219  pass:206  dwarn:0   dfail:0   fail:0   skip:13 
ro-bdw-i7-5600u  total:219  pass:187  dwarn:0   dfail:0   fail:0   skip:32 
ro-bsw-n3050     total:219  pass:175  dwarn:0   dfail:0   fail:2   skip:42 
ro-byt-n2820     total:218  pass:173  dwarn:0   dfail:0   fail:4   skip:41 
ro-hsw-i3-4010u  total:218  pass:193  dwarn:0   dfail:0   fail:0   skip:25 
ro-hsw-i7-4770r  total:219  pass:194  dwarn:0   dfail:0   fail:0   skip:25 
ro-ilk-i7-620lm  total:219  pass:151  dwarn:0   dfail:0   fail:1   skip:67 
ro-ilk1-i5-650   total:214  pass:152  dwarn:0   dfail:0   fail:1   skip:61 
ro-ivb-i7-3770   total:219  pass:183  dwarn:0   dfail:0   fail:0   skip:36 
ro-ivb2-i7-3770  total:219  pass:185  dwarn:2   dfail:0   fail:0   skip:32 
ro-skl-i7-6700hq total:214  pass:190  dwarn:0   dfail:0   fail:0   skip:24 
ro-snb-i7-2620M  total:219  pass:177  dwarn:0   dfail:0   fail:1   skip:41 
fi-snb-i7-2600 failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_925/

c5034bf drm-intel-nightly: 2016y-05m-17d-20h-49m-27s UTC integration manifest
9d107f5 drm/i915/fbdev: Limit the global async-domain synchronization

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

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

* [PATCH v2] drm/i915/fbdev: Limit the global async-domain synchronization
  2016-05-18  8:06 [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
  2016-05-18  8:35 ` ✗ Ro.CI.BAT: warning for " Patchwork
@ 2016-05-19  8:28 ` Chris Wilson
  2016-05-19 20:14   ` Lukas Wunner
  2016-05-19 10:11 ` ✓ Ro.CI.BAT: success for drm/i915/fbdev: Limit the global async-domain synchronization (rev2) Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Chris Wilson @ 2016-05-19  8:28 UTC (permalink / raw)
  To: intel-gfx

During cleanup we have to synchronise with the async task we are using
to initialise and register our fbdev. Currently, we are using a full
synchronisation on the global domain, but we can restrict this to just
synchronising up to our task if we remember our cookie.

v2: async_synchronize_cookie() takes an exclusive upper bound, to
synchronize with our task we have to pass in the next cookie.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_fbdev.c | 31 ++++++++++++++++++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3536292babe0..5bb045ba608e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -159,6 +159,7 @@ struct intel_framebuffer {
 struct intel_fbdev {
 	struct drm_fb_helper helper;
 	struct intel_framebuffer *fb;
+	async_cookie_t cookie;
 	int preferred_bpp;
 };
 
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 99e27530e264..2e9c3f38c023 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -538,8 +538,7 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 	.fb_probe = intelfb_create,
 };
 
-static void intel_fbdev_destroy(struct drm_device *dev,
-				struct intel_fbdev *ifbdev)
+static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 {
 	/* We rely on the object-free to release the VMA pinning for
 	 * the info->screen_base mmaping. Leaking the VMA is simpler than
@@ -554,12 +553,14 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 	if (ifbdev->fb) {
 		drm_framebuffer_unregister_private(&ifbdev->fb->base);
 
-		mutex_lock(&dev->struct_mutex);
+		mutex_lock(&ifbdev->helper.dev->struct_mutex);
 		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
-		mutex_unlock(&dev->struct_mutex);
+		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
 
 		drm_framebuffer_remove(&ifbdev->fb->base);
 	}
+
+	kfree(ifbdev);
 }
 
 /*
@@ -736,32 +737,36 @@ int intel_fbdev_init(struct drm_device *dev)
 
 static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
 {
-	struct drm_i915_private *dev_priv = data;
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = data;
+
+	ifbdev->cookie = 0;
 
 	/* Due to peculiar init order wrt to hpd handling this is separate. */
 	if (drm_fb_helper_initial_config(&ifbdev->helper,
 					 ifbdev->preferred_bpp))
-		intel_fbdev_fini(dev_priv->dev);
+		intel_fbdev_fini(ifbdev->helper.dev);
 }
 
 void intel_fbdev_initial_config_async(struct drm_device *dev)
 {
-	async_schedule(intel_fbdev_initial_config, to_i915(dev));
+	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+
+	ifbdev->cookie = async_schedule(intel_fbdev_initial_config, ifbdev);
 }
 
 void intel_fbdev_fini(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	if (!dev_priv->fbdev)
+	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+
+	if (!ifbdev)
 		return;
 
 	flush_work(&dev_priv->fbdev_suspend_work);
+	if (ifbdev->cookie && !current_is_async())
+		async_synchronize_cookie(ifbdev->cookie + 1);
 
-	if (!current_is_async())
-		async_synchronize_full();
-	intel_fbdev_destroy(dev, dev_priv->fbdev);
-	kfree(dev_priv->fbdev);
+	intel_fbdev_destroy(ifbdev);
 	dev_priv->fbdev = NULL;
 }
 
-- 
2.8.1

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

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

* ✓ Ro.CI.BAT: success for drm/i915/fbdev: Limit the global async-domain synchronization (rev2)
  2016-05-18  8:06 [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
  2016-05-18  8:35 ` ✗ Ro.CI.BAT: warning for " Patchwork
  2016-05-19  8:28 ` [PATCH v2] " Chris Wilson
@ 2016-05-19 10:11 ` Patchwork
  2016-05-20 10:43 ` [PATCH v3] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
  2016-05-20 11:41 ` ✗ Ro.CI.BAT: failure for drm/i915/fbdev: Limit the global async-domain synchronization (rev3) Patchwork
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2016-05-19 10:11 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/fbdev: Limit the global async-domain synchronization (rev2)
URL   : https://patchwork.freedesktop.org/series/7332/
State : success

== Summary ==

Series 7332v2 drm/i915/fbdev: Limit the global async-domain synchronization
http://patchwork.freedesktop.org/api/1.0/series/7332/revisions/2/mbox

Test drv_hangman:
        Subgroup error-state-basic:
                fail       -> PASS       (ro-ilk1-i5-650)
Test kms_sink_crc_basic:
                skip       -> PASS       (ro-skl-i7-6700hq)

fi-bdw-i7-5557u  total:219  pass:206  dwarn:0   dfail:0   fail:0   skip:13 
fi-byt-n2820     total:218  pass:175  dwarn:0   dfail:0   fail:2   skip:41 
fi-hsw-i7-4770k  total:219  pass:198  dwarn:0   dfail:0   fail:0   skip:21 
fi-hsw-i7-4770r  total:219  pass:191  dwarn:1   dfail:0   fail:0   skip:27 
fi-skl-i7-6700k  total:219  pass:191  dwarn:0   dfail:0   fail:0   skip:28 
ro-bdw-i5-5250u  total:219  pass:181  dwarn:0   dfail:0   fail:0   skip:38 
ro-bdw-i7-5557U  total:219  pass:206  dwarn:0   dfail:0   fail:0   skip:13 
ro-bdw-i7-5600u  total:219  pass:187  dwarn:0   dfail:0   fail:0   skip:32 
ro-bsw-n3050     total:219  pass:175  dwarn:0   dfail:0   fail:2   skip:42 
ro-hsw-i3-4010u  total:218  pass:193  dwarn:0   dfail:0   fail:0   skip:25 
ro-hsw-i7-4770r  total:219  pass:194  dwarn:0   dfail:0   fail:0   skip:25 
ro-ilk-i7-620lm  total:219  pass:151  dwarn:0   dfail:0   fail:1   skip:67 
ro-ilk1-i5-650   total:214  pass:152  dwarn:0   dfail:0   fail:1   skip:61 
ro-ivb-i7-3770   total:219  pass:183  dwarn:0   dfail:0   fail:0   skip:36 
ro-ivb2-i7-3770  total:219  pass:187  dwarn:0   dfail:0   fail:0   skip:32 
ro-skl-i7-6700hq total:214  pass:190  dwarn:0   dfail:0   fail:0   skip:24 
ro-snb-i7-2620M  total:219  pass:177  dwarn:0   dfail:0   fail:1   skip:41 
fi-snb-i7-2600 failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_936/

a2499a0 drm-intel-nightly: 2016y-05m-18d-17h-17m-55s UTC integration manifest
e2cd2d9 drm/i915/fbdev: Limit the global async-domain synchronization

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

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

* Re: [PATCH v2] drm/i915/fbdev: Limit the global async-domain synchronization
  2016-05-19  8:28 ` [PATCH v2] " Chris Wilson
@ 2016-05-19 20:14   ` Lukas Wunner
  2016-05-20  8:17     ` Chris Wilson
  0 siblings, 1 reply; 8+ messages in thread
From: Lukas Wunner @ 2016-05-19 20:14 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

Hi Chris,

On Thu, May 19, 2016 at 09:28:10AM +0100, Chris Wilson wrote:
> During cleanup we have to synchronise with the async task we are using
> to initialise and register our fbdev. Currently, we are using a full
> synchronisation on the global domain, but we can restrict this to just
> synchronising up to our task if we remember our cookie.
> 
> v2: async_synchronize_cookie() takes an exclusive upper bound, to
> synchronize with our task we have to pass in the next cookie.

Oops, good catch, missed that in my own version of this patch:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/091257.html

> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_drv.h   |  1 +
>  drivers/gpu/drm/i915/intel_fbdev.c | 31 ++++++++++++++++++-------------
>  2 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3536292babe0..5bb045ba608e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -159,6 +159,7 @@ struct intel_framebuffer {
>  struct intel_fbdev {
>  	struct drm_fb_helper helper;
>  	struct intel_framebuffer *fb;
> +	async_cookie_t cookie;
>  	int preferred_bpp;
>  };
>  
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 99e27530e264..2e9c3f38c023 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -538,8 +538,7 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
>  	.fb_probe = intelfb_create,
>  };
>  
> -static void intel_fbdev_destroy(struct drm_device *dev,
> -				struct intel_fbdev *ifbdev)
> +static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
>  {
>  	/* We rely on the object-free to release the VMA pinning for
>  	 * the info->screen_base mmaping. Leaking the VMA is simpler than
> @@ -554,12 +553,14 @@ static void intel_fbdev_destroy(struct drm_device *dev,
>  	if (ifbdev->fb) {
>  		drm_framebuffer_unregister_private(&ifbdev->fb->base);
>  
> -		mutex_lock(&dev->struct_mutex);
> +		mutex_lock(&ifbdev->helper.dev->struct_mutex);
>  		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> -		mutex_unlock(&dev->struct_mutex);
> +		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
>  
>  		drm_framebuffer_remove(&ifbdev->fb->base);
>  	}
> +
> +	kfree(ifbdev);
>  }
>  
>  /*
> @@ -736,32 +737,36 @@ int intel_fbdev_init(struct drm_device *dev)
>  
>  static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
>  {
> -	struct drm_i915_private *dev_priv = data;
> -	struct intel_fbdev *ifbdev = dev_priv->fbdev;
> +	struct intel_fbdev *ifbdev = data;
> +
> +	ifbdev->cookie = 0;

Hm, why are you setting this to 0 here? IIUC the effect is that
async_synchronize_cookie() will wait until intel_fbdev_initial_config()
has been *entered*, but isn't the desired effect that it has *finished*?

Best regards,

Lukas

>  
>  	/* Due to peculiar init order wrt to hpd handling this is separate. */
>  	if (drm_fb_helper_initial_config(&ifbdev->helper,
>  					 ifbdev->preferred_bpp))
> -		intel_fbdev_fini(dev_priv->dev);
> +		intel_fbdev_fini(ifbdev->helper.dev);
>  }
>  
>  void intel_fbdev_initial_config_async(struct drm_device *dev)
>  {
> -	async_schedule(intel_fbdev_initial_config, to_i915(dev));
> +	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
> +
> +	ifbdev->cookie = async_schedule(intel_fbdev_initial_config, ifbdev);
>  }
>  
>  void intel_fbdev_fini(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	if (!dev_priv->fbdev)
> +	struct intel_fbdev *ifbdev = dev_priv->fbdev;
> +
> +	if (!ifbdev)
>  		return;
>  
>  	flush_work(&dev_priv->fbdev_suspend_work);
> +	if (ifbdev->cookie && !current_is_async())
> +		async_synchronize_cookie(ifbdev->cookie + 1);
>  
> -	if (!current_is_async())
> -		async_synchronize_full();
> -	intel_fbdev_destroy(dev, dev_priv->fbdev);
> -	kfree(dev_priv->fbdev);
> +	intel_fbdev_destroy(ifbdev);
>  	dev_priv->fbdev = NULL;
>  }
>  
> -- 
> 2.8.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915/fbdev: Limit the global async-domain synchronization
  2016-05-19 20:14   ` Lukas Wunner
@ 2016-05-20  8:17     ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2016-05-20  8:17 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: intel-gfx

On Thu, May 19, 2016 at 10:14:35PM +0200, Lukas Wunner wrote:
> Hi Chris,
> 
> On Thu, May 19, 2016 at 09:28:10AM +0100, Chris Wilson wrote:
> > During cleanup we have to synchronise with the async task we are using
> > to initialise and register our fbdev. Currently, we are using a full
> > synchronisation on the global domain, but we can restrict this to just
> > synchronising up to our task if we remember our cookie.
> > 
> > v2: async_synchronize_cookie() takes an exclusive upper bound, to
> > synchronize with our task we have to pass in the next cookie.
> 
> Oops, good catch, missed that in my own version of this patch:
> https://lists.freedesktop.org/archives/intel-gfx/2016-March/091257.html
> 
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/intel_drv.h   |  1 +
> >  drivers/gpu/drm/i915/intel_fbdev.c | 31 ++++++++++++++++++-------------
> >  2 files changed, 19 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 3536292babe0..5bb045ba608e 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -159,6 +159,7 @@ struct intel_framebuffer {
> >  struct intel_fbdev {
> >  	struct drm_fb_helper helper;
> >  	struct intel_framebuffer *fb;
> > +	async_cookie_t cookie;
> >  	int preferred_bpp;
> >  };
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> > index 99e27530e264..2e9c3f38c023 100644
> > --- a/drivers/gpu/drm/i915/intel_fbdev.c
> > +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> > @@ -538,8 +538,7 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
> >  	.fb_probe = intelfb_create,
> >  };
> >  
> > -static void intel_fbdev_destroy(struct drm_device *dev,
> > -				struct intel_fbdev *ifbdev)
> > +static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
> >  {
> >  	/* We rely on the object-free to release the VMA pinning for
> >  	 * the info->screen_base mmaping. Leaking the VMA is simpler than
> > @@ -554,12 +553,14 @@ static void intel_fbdev_destroy(struct drm_device *dev,
> >  	if (ifbdev->fb) {
> >  		drm_framebuffer_unregister_private(&ifbdev->fb->base);
> >  
> > -		mutex_lock(&dev->struct_mutex);
> > +		mutex_lock(&ifbdev->helper.dev->struct_mutex);
> >  		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> > -		mutex_unlock(&dev->struct_mutex);
> > +		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
> >  
> >  		drm_framebuffer_remove(&ifbdev->fb->base);
> >  	}
> > +
> > +	kfree(ifbdev);
> >  }
> >  
> >  /*
> > @@ -736,32 +737,36 @@ int intel_fbdev_init(struct drm_device *dev)
> >  
> >  static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
> >  {
> > -	struct drm_i915_private *dev_priv = data;
> > -	struct intel_fbdev *ifbdev = dev_priv->fbdev;
> > +	struct intel_fbdev *ifbdev = data;
> > +
> > +	ifbdev->cookie = 0;
> 
> Hm, why are you setting this to 0 here? IIUC the effect is that
> async_synchronize_cookie() will wait until intel_fbdev_initial_config()
> has been *entered*, but isn't the desired effect that it has *finished*?

True, it's also an unserialised write. Premature optimisation to not
block the teardown waiting for the out-of-order completion of earlier
tasks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v3] drm/i915/fbdev: Limit the global async-domain synchronization
  2016-05-18  8:06 [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
                   ` (2 preceding siblings ...)
  2016-05-19 10:11 ` ✓ Ro.CI.BAT: success for drm/i915/fbdev: Limit the global async-domain synchronization (rev2) Patchwork
@ 2016-05-20 10:43 ` Chris Wilson
  2016-05-20 11:41 ` ✗ Ro.CI.BAT: failure for drm/i915/fbdev: Limit the global async-domain synchronization (rev3) Patchwork
  4 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2016-05-20 10:43 UTC (permalink / raw)
  To: intel-gfx

During cleanup we have to synchronise with the async task we are using
to initialise and register our fbdev. Currently, we are using a full
synchronisation on the global domain, but we can restrict this to just
synchronising up to our task if we remember our cookie.

v2: async_synchronize_cookie() takes an exclusive upper bound, to
synchronize with our task we have to pass in the next cookie.
v3: Drop premature disregarding of the active cookie (we need to wait
until the task is complete before continuing in the teardown).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lukas Wunner <lukas@wunner.de>
---
 drivers/gpu/drm/i915/intel_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_fbdev.c | 29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 0741b2d3aa65..68751aee52cc 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -159,6 +159,7 @@ struct intel_framebuffer {
 struct intel_fbdev {
 	struct drm_fb_helper helper;
 	struct intel_framebuffer *fb;
+	async_cookie_t cookie;
 	int preferred_bpp;
 };
 
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 99e27530e264..bfb2fd291e4e 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -538,8 +538,7 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 	.fb_probe = intelfb_create,
 };
 
-static void intel_fbdev_destroy(struct drm_device *dev,
-				struct intel_fbdev *ifbdev)
+static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 {
 	/* We rely on the object-free to release the VMA pinning for
 	 * the info->screen_base mmaping. Leaking the VMA is simpler than
@@ -554,12 +553,14 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 	if (ifbdev->fb) {
 		drm_framebuffer_unregister_private(&ifbdev->fb->base);
 
-		mutex_lock(&dev->struct_mutex);
+		mutex_lock(&ifbdev->helper.dev->struct_mutex);
 		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
-		mutex_unlock(&dev->struct_mutex);
+		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
 
 		drm_framebuffer_remove(&ifbdev->fb->base);
 	}
+
+	kfree(ifbdev);
 }
 
 /*
@@ -736,32 +737,34 @@ int intel_fbdev_init(struct drm_device *dev)
 
 static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
 {
-	struct drm_i915_private *dev_priv = data;
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = data;
 
 	/* Due to peculiar init order wrt to hpd handling this is separate. */
 	if (drm_fb_helper_initial_config(&ifbdev->helper,
 					 ifbdev->preferred_bpp))
-		intel_fbdev_fini(dev_priv->dev);
+		intel_fbdev_fini(ifbdev->helper.dev);
 }
 
 void intel_fbdev_initial_config_async(struct drm_device *dev)
 {
-	async_schedule(intel_fbdev_initial_config, to_i915(dev));
+	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+
+	ifbdev->cookie = async_schedule(intel_fbdev_initial_config, ifbdev);
 }
 
 void intel_fbdev_fini(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	if (!dev_priv->fbdev)
+	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+
+	if (!ifbdev)
 		return;
 
 	flush_work(&dev_priv->fbdev_suspend_work);
+	if (ifbdev->cookie && !current_is_async())
+		async_synchronize_cookie(ifbdev->cookie + 1);
 
-	if (!current_is_async())
-		async_synchronize_full();
-	intel_fbdev_destroy(dev, dev_priv->fbdev);
-	kfree(dev_priv->fbdev);
+	intel_fbdev_destroy(ifbdev);
 	dev_priv->fbdev = NULL;
 }
 
-- 
2.8.1

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

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

* ✗ Ro.CI.BAT: failure for drm/i915/fbdev: Limit the global async-domain synchronization (rev3)
  2016-05-18  8:06 [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
                   ` (3 preceding siblings ...)
  2016-05-20 10:43 ` [PATCH v3] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
@ 2016-05-20 11:41 ` Patchwork
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2016-05-20 11:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/fbdev: Limit the global async-domain synchronization (rev3)
URL   : https://patchwork.freedesktop.org/series/7332/
State : failure

== Summary ==

Series 7332v3 drm/i915/fbdev: Limit the global async-domain synchronization
http://patchwork.freedesktop.org/api/1.0/series/7332/revisions/3/mbox

Test drv_module_reload_basic:
                dmesg-warn -> PASS       (ro-bdw-i7-5600u)
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> FAIL       (ro-byt-n2820)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (ro-ivb-i7-3770)
                pass       -> INCOMPLETE (fi-hsw-i7-4770k)

fi-bdw-i7-5557u  total:217  pass:204  dwarn:0   dfail:0   fail:0   skip:13 
fi-hsw-i7-4770k  total:198  pass:177  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-i7-4770r  total:217  pass:191  dwarn:0   dfail:0   fail:0   skip:26 
fi-skl-i7-6700k  total:217  pass:189  dwarn:0   dfail:0   fail:0   skip:28 
ro-bdw-i5-5250u  total:217  pass:179  dwarn:0   dfail:0   fail:0   skip:38 
ro-bdw-i7-5557U  total:217  pass:204  dwarn:0   dfail:0   fail:0   skip:13 
ro-bdw-i7-5600u  total:217  pass:185  dwarn:0   dfail:0   fail:1   skip:31 
ro-bsw-n3050     total:217  pass:172  dwarn:0   dfail:0   fail:3   skip:42 
ro-byt-n2820     total:216  pass:171  dwarn:0   dfail:0   fail:4   skip:41 
ro-hsw-i3-4010u  total:216  pass:191  dwarn:0   dfail:0   fail:0   skip:25 
ro-hsw-i7-4770r  total:217  pass:191  dwarn:0   dfail:0   fail:0   skip:26 
ro-ilk-i7-620lm  total:217  pass:149  dwarn:0   dfail:0   fail:1   skip:67 
ro-ilk1-i5-650   total:212  pass:150  dwarn:0   dfail:0   fail:1   skip:61 
ro-ivb-i7-3770   total:217  pass:181  dwarn:0   dfail:0   fail:0   skip:36 
ro-ivb2-i7-3770  total:217  pass:185  dwarn:0   dfail:0   fail:0   skip:32 
ro-skl-i7-6700hq total:212  pass:188  dwarn:0   dfail:0   fail:0   skip:24 
ro-snb-i7-2620M  total:217  pass:175  dwarn:0   dfail:0   fail:1   skip:41 
fi-bsw-n3050 failed to connect after reboot
fi-byt-n2820 failed to connect after reboot
fi-snb-i7-2600 failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_949/

9d15199 drm-intel-nightly: 2016y-05m-20d-07h-54m-59s UTC integration manifest
1d7f750 drm/i915/fbdev: Limit the global async-domain synchronization

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

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

end of thread, other threads:[~2016-05-20 11:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18  8:06 [PATCH] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
2016-05-18  8:35 ` ✗ Ro.CI.BAT: warning for " Patchwork
2016-05-19  8:28 ` [PATCH v2] " Chris Wilson
2016-05-19 20:14   ` Lukas Wunner
2016-05-20  8:17     ` Chris Wilson
2016-05-19 10:11 ` ✓ Ro.CI.BAT: success for drm/i915/fbdev: Limit the global async-domain synchronization (rev2) Patchwork
2016-05-20 10:43 ` [PATCH v3] drm/i915/fbdev: Limit the global async-domain synchronization Chris Wilson
2016-05-20 11:41 ` ✗ Ro.CI.BAT: failure for drm/i915/fbdev: Limit the global async-domain synchronization (rev3) Patchwork

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.