diff mbox

Revert "drm: Resurrect atomic rmfb code"

Message ID 1468502194-17029-1-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter July 14, 2016, 1:16 p.m. UTC
This reverts commit 11c21e73f848844d439cbccb42a1018b8c560e5c.

For reasons totally unclear this manages to wreak havoc with the audio
rpm refcount:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 215 at drivers/gpu/drm/i915/intel_runtime_pm.c:1729 intel_display_power_put+0xe8/0x100 [i915]
Use count on domain AUDIO is already zero
Modules linked in: i915 ax88179_178a usbnet mii snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec x86_pkg_temp_thermal snd_hwdep intel_powerclamp snd_hda_core co
f_pclmul crc32_pclmul snd_pcm ghash_clmulni_intel mei_me mei e1000e ptp pps_core i2c_hid [last unloaded: i915]
CPU: 0 PID: 215 Comm: kworker/0:2 Not tainted 4.7.0-rc6+ #44
Hardware name: Intel Corporation Skylake Client platform/Skylake Halo DDR4 RVP11, BIOS SKLSE2R1.R00.X106.B00.1601180206 01/18/2016
Workqueue: events output_poll_execute
 0000000000000000 ffff88045573fa38 ffffffff813a2d6b ffff88045573fa88
 0000000000000000 ffff88045573fa78 ffffffff81075db6 000006c15a590000
 ffff88045a59a238 ffff88045a590054 ffff88045a590000 ffff88045a590000
Call Trace:
 [<ffffffff813a2d6b>] dump_stack+0x4d/0x72
 [<ffffffff81075db6>] __warn+0xc6/0xe0
 [<ffffffff81075e1a>] warn_slowpath_fmt+0x4a/0x50
 [<ffffffffa046399d>] ? hsw_audio_codec_disable+0xdd/0x110 [i915]
 [<ffffffffa041e638>] intel_display_power_put+0xe8/0x100 [i915]
 [<ffffffffa049d776>] intel_disable_ddi+0x46/0x80 [i915]
 [<ffffffffa0474eef>] haswell_crtc_disable+0x16f/0x290 [i915]
 [<ffffffffa047cb53>] intel_atomic_commit_tail+0x153/0x10e0 [i915]
 [<ffffffff814aa020>] ? drm_atomic_helper_swap_state+0x140/0x2d0
 [<ffffffffa047dedd>] intel_atomic_commit+0x3fd/0x520 [i915]
 [<ffffffff814d0252>] ? drm_atomic_add_affected_connectors+0x22/0xf0
 [<ffffffff814cf8a2>] drm_atomic_commit+0x32/0x50
 [<ffffffff814aed07>] restore_fbdev_mode+0x147/0x260
 [<ffffffff814b026e>] drm_fb_helper_restore_fbdev_mode_unlocked+0x2e/0x70
 [<ffffffff814b02d8>] drm_fb_helper_set_par+0x28/0x50
 [<ffffffff814b0203>] drm_fb_helper_hotplug_event+0x143/0x180
 [<ffffffffa0498ab5>] intel_fbdev_output_poll_changed+0x15/0x20 [i915]
 [<ffffffff814a1f92>] drm_kms_helper_hotplug_event+0x22/0x30
 [<ffffffff814a2172>] output_poll_execute+0x192/0x1e0
 [<ffffffff8108cf7c>] process_one_work+0x14c/0x480
 [<ffffffff8108d4fa>] worker_thread+0x24a/0x4e0
 [<ffffffff8108d2b0>] ? process_one_work+0x480/0x480
 [<ffffffff8108d2b0>] ? process_one_work+0x480/0x480
 [<ffffffff81092904>] kthread+0xc4/0xe0
 [<ffffffff8173013f>] ret_from_fork+0x1f/0x40
 [<ffffffff81092840>] ? kthread_worker_fn+0x180/0x180
---[ end trace 2d440da5f0c053e4 ]---

Instead of scratching heads too much while CI is down, let's revert
before more trouble is caused.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reported-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Mika Kuoppala <mika.kuoppala@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_atomic.c        | 66 -------------------------------------
 drivers/gpu/drm/drm_crtc.c          |  6 ----
 drivers/gpu/drm/drm_crtc_internal.h |  1 -
 3 files changed, 73 deletions(-)

Comments

Daniel Vetter July 14, 2016, 1:20 p.m. UTC | #1
On Thu, Jul 14, 2016 at 03:16:34PM +0200, Daniel Vetter wrote:
> This reverts commit 11c21e73f848844d439cbccb42a1018b8c560e5c.
> 
> For reasons totally unclear this manages to wreak havoc with the audio
> rpm refcount:
> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 215 at drivers/gpu/drm/i915/intel_runtime_pm.c:1729 intel_display_power_put+0xe8/0x100 [i915]
> Use count on domain AUDIO is already zero
> Modules linked in: i915 ax88179_178a usbnet mii snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec x86_pkg_temp_thermal snd_hwdep intel_powerclamp snd_hda_core co
> f_pclmul crc32_pclmul snd_pcm ghash_clmulni_intel mei_me mei e1000e ptp pps_core i2c_hid [last unloaded: i915]
> CPU: 0 PID: 215 Comm: kworker/0:2 Not tainted 4.7.0-rc6+ #44
> Hardware name: Intel Corporation Skylake Client platform/Skylake Halo DDR4 RVP11, BIOS SKLSE2R1.R00.X106.B00.1601180206 01/18/2016
> Workqueue: events output_poll_execute
>  0000000000000000 ffff88045573fa38 ffffffff813a2d6b ffff88045573fa88
>  0000000000000000 ffff88045573fa78 ffffffff81075db6 000006c15a590000
>  ffff88045a59a238 ffff88045a590054 ffff88045a590000 ffff88045a590000
> Call Trace:
>  [<ffffffff813a2d6b>] dump_stack+0x4d/0x72
>  [<ffffffff81075db6>] __warn+0xc6/0xe0
>  [<ffffffff81075e1a>] warn_slowpath_fmt+0x4a/0x50
>  [<ffffffffa046399d>] ? hsw_audio_codec_disable+0xdd/0x110 [i915]
>  [<ffffffffa041e638>] intel_display_power_put+0xe8/0x100 [i915]
>  [<ffffffffa049d776>] intel_disable_ddi+0x46/0x80 [i915]
>  [<ffffffffa0474eef>] haswell_crtc_disable+0x16f/0x290 [i915]
>  [<ffffffffa047cb53>] intel_atomic_commit_tail+0x153/0x10e0 [i915]
>  [<ffffffff814aa020>] ? drm_atomic_helper_swap_state+0x140/0x2d0
>  [<ffffffffa047dedd>] intel_atomic_commit+0x3fd/0x520 [i915]
>  [<ffffffff814d0252>] ? drm_atomic_add_affected_connectors+0x22/0xf0
>  [<ffffffff814cf8a2>] drm_atomic_commit+0x32/0x50
>  [<ffffffff814aed07>] restore_fbdev_mode+0x147/0x260
>  [<ffffffff814b026e>] drm_fb_helper_restore_fbdev_mode_unlocked+0x2e/0x70
>  [<ffffffff814b02d8>] drm_fb_helper_set_par+0x28/0x50
>  [<ffffffff814b0203>] drm_fb_helper_hotplug_event+0x143/0x180
>  [<ffffffffa0498ab5>] intel_fbdev_output_poll_changed+0x15/0x20 [i915]
>  [<ffffffff814a1f92>] drm_kms_helper_hotplug_event+0x22/0x30
>  [<ffffffff814a2172>] output_poll_execute+0x192/0x1e0
>  [<ffffffff8108cf7c>] process_one_work+0x14c/0x480
>  [<ffffffff8108d4fa>] worker_thread+0x24a/0x4e0
>  [<ffffffff8108d2b0>] ? process_one_work+0x480/0x480
>  [<ffffffff8108d2b0>] ? process_one_work+0x480/0x480
>  [<ffffffff81092904>] kthread+0xc4/0xe0
>  [<ffffffff8173013f>] ret_from_fork+0x1f/0x40
>  [<ffffffff81092840>] ? kthread_worker_fn+0x180/0x180
> ---[ end trace 2d440da5f0c053e4 ]---
> 
> Instead of scratching heads too much while CI is down, let's revert
> before more trouble is caused.
> 
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reported-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Acked-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

... and applied.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic.c        | 66 -------------------------------------
>  drivers/gpu/drm/drm_crtc.c          |  6 ----
>  drivers/gpu/drm/drm_crtc_internal.h |  1 -
>  3 files changed, 73 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 34cdbe154540..6712278c73f0 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1590,72 +1590,6 @@ void drm_atomic_clean_old_fb(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_atomic_clean_old_fb);
>  
> -int drm_atomic_remove_fb(struct drm_framebuffer *fb)
> -{
> -	struct drm_modeset_acquire_ctx ctx;
> -	struct drm_device *dev = fb->dev;
> -	struct drm_atomic_state *state;
> -	struct drm_plane *plane;
> -	int ret = 0;
> -	unsigned plane_mask;
> -
> -	state = drm_atomic_state_alloc(dev);
> -	if (!state)
> -		return -ENOMEM;
> -
> -	drm_modeset_acquire_init(&ctx, 0);
> -	state->acquire_ctx = &ctx;
> -
> -retry:
> -	plane_mask = 0;
> -	ret = drm_modeset_lock_all_ctx(dev, &ctx);
> -	if (ret)
> -		goto unlock;
> -
> -	drm_for_each_plane(plane, dev) {
> -		struct drm_plane_state *plane_state;
> -
> -		if (plane->state->fb != fb)
> -			continue;
> -
> -		plane_state = drm_atomic_get_plane_state(state, plane);
> -		if (IS_ERR(plane_state)) {
> -			ret = PTR_ERR(plane_state);
> -			goto unlock;
> -		}
> -
> -		drm_atomic_set_fb_for_plane(plane_state, NULL);
> -		ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
> -		if (ret)
> -			goto unlock;
> -
> -		plane_mask |= BIT(drm_plane_index(plane));
> -
> -		plane->old_fb = plane->fb;
> -		plane->fb = NULL;
> -	}
> -
> -	if (plane_mask)
> -		ret = drm_atomic_commit(state);
> -
> -unlock:
> -	if (plane_mask)
> -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
> -	if (ret == -EDEADLK) {
> -		drm_modeset_backoff(&ctx);
> -		goto retry;
> -	}
> -
> -	if (ret || !plane_mask)
> -		drm_atomic_state_free(state);
> -
> -	drm_modeset_drop_locks(&ctx);
> -	drm_modeset_acquire_fini(&ctx);
> -
> -	return ret;
> -}
> -
>  int drm_mode_atomic_ioctl(struct drm_device *dev,
>  			  void *data, struct drm_file *file_priv)
>  {
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 1b7d31186f25..0098d5e6921a 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -616,11 +616,6 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
>  	 * in this manner.
>  	 */
>  	if (drm_framebuffer_read_refcount(fb) > 1) {
> -		if (dev->mode_config.funcs->atomic_commit) {
> -			drm_atomic_remove_fb(fb);
> -			goto out;
> -		}
> -
>  		drm_modeset_lock_all(dev);
>  		/* remove from any CRTC */
>  		drm_for_each_crtc(crtc, dev) {
> @@ -638,7 +633,6 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
>  		drm_modeset_unlock_all(dev);
>  	}
>  
> -out:
>  	drm_framebuffer_unreference(fb);
>  }
>  EXPORT_SYMBOL(drm_framebuffer_remove);
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
> index b248e2238a05..47a500b90fd7 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -125,7 +125,6 @@ int drm_atomic_get_property(struct drm_mode_object *obj,
>  			    struct drm_property *property, uint64_t *val);
>  int drm_mode_atomic_ioctl(struct drm_device *dev,
>  			  void *data, struct drm_file *file_priv);
> -int drm_atomic_remove_fb(struct drm_framebuffer *fb);
>  
>  int drm_modeset_register_all(struct drm_device *dev);
>  void drm_modeset_unregister_all(struct drm_device *dev);
> -- 
> 2.8.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 34cdbe154540..6712278c73f0 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1590,72 +1590,6 @@  void drm_atomic_clean_old_fb(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_atomic_clean_old_fb);
 
-int drm_atomic_remove_fb(struct drm_framebuffer *fb)
-{
-	struct drm_modeset_acquire_ctx ctx;
-	struct drm_device *dev = fb->dev;
-	struct drm_atomic_state *state;
-	struct drm_plane *plane;
-	int ret = 0;
-	unsigned plane_mask;
-
-	state = drm_atomic_state_alloc(dev);
-	if (!state)
-		return -ENOMEM;
-
-	drm_modeset_acquire_init(&ctx, 0);
-	state->acquire_ctx = &ctx;
-
-retry:
-	plane_mask = 0;
-	ret = drm_modeset_lock_all_ctx(dev, &ctx);
-	if (ret)
-		goto unlock;
-
-	drm_for_each_plane(plane, dev) {
-		struct drm_plane_state *plane_state;
-
-		if (plane->state->fb != fb)
-			continue;
-
-		plane_state = drm_atomic_get_plane_state(state, plane);
-		if (IS_ERR(plane_state)) {
-			ret = PTR_ERR(plane_state);
-			goto unlock;
-		}
-
-		drm_atomic_set_fb_for_plane(plane_state, NULL);
-		ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
-		if (ret)
-			goto unlock;
-
-		plane_mask |= BIT(drm_plane_index(plane));
-
-		plane->old_fb = plane->fb;
-		plane->fb = NULL;
-	}
-
-	if (plane_mask)
-		ret = drm_atomic_commit(state);
-
-unlock:
-	if (plane_mask)
-		drm_atomic_clean_old_fb(dev, plane_mask, ret);
-
-	if (ret == -EDEADLK) {
-		drm_modeset_backoff(&ctx);
-		goto retry;
-	}
-
-	if (ret || !plane_mask)
-		drm_atomic_state_free(state);
-
-	drm_modeset_drop_locks(&ctx);
-	drm_modeset_acquire_fini(&ctx);
-
-	return ret;
-}
-
 int drm_mode_atomic_ioctl(struct drm_device *dev,
 			  void *data, struct drm_file *file_priv)
 {
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 1b7d31186f25..0098d5e6921a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -616,11 +616,6 @@  void drm_framebuffer_remove(struct drm_framebuffer *fb)
 	 * in this manner.
 	 */
 	if (drm_framebuffer_read_refcount(fb) > 1) {
-		if (dev->mode_config.funcs->atomic_commit) {
-			drm_atomic_remove_fb(fb);
-			goto out;
-		}
-
 		drm_modeset_lock_all(dev);
 		/* remove from any CRTC */
 		drm_for_each_crtc(crtc, dev) {
@@ -638,7 +633,6 @@  void drm_framebuffer_remove(struct drm_framebuffer *fb)
 		drm_modeset_unlock_all(dev);
 	}
 
-out:
 	drm_framebuffer_unreference(fb);
 }
 EXPORT_SYMBOL(drm_framebuffer_remove);
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
index b248e2238a05..47a500b90fd7 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -125,7 +125,6 @@  int drm_atomic_get_property(struct drm_mode_object *obj,
 			    struct drm_property *property, uint64_t *val);
 int drm_mode_atomic_ioctl(struct drm_device *dev,
 			  void *data, struct drm_file *file_priv);
-int drm_atomic_remove_fb(struct drm_framebuffer *fb);
 
 int drm_modeset_register_all(struct drm_device *dev);
 void drm_modeset_unregister_all(struct drm_device *dev);