All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
@ 2018-10-15 11:17 Chris Wilson
  2018-10-15 11:17 ` [PATCH 2/4] drm/i915/fbdev: Use i915/drm_i915_private consistently Chris Wilson
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Chris Wilson @ 2018-10-15 11:17 UTC (permalink / raw)
  To: intel-gfx

We try to avoid a deadlock of synchronizing the async fbdev task by
skipping the synchronisation from the async worker, but that prevents us
from using an async worker for the device probe. As we have our own
barrier and do not rely on the global async flush, we can simply replace
the async task with an explicit worker.

References: 366e39b4d2c5 ("drm/i915: Tear down fbdev if initialization fails")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_drv.h   |  3 +--
 drivers/gpu/drm/i915/intel_fbdev.c | 35 +++++++++++++++---------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3dea7a1bda7f..15bbf604724d 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -25,7 +25,6 @@
 #ifndef __INTEL_DRV_H__
 #define __INTEL_DRV_H__
 
-#include <linux/async.h>
 #include <linux/i2c.h>
 #include <linux/hdmi.h>
 #include <linux/sched/clock.h>
@@ -207,8 +206,8 @@ struct intel_fbdev {
 	struct intel_framebuffer *fb;
 	struct i915_vma *vma;
 	unsigned long vma_flags;
-	async_cookie_t cookie;
 	int preferred_bpp;
+	struct work_struct work;
 };
 
 struct intel_encoder {
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 2480c7d6edee..265cc947aede 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -24,7 +24,6 @@
  *     David Airlie
  */
 
-#include <linux/async.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/console.h>
@@ -666,6 +665,16 @@ static void intel_fbdev_suspend_worker(struct work_struct *work)
 				true);
 }
 
+static void intel_fbdev_initial_config(struct work_struct *work)
+{
+	struct intel_fbdev *ifbdev = container_of(work, typeof(*ifbdev), work);
+
+	/* 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_unregister(to_i915(ifbdev->helper.dev));
+}
+
 int intel_fbdev_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
@@ -679,6 +688,8 @@ int intel_fbdev_init(struct drm_device *dev)
 	if (ifbdev == NULL)
 		return -ENOMEM;
 
+	INIT_WORK(&ifbdev->work, intel_fbdev_initial_config);
+
 	drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs);
 
 	if (!intel_fbdev_init_bios(dev, ifbdev))
@@ -698,16 +709,6 @@ int intel_fbdev_init(struct drm_device *dev)
 	return 0;
 }
 
-static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
-{
-	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_unregister(to_i915(ifbdev->helper.dev));
-}
-
 void intel_fbdev_initial_config_async(struct drm_device *dev)
 {
 	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
@@ -715,17 +716,16 @@ void intel_fbdev_initial_config_async(struct drm_device *dev)
 	if (!ifbdev)
 		return;
 
-	ifbdev->cookie = async_schedule(intel_fbdev_initial_config, ifbdev);
+	schedule_work(&ifbdev->work);
 }
 
 static void intel_fbdev_sync(struct intel_fbdev *ifbdev)
 {
-	if (!ifbdev->cookie)
+	if (!READ_ONCE(ifbdev->work.func))
 		return;
 
-	/* Only serialises with all preceding async calls, hence +1 */
-	async_synchronize_cookie(ifbdev->cookie + 1);
-	ifbdev->cookie = 0;
+	flush_work(&ifbdev->work);
+	ifbdev->work.func = NULL;
 }
 
 void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
@@ -736,8 +736,7 @@ void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
 		return;
 
 	cancel_work_sync(&dev_priv->fbdev_suspend_work);
-	if (!current_is_async())
-		intel_fbdev_sync(ifbdev);
+	intel_fbdev_sync(ifbdev);
 
 	drm_fb_helper_unregister_fbi(&ifbdev->helper);
 }
-- 
2.19.1

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

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

* [PATCH 2/4] drm/i915/fbdev: Use i915/drm_i915_private consistently
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
@ 2018-10-15 11:17 ` Chris Wilson
  2018-10-15 11:17 ` [PATCH 3/4] drm/i915: Disable displays at the user's request Chris Wilson
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2018-10-15 11:17 UTC (permalink / raw)
  To: intel-gfx

Convert the interface (except for the drm core callback) to accept
drm_i915_private as that is our native type of the majority of
operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c    |  10 +--
 drivers/gpu/drm/i915/intel_drv.h   |  28 +++----
 drivers/gpu/drm/i915/intel_fbdev.c | 117 ++++++++++++++---------------
 3 files changed, 77 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index baac35f698f9..c14855f167b9 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -692,7 +692,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 	if (INTEL_INFO(dev_priv)->num_pipes == 0)
 		return 0;
 
-	ret = intel_fbdev_init(dev);
+	ret = intel_fbdev_init(dev_priv);
 	if (ret)
 		goto cleanup_gem;
 
@@ -1559,7 +1559,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 	 * irqs are fully enabled. We do it last so that the async config
 	 * cannot run before the connectors are registered.
 	 */
-	intel_fbdev_initial_config_async(dev);
+	intel_fbdev_initial_config_async(dev_priv);
 
 	/*
 	 * We need to coordinate the hotplugs with the asynchronous fbdev
@@ -1828,7 +1828,7 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
  */
 static void i915_driver_lastclose(struct drm_device *dev)
 {
-	intel_fbdev_restore_mode(dev);
+	intel_fbdev_restore_mode(to_i915(dev));
 	vga_switcheroo_process_delayed_switch();
 }
 
@@ -1924,7 +1924,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 
 	intel_opregion_unregister(dev_priv);
 
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
+	intel_fbdev_set_suspend(dev_priv, FBINFO_STATE_SUSPENDED, true);
 
 	dev_priv->suspend_count++;
 
@@ -2085,7 +2085,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_opregion_register(dev_priv);
 
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
+	intel_fbdev_set_suspend(dev_priv, FBINFO_STATE_RUNNING, false);
 
 	intel_opregion_notify_adapter(dev_priv, PCI_D0);
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 15bbf604724d..21a454d3a659 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1787,32 +1787,34 @@ bool intel_encoder_hotplug(struct intel_encoder *encoder,
 
 /* legacy fbdev emulation in intel_fbdev.c */
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-extern int intel_fbdev_init(struct drm_device *dev);
-extern void intel_fbdev_initial_config_async(struct drm_device *dev);
-extern void intel_fbdev_unregister(struct drm_i915_private *dev_priv);
-extern void intel_fbdev_fini(struct drm_i915_private *dev_priv);
-extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
-extern void intel_fbdev_output_poll_changed(struct drm_device *dev);
-extern void intel_fbdev_restore_mode(struct drm_device *dev);
+int intel_fbdev_init(struct drm_i915_private *i915);
+void intel_fbdev_initial_config_async(struct drm_i915_private *i915);
+void intel_fbdev_unregister(struct drm_i915_private *i915);
+void intel_fbdev_fini(struct drm_i915_private *i915);
+void intel_fbdev_set_suspend(struct drm_i915_private *i915,
+			     int state, bool synchronous);
+void intel_fbdev_restore_mode(struct drm_i915_private *i915);
+void intel_fbdev_output_poll_changed(struct drm_device *dev);
 #else
-static inline int intel_fbdev_init(struct drm_device *dev)
+static inline int intel_fbdev_init(struct drm_i915_private *i915)
 {
 	return 0;
 }
 
-static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
+static inline void intel_fbdev_initial_config_async(struct drm_i915_private *i915)
 {
 }
 
-static inline void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
+static inline void intel_fbdev_unregister(struct drm_i915_private *i915)
 {
 }
 
-static inline void intel_fbdev_fini(struct drm_i915_private *dev_priv)
+static inline void intel_fbdev_fini(struct drm_i915_private *i915)
 {
 }
 
-static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
+static inline void intel_fbdev_set_suspend(struct drm_i915_private *i915,
+					   int state, bool synchronous)
 {
 }
 
@@ -1820,7 +1822,7 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
 {
 }
 
-static inline void intel_fbdev_restore_mode(struct drm_device *dev)
+static inline void intel_fbdev_restore_mode(struct drm_i915_private *i915)
 {
 }
 #endif
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 265cc947aede..a75082813669 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -53,11 +53,14 @@ static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
 	intel_fb_obj_invalidate(obj, origin);
 }
 
+static struct intel_fbdev *info_to_fbdev(struct fb_info *info)
+{
+	return container_of(info->par, struct intel_fbdev, helper);
+}
+
 static int intel_fbdev_set_par(struct fb_info *info)
 {
-	struct drm_fb_helper *fb_helper = info->par;
-	struct intel_fbdev *ifbdev =
-		container_of(fb_helper, struct intel_fbdev, helper);
+	struct intel_fbdev *ifbdev = info_to_fbdev(info);
 	int ret;
 
 	ret = drm_fb_helper_set_par(info);
@@ -69,9 +72,7 @@ static int intel_fbdev_set_par(struct fb_info *info)
 
 static int intel_fbdev_blank(int blank, struct fb_info *info)
 {
-	struct drm_fb_helper *fb_helper = info->par;
-	struct intel_fbdev *ifbdev =
-		container_of(fb_helper, struct intel_fbdev, helper);
+	struct intel_fbdev *ifbdev = info_to_fbdev(info);
 	int ret;
 
 	ret = drm_fb_helper_blank(blank, info);
@@ -84,9 +85,7 @@ static int intel_fbdev_blank(int blank, struct fb_info *info)
 static int intel_fbdev_pan_display(struct fb_var_screeninfo *var,
 				   struct fb_info *info)
 {
-	struct drm_fb_helper *fb_helper = info->par;
-	struct intel_fbdev *ifbdev =
-		container_of(fb_helper, struct intel_fbdev, helper);
+	struct intel_fbdev *ifbdev = info_to_fbdev(info);
 	int ret;
 
 	ret = drm_fb_helper_pan_display(var, info);
@@ -112,11 +111,10 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
 {
 	struct intel_fbdev *ifbdev =
 		container_of(helper, struct intel_fbdev, helper);
-	struct drm_framebuffer *fb;
-	struct drm_device *dev = helper->dev;
-	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_i915_private *i915 = to_i915(helper->dev);
 	struct drm_mode_fb_cmd2 mode_cmd = {};
 	struct drm_i915_gem_object *obj;
+	struct drm_framebuffer *fb;
 	int size, ret;
 
 	/* we don't do packed 24bpp */
@@ -138,10 +136,10 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
 	 * important and we should probably use that space with FBC or other
 	 * features. */
 	obj = NULL;
-	if (size * 2 < dev_priv->stolen_usable_size)
-		obj = i915_gem_object_create_stolen(dev_priv, size);
+	if (size * 2 < i915->stolen_usable_size)
+		obj = i915_gem_object_create_stolen(i915, size);
 	if (obj == NULL)
-		obj = i915_gem_object_create(dev_priv, size);
+		obj = i915_gem_object_create(i915, size);
 	if (IS_ERR(obj)) {
 		DRM_ERROR("failed to allocate framebuffer\n");
 		ret = PTR_ERR(obj);
@@ -169,16 +167,14 @@ static int intelfb_create(struct drm_fb_helper *helper,
 {
 	struct intel_fbdev *ifbdev =
 		container_of(helper, struct intel_fbdev, helper);
+	struct drm_i915_private *i915 = to_i915(helper->dev);
 	struct intel_framebuffer *intel_fb = ifbdev->fb;
-	struct drm_device *dev = helper->dev;
-	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct pci_dev *pdev = dev_priv->drm.pdev;
-	struct i915_ggtt *ggtt = &dev_priv->ggtt;
+	struct i915_ggtt *ggtt = &i915->ggtt;
 	const struct i915_ggtt_view view = {
 		.type = I915_GGTT_VIEW_NORMAL,
 	};
-	struct fb_info *info;
 	struct drm_framebuffer *fb;
+	struct fb_info *info;
 	struct i915_vma *vma;
 	unsigned long flags = 0;
 	bool prealloc = false;
@@ -208,8 +204,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
 		sizes->fb_height = intel_fb->base.height;
 	}
 
-	mutex_lock(&dev->struct_mutex);
-	intel_runtime_pm_get(dev_priv);
+	mutex_lock(&i915->drm.struct_mutex);
+	intel_runtime_pm_get(i915);
 
 	/* Pin the GGTT vma for our access via info->screen_base.
 	 * This also validates that any existing fb inherited from the
@@ -241,10 +237,11 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	info->fbops = &intelfb_ops;
 
 	/* setup aperture base/size for vesafb takeover */
-	info->apertures->ranges[0].base = dev->mode_config.fb_base;
+	info->apertures->ranges[0].base = i915->drm.mode_config.fb_base;
 	info->apertures->ranges[0].size = ggtt->mappable_end;
 
-	info->fix.smem_start = dev->mode_config.fb_base + i915_ggtt_offset(vma);
+	info->fix.smem_start =
+		i915->drm.mode_config.fb_base + i915_ggtt_offset(vma);
 	info->fix.smem_len = vma->node.size;
 
 	vaddr = i915_vma_pin_iomap(vma);
@@ -276,16 +273,16 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	ifbdev->vma = vma;
 	ifbdev->vma_flags = flags;
 
-	intel_runtime_pm_put(dev_priv);
-	mutex_unlock(&dev->struct_mutex);
-	vga_switcheroo_client_fb_set(pdev, info);
+	intel_runtime_pm_put(i915);
+	mutex_unlock(&i915->drm.struct_mutex);
+	vga_switcheroo_client_fb_set(i915->drm.pdev, info);
 	return 0;
 
 out_unpin:
 	intel_unpin_fb_vma(vma, flags);
 out_unlock:
-	intel_runtime_pm_put(dev_priv);
-	mutex_unlock(&dev->struct_mutex);
+	intel_runtime_pm_put(i915);
+	mutex_unlock(&i915->drm.struct_mutex);
 	return ret;
 }
 
@@ -334,7 +331,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 				    struct drm_fb_offset *offsets,
 				    bool *enabled, int width, int height)
 {
-	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
+	struct drm_i915_private *i915 = to_i915(fb_helper->dev);
 	unsigned long conn_configured, conn_seq, mask;
 	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
 	int i, j;
@@ -483,7 +480,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	 * fbdev helper library.
 	 */
 	if (num_connectors_enabled != num_connectors_detected &&
-	    num_connectors_enabled < INTEL_INFO(dev_priv)->num_pipes) {
+	    num_connectors_enabled < INTEL_INFO(i915)->num_pipes) {
 		DRM_DEBUG_KMS("fallback: Not all outputs enabled\n");
 		DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled,
 			      num_connectors_detected);
@@ -539,7 +536,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
  * Note we only support a single fb shared across pipes for boot (mostly for
  * fbcon), so we just find the biggest and use that.
  */
-static bool intel_fbdev_init_bios(struct drm_device *dev,
+static bool intel_fbdev_init_bios(struct drm_i915_private *i915,
 				 struct intel_fbdev *ifbdev)
 {
 	struct intel_framebuffer *fb = NULL;
@@ -548,7 +545,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 	unsigned int max_size = 0;
 
 	/* Find the largest fb */
-	for_each_crtc(dev, crtc) {
+	for_each_crtc(&i915->drm, crtc) {
 		struct drm_i915_gem_object *obj =
 			intel_fb_obj(crtc->primary->state->fb);
 		intel_crtc = to_intel_crtc(crtc);
@@ -573,7 +570,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 	}
 
 	/* Now make sure all the pipes will fit into it */
-	for_each_crtc(dev, crtc) {
+	for_each_crtc(&i915->drm, crtc) {
 		unsigned int cur_size;
 
 		intel_crtc = to_intel_crtc(crtc);
@@ -636,7 +633,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 	drm_framebuffer_get(&ifbdev->fb->base);
 
 	/* Final pass to check if any active pipes don't have fbs */
-	for_each_crtc(dev, crtc) {
+	for_each_crtc(&i915->drm, crtc) {
 		intel_crtc = to_intel_crtc(crtc);
 
 		if (!crtc->state->active)
@@ -658,9 +655,9 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 
 static void intel_fbdev_suspend_worker(struct work_struct *work)
 {
-	intel_fbdev_set_suspend(&container_of(work,
-					      struct drm_i915_private,
-					      fbdev_suspend_work)->drm,
+	intel_fbdev_set_suspend(container_of(work,
+					     struct drm_i915_private,
+					     fbdev_suspend_work),
 				FBINFO_STATE_RUNNING,
 				true);
 }
@@ -675,13 +672,12 @@ static void intel_fbdev_initial_config(struct work_struct *work)
 		intel_fbdev_unregister(to_i915(ifbdev->helper.dev));
 }
 
-int intel_fbdev_init(struct drm_device *dev)
+int intel_fbdev_init(struct drm_i915_private *i915)
 {
-	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_fbdev *ifbdev;
 	int ret;
 
-	if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0))
+	if (WARN_ON(INTEL_INFO(i915)->num_pipes == 0))
 		return -ENODEV;
 
 	ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
@@ -690,28 +686,29 @@ int intel_fbdev_init(struct drm_device *dev)
 
 	INIT_WORK(&ifbdev->work, intel_fbdev_initial_config);
 
-	drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs);
+	drm_fb_helper_prepare(&i915->drm,
+			      &ifbdev->helper, &intel_fb_helper_funcs);
 
-	if (!intel_fbdev_init_bios(dev, ifbdev))
+	if (!intel_fbdev_init_bios(i915, ifbdev))
 		ifbdev->preferred_bpp = 32;
 
-	ret = drm_fb_helper_init(dev, &ifbdev->helper, 4);
+	ret = drm_fb_helper_init(&i915->drm, &ifbdev->helper, 4);
 	if (ret) {
 		kfree(ifbdev);
 		return ret;
 	}
 
-	dev_priv->fbdev = ifbdev;
-	INIT_WORK(&dev_priv->fbdev_suspend_work, intel_fbdev_suspend_worker);
+	i915->fbdev = ifbdev;
+	INIT_WORK(&i915->fbdev_suspend_work, intel_fbdev_suspend_worker);
 
 	drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
 
 	return 0;
 }
 
-void intel_fbdev_initial_config_async(struct drm_device *dev)
+void intel_fbdev_initial_config_async(struct drm_i915_private *i915)
 {
-	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+	struct intel_fbdev *ifbdev = i915->fbdev;
 
 	if (!ifbdev)
 		return;
@@ -728,22 +725,22 @@ static void intel_fbdev_sync(struct intel_fbdev *ifbdev)
 	ifbdev->work.func = NULL;
 }
 
-void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
+void intel_fbdev_unregister(struct drm_i915_private *i915)
 {
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = i915->fbdev;
 
 	if (!ifbdev)
 		return;
 
-	cancel_work_sync(&dev_priv->fbdev_suspend_work);
+	cancel_work_sync(&i915->fbdev_suspend_work);
 	intel_fbdev_sync(ifbdev);
 
 	drm_fb_helper_unregister_fbi(&ifbdev->helper);
 }
 
-void intel_fbdev_fini(struct drm_i915_private *dev_priv)
+void intel_fbdev_fini(struct drm_i915_private *i915)
 {
-	struct intel_fbdev *ifbdev = fetch_and_zero(&dev_priv->fbdev);
+	struct intel_fbdev *ifbdev = fetch_and_zero(&i915->fbdev);
 
 	if (!ifbdev)
 		return;
@@ -751,10 +748,10 @@ void intel_fbdev_fini(struct drm_i915_private *dev_priv)
 	intel_fbdev_destroy(ifbdev);
 }
 
-void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
+void intel_fbdev_set_suspend(struct drm_i915_private *i915,
+			     int state, bool synchronous)
 {
-	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = i915->fbdev;
 	struct fb_info *info;
 
 	if (!ifbdev || !ifbdev->vma)
@@ -771,7 +768,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
 		 * ourselves, so only flush outstanding work upon suspend!
 		 */
 		if (state != FBINFO_STATE_RUNNING)
-			flush_work(&dev_priv->fbdev_suspend_work);
+			flush_work(&i915->fbdev_suspend_work);
 		console_lock();
 	} else {
 		/*
@@ -784,7 +781,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
 			/* Don't block our own workqueue as this can
 			 * be run in parallel with other i915.ko tasks.
 			 */
-			schedule_work(&dev_priv->fbdev_suspend_work);
+			schedule_work(&i915->fbdev_suspend_work);
 			return;
 		}
 	}
@@ -813,9 +810,9 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
 		drm_fb_helper_hotplug_event(&ifbdev->helper);
 }
 
-void intel_fbdev_restore_mode(struct drm_device *dev)
+void intel_fbdev_restore_mode(struct drm_i915_private *i915)
 {
-	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+	struct intel_fbdev *ifbdev = i915->fbdev;
 
 	if (!ifbdev)
 		return;
-- 
2.19.1

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

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

* [PATCH 3/4] drm/i915: Disable displays at the user's request
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
  2018-10-15 11:17 ` [PATCH 2/4] drm/i915/fbdev: Use i915/drm_i915_private consistently Chris Wilson
@ 2018-10-15 11:17 ` Chris Wilson
  2018-10-19  8:22   ` Daniel Vetter
  2018-10-15 11:17 ` [PATCH 4/4] HAX: force i915.disable_display=1 Chris Wilson
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2018-10-15 11:17 UTC (permalink / raw)
  To: intel-gfx

If the user passes i915.disable_display=1 we want to disable all the
displays and associated HW like the powerwells on their behalf. Instead
of short circuiting the HW probe, let it run and setup all the
bookkeeping for the known HW. Afterwards, instead of taking over the
BIOS fb and installing the fbcon, we shutdown all the outputs and
teardown the bookkeeping, leaving us with no attached outputs or crtcs,
and all the HW powered down.

Open: wq flushes should be required but seem to deadlock the modprobe
under CI.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c          | 53 +++++++++++++++++-------
 drivers/gpu/drm/i915/intel_device_info.c |  9 ++--
 drivers/gpu/drm/i915/intel_fbdev.c       |  2 +-
 3 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index c14855f167b9..d71add64948b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -689,22 +689,8 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
 	intel_setup_overlay(dev_priv);
 
-	if (INTEL_INFO(dev_priv)->num_pipes == 0)
-		return 0;
-
-	ret = intel_fbdev_init(dev_priv);
-	if (ret)
-		goto cleanup_gem;
-
-	/* Only enable hotplug handling once the fbdev is fully set up. */
-	intel_hpd_init(dev_priv);
-
 	return 0;
 
-cleanup_gem:
-	if (i915_gem_suspend(dev_priv))
-		DRM_ERROR("failed to idle hardware; continuing to unload!\n");
-	i915_gem_fini(dev_priv);
 cleanup_modeset:
 	intel_modeset_cleanup(dev);
 cleanup_irq:
@@ -1667,6 +1653,17 @@ static void i915_driver_destroy(struct drm_i915_private *i915)
 	pci_set_drvdata(pdev, NULL);
 }
 
+static void disable_display(struct drm_i915_private *i915)
+{
+	drm_atomic_helper_shutdown(&i915->drm);
+
+#if 0 /* XXX flushes deadlock under modprobe??? */
+	flush_workqueue(i915->modeset_wq);
+	flush_work(&i915->atomic_helper.free_work);
+	flush_scheduled_work();
+#endif
+}
+
 /**
  * i915_driver_load - setup chip and create an initial config
  * @pdev: PCI device
@@ -1727,6 +1724,34 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret < 0)
 		goto out_cleanup_hw;
 
+	/*
+	 * After completing our HW probe; tear it all down again (at the
+	 * user's request)!
+	 *
+	 * Along side the CRTCs and connectors, there is a medley of
+	 * auxiliary HW which control various powerwells and interact with
+	 * other state (such as the BIOS framebuffer occupying a portion
+	 * of reserved memory). If the user tells us to run without any
+	 * displays enabled, we still need to register all the display and
+	 * auxiliary HW in order to safely disable them.
+	 */
+	if (i915_modparams.disable_display) {
+		DRM_INFO("Display disabled (module parameter)\n");
+		disable_display(dev_priv);
+		mkwrite_device_info(dev_priv)->num_pipes = 0;
+	}
+
+	if (INTEL_INFO(dev_priv)->num_pipes == 0) {
+		drm_mode_config_cleanup(&dev_priv->drm);
+		dev_priv->drm.driver_features &=
+			~(DRIVER_MODESET | DRIVER_ATOMIC);
+		dev_priv->psr.sink_support = false;
+	}
+
+	/* Only enable hotplug handling once the fbdev is fully set up. */
+	if (intel_fbdev_init(dev_priv) == 0)
+		intel_hpd_init(dev_priv);
+
 	i915_driver_register(dev_priv);
 
 	intel_init_ipc(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index 03df4e33763d..5f6b12986ce9 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -775,12 +775,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 			info->num_sprites[pipe] = 1;
 	}
 
-	if (i915_modparams.disable_display) {
-		DRM_INFO("Display disabled (module parameter)\n");
-		info->num_pipes = 0;
-	} else if (info->num_pipes > 0 &&
-		   (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
-		   HAS_PCH_SPLIT(dev_priv)) {
+	if (info->num_pipes > 0 &&
+	    (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
+	    HAS_PCH_SPLIT(dev_priv)) {
 		u32 fuse_strap = I915_READ(FUSE_STRAP);
 		u32 sfuse_strap = I915_READ(SFUSE_STRAP);
 
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index a75082813669..5442a13bba63 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -677,7 +677,7 @@ int intel_fbdev_init(struct drm_i915_private *i915)
 	struct intel_fbdev *ifbdev;
 	int ret;
 
-	if (WARN_ON(INTEL_INFO(i915)->num_pipes == 0))
+	if (INTEL_INFO(i915)->num_pipes == 0)
 		return -ENODEV;
 
 	ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
-- 
2.19.1

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

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

* [PATCH 4/4] HAX: force i915.disable_display=1
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
  2018-10-15 11:17 ` [PATCH 2/4] drm/i915/fbdev: Use i915/drm_i915_private consistently Chris Wilson
  2018-10-15 11:17 ` [PATCH 3/4] drm/i915: Disable displays at the user's request Chris Wilson
@ 2018-10-15 11:17 ` Chris Wilson
  2018-10-15 11:39 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Patchwork
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2018-10-15 11:17 UTC (permalink / raw)
  To: intel-gfx

---
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index 7e56c516c815..672b710506d3 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -62,7 +62,7 @@ struct drm_printer;
 	param(bool, load_detect_test, false) \
 	param(bool, force_reset_modeset_test, false) \
 	param(bool, error_capture, true) \
-	param(bool, disable_display, false) \
+	param(bool, disable_display, true) \
 	param(bool, verbose_state_checks, true) \
 	param(bool, nuclear_pageflip, false) \
 	param(bool, enable_dp_mst, true) \
-- 
2.19.1

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

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

* ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
                   ` (2 preceding siblings ...)
  2018-10-15 11:17 ` [PATCH 4/4] HAX: force i915.disable_display=1 Chris Wilson
@ 2018-10-15 11:39 ` Patchwork
  2018-10-15 11:41 ` ✗ Fi.CI.SPARSE: " Patchwork
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-10-15 11:39 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
URL   : https://patchwork.freedesktop.org/series/51000/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
3dc34f141c04 drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
-:13: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#13: 
References: 366e39b4d2c5 ("drm/i915: Tear down fbdev if initialization fails")

-:13: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 366e39b4d2c5 ("drm/i915: Tear down fbdev if initialization fails")'
#13: 
References: 366e39b4d2c5 ("drm/i915: Tear down fbdev if initialization fails")

total: 1 errors, 1 warnings, 0 checks, 93 lines checked
637e299f4d30 drm/i915/fbdev: Use i915/drm_i915_private consistently
-:284: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#284: FILE: drivers/gpu/drm/i915/intel_fbdev.c:540:
+static bool intel_fbdev_init_bios(struct drm_i915_private *i915,
 				 struct intel_fbdev *ifbdev)

total: 0 errors, 0 warnings, 1 checks, 398 lines checked
1c66fabe67b9 drm/i915: Disable displays at the user's request
-:59: WARNING:IF_0: Consider removing the code enclosed by this #if 0 and its #endif
#59: FILE: drivers/gpu/drm/i915/i915_drv.c:1660:
+#if 0 /* XXX flushes deadlock under modprobe??? */

total: 0 errors, 1 warnings, 0 checks, 96 lines checked
8cfd4ade4a6d HAX: force i915.disable_display=1
-:8: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

-:19: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

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

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

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

* ✗ Fi.CI.SPARSE: warning for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
                   ` (3 preceding siblings ...)
  2018-10-15 11:39 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Patchwork
@ 2018-10-15 11:41 ` Patchwork
  2018-10-15 11:52 ` ✗ Fi.CI.BAT: failure " Patchwork
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-10-15 11:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
URL   : https://patchwork.freedesktop.org/series/51000/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
Okay!

Commit: drm/i915/fbdev: Use i915/drm_i915_private consistently
-O:drivers/gpu/drm/i915/intel_fbdev.c:339:30: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_fbdev.c:336:30: warning: expression using sizeof(void)

Commit: drm/i915: Disable displays at the user's request
Okay!

Commit: HAX: force i915.disable_display=1
Okay!

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

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

* ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
                   ` (4 preceding siblings ...)
  2018-10-15 11:41 ` ✗ Fi.CI.SPARSE: " Patchwork
@ 2018-10-15 11:52 ` Patchwork
  2018-10-17  9:18 ` Patchwork
  2018-10-19  8:23 ` [PATCH 1/4] " Daniel Vetter
  7 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-10-15 11:52 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
URL   : https://patchwork.freedesktop.org/series/51000/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4979 -> Patchwork_10456 =

== Summary - FAILURE ==

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

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

== Possible new issues ==

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

  === IGT changes ===

    ==== Possible regressions ====

    igt@debugfs_test@read_all_entries:
      fi-ilk-650:         PASS -> DMESG-WARN

    igt@kms_chamelium@dp-hpd-fast:
      fi-skl-6700k2:      SKIP -> FAIL +4

    igt@kms_chamelium@hdmi-crc-fast:
      fi-skl-6700k2:      PASS -> FAIL +4

    igt@kms_chamelium@vga-hpd-fast:
      fi-kbl-7500u:       SKIP -> FAIL +4

    igt@pm_rpm@module-reload:
      fi-bsw-kefka:       PASS -> DMESG-WARN
      fi-bsw-n3050:       PASS -> DMESG-WARN
      fi-byt-j1900:       NOTRUN -> DMESG-WARN
      fi-byt-n2820:       NOTRUN -> DMESG-WARN

    igt@prime_vgem@basic-fence-flip:
      fi-hsw-4770r:       PASS -> FAIL
      fi-kbl-7500u:       PASS -> FAIL +3
      fi-icl-u2:          PASS -> FAIL
      fi-cfl-8700k:       PASS -> FAIL
      fi-bsw-kefka:       SKIP -> FAIL
      fi-snb-2520m:       NOTRUN -> FAIL
      fi-glk-dsi:         SKIP -> FAIL
      fi-cnl-u:           SKIP -> FAIL
      fi-skl-guc:         PASS -> FAIL
      fi-cfl-guc:         PASS -> FAIL
      fi-bdw-gvtdvm:      PASS -> FAIL
      fi-bsw-n3050:       SKIP -> FAIL
      fi-ilk-650:         PASS -> FAIL
      fi-ivb-3770:        NOTRUN -> FAIL
      fi-skl-gvtdvm:      PASS -> FAIL
      fi-skl-6260u:       PASS -> FAIL
      fi-bxt-j4205:       PASS -> FAIL
      fi-bxt-dsi:         SKIP -> FAIL
      fi-hsw-4770:        PASS -> FAIL
      fi-ivb-3520m:       SKIP -> FAIL
      fi-skl-6770hq:      PASS -> FAIL
      fi-snb-2600:        NOTRUN -> FAIL
      fi-bwr-2160:        PASS -> FAIL
      fi-gdg-551:         PASS -> FAIL
      fi-hsw-peppy:       SKIP -> FAIL
      fi-kbl-8809g:       SKIP -> FAIL
      fi-byt-n2820:       NOTRUN -> FAIL
      fi-kbl-r:           SKIP -> FAIL
      fi-kbl-7567u:       PASS -> FAIL
      fi-kbl-x1275:       SKIP -> FAIL
      fi-icl-u:           SKIP -> FAIL
      fi-pnv-d510:        NOTRUN -> FAIL
      fi-skl-6600u:       SKIP -> FAIL
      fi-glk-j4005:       PASS -> FAIL
      fi-skl-iommu:       PASS -> FAIL
      fi-byt-j1900:       NOTRUN -> FAIL
      fi-elk-e7500:       PASS -> FAIL
      fi-whl-u:           SKIP -> FAIL
      fi-skl-6700hq:      SKIP -> FAIL
      fi-bdw-5557u:       PASS -> FAIL
      fi-kbl-7560u:       NOTRUN -> FAIL
      fi-cfl-s3:          SKIP -> FAIL
      fi-kbl-guc:         SKIP -> FAIL
      fi-cfl-8109u:       PASS -> FAIL
      fi-byt-clapper:     SKIP -> FAIL

    
    ==== Warnings ====

    igt@core_prop_blob@basic:
      fi-blb-e6850:       PASS -> SKIP

    igt@kms_addfb_basic@addfb25-bad-modifier:
      fi-bdw-gvtdvm:      PASS -> SKIP +72
      fi-gdg-551:         PASS -> SKIP +65

    igt@kms_addfb_basic@addfb25-modifier-no-flag:
      fi-cfl-guc:         PASS -> SKIP +75

    igt@kms_addfb_basic@addfb25-y-tiled:
      fi-kbl-r:           PASS -> SKIP +80

    igt@kms_addfb_basic@bad-pitch-1024:
      fi-ivb-3520m:       PASS -> SKIP +77

    igt@kms_addfb_basic@bad-pitch-32:
      fi-whl-u:           PASS -> SKIP +80

    igt@kms_addfb_basic@bad-pitch-63:
      fi-kbl-7567u:       PASS -> SKIP +75
      fi-kbl-7500u:       PASS -> SKIP +75

    igt@kms_addfb_basic@basic-y-tiled:
      fi-cfl-8109u:       PASS -> SKIP +75
      fi-cfl-s3:          PASS -> SKIP +80

    igt@kms_addfb_basic@invalid-get-prop-any:
      fi-skl-6600u:       PASS -> SKIP +80

    igt@kms_addfb_basic@invalid-set-prop:
      fi-hsw-4770:        PASS -> SKIP +78

    igt@kms_addfb_basic@invalid-set-prop-any:
      fi-glk-dsi:         PASS -> SKIP +76

    igt@kms_addfb_basic@no-handle:
      fi-icl-u2:          PASS -> SKIP +79
      fi-cfl-8700k:       PASS -> SKIP +75

    igt@kms_addfb_basic@too-high:
      fi-glk-j4005:       PASS -> SKIP +74

    igt@kms_addfb_basic@unused-modifier:
      fi-bdw-5557u:       PASS -> SKIP +74
      fi-kbl-8809g:       PASS -> SKIP +38
      fi-kbl-guc:         PASS -> SKIP +39

    igt@kms_addfb_basic@unused-offsets:
      fi-bwr-2160:        PASS -> SKIP +65

    igt@kms_addfb_basic@unused-pitches:
      fi-kbl-x1275:       PASS -> SKIP +39
      fi-skl-gvtdvm:      PASS -> SKIP +73

    igt@kms_chamelium@common-hpd-after-suspend:
      fi-kbl-7500u:       DMESG-WARN (fdo#102505, fdo#105602, fdo#105079) -> FAIL

    igt@kms_cursor_legacy@basic-flip-after-cursor-varying-size:
      fi-skl-guc:         PASS -> SKIP +75

    igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
      fi-bsw-n3050:       PASS -> SKIP +60
      fi-skl-6700k2:      PASS -> SKIP +75

    igt@kms_flip@basic-flip-vs-dpms:
      fi-ilk-650:         PASS -> SKIP +68
      fi-skl-6770hq:      PASS -> SKIP +75

    igt@kms_flip@basic-flip-vs-modeset:
      fi-cnl-u:           PASS -> SKIP +80

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-icl-u:           PASS -> SKIP +79
      fi-hsw-peppy:       PASS -> SKIP +75
      fi-skl-6260u:       PASS -> SKIP +75

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-bxt-j4205:       PASS -> SKIP +75

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-elk-e7500:       PASS -> SKIP +65

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b:
      fi-bsw-kefka:       PASS -> SKIP +68

    igt@kms_pipe_crc_basic@read-crc-pipe-b:
      fi-byt-clapper:     PASS -> SKIP +65

    igt@kms_pipe_crc_basic@read-crc-pipe-c-frame-sequence:
      fi-bxt-dsi:         PASS -> SKIP +76

    igt@kms_psr@sprite_plane_onoff:
      fi-skl-6700hq:      PASS -> SKIP +80

    igt@kms_setmode@basic-clone-single-crtc:
      fi-hsw-4770r:       PASS -> SKIP +74

    igt@pm_rpm@basic-rte:
      fi-skl-iommu:       PASS -> SKIP +75

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@amdgpu/amd_cs_nop@fork-gfx0:
      fi-kbl-8809g:       PASS -> DMESG-WARN (fdo#107762)

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    igt@pm_rpm@module-reload:
      fi-hsw-peppy:       PASS -> DMESG-WARN (fdo#106386, fdo#107603)

    
    ==== Possible fixes ====

    igt@drv_module_reload@basic-reload:
      fi-glk-j4005:       DMESG-WARN (fdo#106248, fdo#106725) -> PASS

    igt@drv_selftest@live_hangcheck:
      fi-icl-u:           INCOMPLETE (fdo#108315) -> PASS

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

    igt@kms_flip@basic-plain-flip:
      fi-ilk-650:         DMESG-WARN (fdo#106387) -> SKIP

    igt@kms_pipe_crc_basic@read-crc-pipe-a:
      fi-byt-clapper:     FAIL (fdo#107362) -> SKIP

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> SKIP +1

    
  fdo#102505 https://bugs.freedesktop.org/show_bug.cgi?id=102505
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#105079 https://bugs.freedesktop.org/show_bug.cgi?id=105079
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
  fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
  fdo#106386 https://bugs.freedesktop.org/show_bug.cgi?id=106386
  fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
  fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107603 https://bugs.freedesktop.org/show_bug.cgi?id=107603
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#107762 https://bugs.freedesktop.org/show_bug.cgi?id=107762
  fdo#108315 https://bugs.freedesktop.org/show_bug.cgi?id=108315


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

  Additional (7): fi-byt-j1900 fi-snb-2520m fi-ivb-3770 fi-pnv-d510 fi-kbl-7560u fi-byt-n2820 fi-snb-2600 
  Missing    (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-apl-guc 


== Build changes ==

    * Linux: CI_DRM_4979 -> Patchwork_10456

  CI_DRM_4979: 2c411746783a4db33844f298ee88f0301cf0453e @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4674: 93871c6fb3c25e5d350c9faf36ded917174214de @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_10456: 8cfd4ade4a6d3a4f952f205d5c30d1119edc6278 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

8cfd4ade4a6d HAX: force i915.disable_display=1
1c66fabe67b9 drm/i915: Disable displays at the user's request
637e299f4d30 drm/i915/fbdev: Use i915/drm_i915_private consistently
3dc34f141c04 drm/i915/fbdev: Use an ordinary worker to avoid async deadlock

== Logs ==

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

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

* ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
                   ` (5 preceding siblings ...)
  2018-10-15 11:52 ` ✗ Fi.CI.BAT: failure " Patchwork
@ 2018-10-17  9:18 ` Patchwork
  2018-10-19  8:23 ` [PATCH 1/4] " Daniel Vetter
  7 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2018-10-17  9:18 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
URL   : https://patchwork.freedesktop.org/series/51000/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4995 -> Patchwork_10484 =

== Summary - FAILURE ==

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

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

== Possible new issues ==

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

  === IGT changes ===

    ==== Possible regressions ====

    igt@debugfs_test@read_all_entries:
      fi-ilk-650:         PASS -> DMESG-WARN

    igt@drv_selftest@live_gtt:
      fi-kbl-7500u:       PASS -> DMESG-WARN +18

    igt@drv_selftest@live_objects:
      fi-skl-6770hq:      PASS -> DMESG-WARN +18

    igt@pm_rpm@module-reload:
      fi-bsw-kefka:       PASS -> DMESG-WARN
      fi-bsw-n3050:       PASS -> DMESG-WARN

    
    ==== Warnings ====

    igt@core_prop_blob@basic:
      fi-kbl-soraka:      PASS -> SKIP
      {fi-apl-guc}:       PASS -> SKIP

    igt@kms_addfb_basic@addfb25-modifier-no-flag:
      fi-cfl-guc:         PASS -> SKIP +76

    igt@kms_addfb_basic@addfb25-y-tiled:
      fi-kbl-r:           PASS -> SKIP +80

    igt@kms_addfb_basic@bad-pitch-32:
      fi-whl-u:           PASS -> SKIP +80

    igt@kms_addfb_basic@bad-pitch-63:
      fi-kbl-7567u:       PASS -> SKIP +76

    igt@kms_addfb_basic@basic-y-tiled:
      fi-cfl-8109u:       PASS -> SKIP +76
      fi-cfl-s3:          PASS -> SKIP +80

    igt@kms_addfb_basic@invalid-get-prop-any:
      fi-skl-6600u:       PASS -> SKIP +80
      fi-ivb-3770:        PASS -> SKIP +77
      fi-kbl-7560u:       PASS -> SKIP +80

    igt@kms_addfb_basic@invalid-set-prop:
      fi-hsw-4770:        PASS -> SKIP +79

    igt@kms_addfb_basic@no-handle:
      fi-cfl-8700k:       PASS -> SKIP +76

    igt@kms_addfb_basic@too-high:
      fi-glk-j4005:       PASS -> SKIP +76

    igt@kms_addfb_basic@unused-modifier:
      fi-bdw-5557u:       PASS -> SKIP +75
      fi-kbl-8809g:       PASS -> SKIP +38
      fi-kbl-guc:         PASS -> SKIP +39

    igt@kms_addfb_basic@unused-offsets:
      fi-bwr-2160:        PASS -> SKIP +66
      fi-blb-e6850:       PASS -> SKIP +66

    igt@kms_addfb_basic@unused-pitches:
      fi-kbl-x1275:       PASS -> SKIP +39
      fi-skl-gvtdvm:      PASS -> SKIP +74

    igt@kms_chamelium@hdmi-crc-fast:
      fi-skl-6700k2:      PASS -> SKIP +80

    igt@kms_cursor_legacy@basic-flip-after-cursor-varying-size:
      fi-skl-guc:         PASS -> SKIP +76

    igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
      fi-bsw-n3050:       PASS -> SKIP +60

    igt@kms_flip@basic-flip-vs-dpms:
      fi-ilk-650:         PASS -> SKIP +70
      fi-skl-6770hq:      PASS -> SKIP +76

    igt@kms_flip@basic-flip-vs-modeset:
      fi-cnl-u:           PASS -> SKIP +80

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-skl-6260u:       PASS -> SKIP +76

    igt@kms_force_connector_basic@force-edid:
      fi-snb-2520m:       PASS -> SKIP +70

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-bxt-j4205:       PASS -> SKIP +76

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-elk-e7500:       PASS -> SKIP +66

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b:
      fi-bsw-kefka:       PASS -> SKIP +68

    igt@kms_pipe_crc_basic@read-crc-pipe-b:
      fi-byt-clapper:     PASS -> SKIP +68

    igt@kms_pipe_crc_basic@read-crc-pipe-c-frame-sequence:
      fi-bxt-dsi:         PASS -> SKIP +76

    igt@kms_psr@sprite_plane_onoff:
      fi-skl-6700hq:      PASS -> SKIP +79

    igt@pm_rpm@basic-rte:
      fi-skl-iommu:       PASS -> SKIP +76

    igt@prime_vgem@basic-fence-flip:
      fi-hsw-4770r:       PASS -> SKIP +75
      fi-kbl-7500u:       PASS -> SKIP +79
      fi-icl-u2:          PASS -> SKIP +81

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@debugfs_test@read_all_entries:
      {fi-apl-guc}:       PASS -> INCOMPLETE (fdo#106693) +1

    
    ==== Possible fixes ====

    igt@drv_selftest@live_hangcheck:
      fi-kbl-7560u:       INCOMPLETE (fdo#108044) -> PASS

    igt@kms_chamelium@common-hpd-after-suspend:
      fi-kbl-7500u:       DMESG-WARN (fdo#105602, fdo#102505, fdo#105079) -> SKIP

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      DMESG-WARN (fdo#105998) -> SKIP

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#102505 https://bugs.freedesktop.org/show_bug.cgi?id=102505
  fdo#105079 https://bugs.freedesktop.org/show_bug.cgi?id=105079
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#106693 https://bugs.freedesktop.org/show_bug.cgi?id=106693
  fdo#108044 https://bugs.freedesktop.org/show_bug.cgi?id=108044


== Participating hosts (46 -> 40) ==

  Additional (1): fi-pnv-d510 
  Missing    (7): fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-hsw-peppy fi-byt-squawks fi-bsw-cyan fi-icl-u 


== Build changes ==

    * Linux: CI_DRM_4995 -> Patchwork_10484

  CI_DRM_4995: 54f2281117133d77122fe452af3ea0bd5b6161aa @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4683: 7766b1e2348b32cc8ed58a972c6fd53b20279549 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_10484: 2ceab7e6f7e6785080ef68feb9ebb02d20eac7af @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

2ceab7e6f7e6 HAX: force i915.disable_display=1
747c565fa645 drm/i915: Disable displays at the user's request
0979eeb62ab9 drm/i915/fbdev: Use i915/drm_i915_private consistently
15d49408f167 drm/i915/fbdev: Use an ordinary worker to avoid async deadlock

== Logs ==

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

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

* Re: [PATCH 3/4] drm/i915: Disable displays at the user's request
  2018-10-15 11:17 ` [PATCH 3/4] drm/i915: Disable displays at the user's request Chris Wilson
@ 2018-10-19  8:22   ` Daniel Vetter
  2018-10-19  8:39     ` Chris Wilson
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Vetter @ 2018-10-19  8:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Mon, Oct 15, 2018 at 12:17:41PM +0100, Chris Wilson wrote:
> If the user passes i915.disable_display=1 we want to disable all the
> displays and associated HW like the powerwells on their behalf. Instead
> of short circuiting the HW probe, let it run and setup all the
> bookkeeping for the known HW. Afterwards, instead of taking over the
> BIOS fb and installing the fbcon, we shutdown all the outputs and
> teardown the bookkeeping, leaving us with no attached outputs or crtcs,
> and all the HW powered down.
> 
> Open: wq flushes should be required but seem to deadlock the modprobe
> under CI.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

i915.disable_display was for those server chips where doing all the init
resulted in a dead machine. So not sure we want this.

What's the issue with power wells still being on and all that? On real hw
without display they won't exist, and I don't understand why we'd care for
testing.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.c          | 53 +++++++++++++++++-------
>  drivers/gpu/drm/i915/intel_device_info.c |  9 ++--
>  drivers/gpu/drm/i915/intel_fbdev.c       |  2 +-
>  3 files changed, 43 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index c14855f167b9..d71add64948b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -689,22 +689,8 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  
>  	intel_setup_overlay(dev_priv);
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> -		return 0;
> -
> -	ret = intel_fbdev_init(dev_priv);
> -	if (ret)
> -		goto cleanup_gem;
> -
> -	/* Only enable hotplug handling once the fbdev is fully set up. */
> -	intel_hpd_init(dev_priv);
> -
>  	return 0;
>  
> -cleanup_gem:
> -	if (i915_gem_suspend(dev_priv))
> -		DRM_ERROR("failed to idle hardware; continuing to unload!\n");
> -	i915_gem_fini(dev_priv);
>  cleanup_modeset:
>  	intel_modeset_cleanup(dev);
>  cleanup_irq:
> @@ -1667,6 +1653,17 @@ static void i915_driver_destroy(struct drm_i915_private *i915)
>  	pci_set_drvdata(pdev, NULL);
>  }
>  
> +static void disable_display(struct drm_i915_private *i915)
> +{
> +	drm_atomic_helper_shutdown(&i915->drm);
> +
> +#if 0 /* XXX flushes deadlock under modprobe??? */
> +	flush_workqueue(i915->modeset_wq);
> +	flush_work(&i915->atomic_helper.free_work);
> +	flush_scheduled_work();
> +#endif
> +}
> +
>  /**
>   * i915_driver_load - setup chip and create an initial config
>   * @pdev: PCI device
> @@ -1727,6 +1724,34 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (ret < 0)
>  		goto out_cleanup_hw;
>  
> +	/*
> +	 * After completing our HW probe; tear it all down again (at the
> +	 * user's request)!
> +	 *
> +	 * Along side the CRTCs and connectors, there is a medley of
> +	 * auxiliary HW which control various powerwells and interact with
> +	 * other state (such as the BIOS framebuffer occupying a portion
> +	 * of reserved memory). If the user tells us to run without any
> +	 * displays enabled, we still need to register all the display and
> +	 * auxiliary HW in order to safely disable them.
> +	 */
> +	if (i915_modparams.disable_display) {
> +		DRM_INFO("Display disabled (module parameter)\n");
> +		disable_display(dev_priv);
> +		mkwrite_device_info(dev_priv)->num_pipes = 0;
> +	}
> +
> +	if (INTEL_INFO(dev_priv)->num_pipes == 0) {
> +		drm_mode_config_cleanup(&dev_priv->drm);
> +		dev_priv->drm.driver_features &=
> +			~(DRIVER_MODESET | DRIVER_ATOMIC);
> +		dev_priv->psr.sink_support = false;
> +	}
> +
> +	/* Only enable hotplug handling once the fbdev is fully set up. */
> +	if (intel_fbdev_init(dev_priv) == 0)
> +		intel_hpd_init(dev_priv);
> +
>  	i915_driver_register(dev_priv);
>  
>  	intel_init_ipc(dev_priv);
> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
> index 03df4e33763d..5f6b12986ce9 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.c
> +++ b/drivers/gpu/drm/i915/intel_device_info.c
> @@ -775,12 +775,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
>  			info->num_sprites[pipe] = 1;
>  	}
>  
> -	if (i915_modparams.disable_display) {
> -		DRM_INFO("Display disabled (module parameter)\n");
> -		info->num_pipes = 0;
> -	} else if (info->num_pipes > 0 &&
> -		   (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
> -		   HAS_PCH_SPLIT(dev_priv)) {
> +	if (info->num_pipes > 0 &&
> +	    (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
> +	    HAS_PCH_SPLIT(dev_priv)) {
>  		u32 fuse_strap = I915_READ(FUSE_STRAP);
>  		u32 sfuse_strap = I915_READ(SFUSE_STRAP);
>  
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index a75082813669..5442a13bba63 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -677,7 +677,7 @@ int intel_fbdev_init(struct drm_i915_private *i915)
>  	struct intel_fbdev *ifbdev;
>  	int ret;
>  
> -	if (WARN_ON(INTEL_INFO(i915)->num_pipes == 0))
> +	if (INTEL_INFO(i915)->num_pipes == 0)
>  		return -ENODEV;
>  
>  	ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
> -- 
> 2.19.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
  2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
                   ` (6 preceding siblings ...)
  2018-10-17  9:18 ` Patchwork
@ 2018-10-19  8:23 ` Daniel Vetter
  2018-10-19  8:32   ` Chris Wilson
  7 siblings, 1 reply; 13+ messages in thread
From: Daniel Vetter @ 2018-10-19  8:23 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Mon, Oct 15, 2018 at 12:17:39PM +0100, Chris Wilson wrote:
> We try to avoid a deadlock of synchronizing the async fbdev task by
> skipping the synchronisation from the async worker, but that prevents us
> from using an async worker for the device probe. As we have our own
> barrier and do not rely on the global async flush, we can simply replace
> the async task with an explicit worker.
> 
> References: 366e39b4d2c5 ("drm/i915: Tear down fbdev if initialization fails")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Does this now mean that fbdev setup lags behind module load? Afaiui that
will annoy userspace, which assumes that once the kms driver is loaded,
fbdev works. Or at least I have vague memories of pains in this area.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_drv.h   |  3 +--
>  drivers/gpu/drm/i915/intel_fbdev.c | 35 +++++++++++++++---------------
>  2 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3dea7a1bda7f..15bbf604724d 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -25,7 +25,6 @@
>  #ifndef __INTEL_DRV_H__
>  #define __INTEL_DRV_H__
>  
> -#include <linux/async.h>
>  #include <linux/i2c.h>
>  #include <linux/hdmi.h>
>  #include <linux/sched/clock.h>
> @@ -207,8 +206,8 @@ struct intel_fbdev {
>  	struct intel_framebuffer *fb;
>  	struct i915_vma *vma;
>  	unsigned long vma_flags;
> -	async_cookie_t cookie;
>  	int preferred_bpp;
> +	struct work_struct work;
>  };
>  
>  struct intel_encoder {
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 2480c7d6edee..265cc947aede 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -24,7 +24,6 @@
>   *     David Airlie
>   */
>  
> -#include <linux/async.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/console.h>
> @@ -666,6 +665,16 @@ static void intel_fbdev_suspend_worker(struct work_struct *work)
>  				true);
>  }
>  
> +static void intel_fbdev_initial_config(struct work_struct *work)
> +{
> +	struct intel_fbdev *ifbdev = container_of(work, typeof(*ifbdev), work);
> +
> +	/* 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_unregister(to_i915(ifbdev->helper.dev));
> +}
> +
>  int intel_fbdev_init(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -679,6 +688,8 @@ int intel_fbdev_init(struct drm_device *dev)
>  	if (ifbdev == NULL)
>  		return -ENOMEM;
>  
> +	INIT_WORK(&ifbdev->work, intel_fbdev_initial_config);
> +
>  	drm_fb_helper_prepare(dev, &ifbdev->helper, &intel_fb_helper_funcs);
>  
>  	if (!intel_fbdev_init_bios(dev, ifbdev))
> @@ -698,16 +709,6 @@ int intel_fbdev_init(struct drm_device *dev)
>  	return 0;
>  }
>  
> -static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
> -{
> -	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_unregister(to_i915(ifbdev->helper.dev));
> -}
> -
>  void intel_fbdev_initial_config_async(struct drm_device *dev)
>  {
>  	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
> @@ -715,17 +716,16 @@ void intel_fbdev_initial_config_async(struct drm_device *dev)
>  	if (!ifbdev)
>  		return;
>  
> -	ifbdev->cookie = async_schedule(intel_fbdev_initial_config, ifbdev);
> +	schedule_work(&ifbdev->work);
>  }
>  
>  static void intel_fbdev_sync(struct intel_fbdev *ifbdev)
>  {
> -	if (!ifbdev->cookie)
> +	if (!READ_ONCE(ifbdev->work.func))
>  		return;
>  
> -	/* Only serialises with all preceding async calls, hence +1 */
> -	async_synchronize_cookie(ifbdev->cookie + 1);
> -	ifbdev->cookie = 0;
> +	flush_work(&ifbdev->work);
> +	ifbdev->work.func = NULL;
>  }
>  
>  void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
> @@ -736,8 +736,7 @@ void intel_fbdev_unregister(struct drm_i915_private *dev_priv)
>  		return;
>  
>  	cancel_work_sync(&dev_priv->fbdev_suspend_work);
> -	if (!current_is_async())
> -		intel_fbdev_sync(ifbdev);
> +	intel_fbdev_sync(ifbdev);
>  
>  	drm_fb_helper_unregister_fbi(&ifbdev->helper);
>  }
> -- 
> 2.19.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock
  2018-10-19  8:23 ` [PATCH 1/4] " Daniel Vetter
@ 2018-10-19  8:32   ` Chris Wilson
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2018-10-19  8:32 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

Quoting Daniel Vetter (2018-10-19 09:23:54)
> On Mon, Oct 15, 2018 at 12:17:39PM +0100, Chris Wilson wrote:
> > We try to avoid a deadlock of synchronizing the async fbdev task by
> > skipping the synchronisation from the async worker, but that prevents us
> > from using an async worker for the device probe. As we have our own
> > barrier and do not rely on the global async flush, we can simply replace
> > the async task with an explicit worker.
> > 
> > References: 366e39b4d2c5 ("drm/i915: Tear down fbdev if initialization fails")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Does this now mean that fbdev setup lags behind module load? Afaiui that
> will annoy userspace, which assumes that once the kms driver is loaded,
> fbdev works. Or at least I have vague memories of pains in this area.

I have no idea what pain you remember, I just ask wtf is fbdev.

Since we register the driver before module load completes, there's a
race window for third parties who can make that same assumption, so
what's the difference: fbdev is available as soon as it is registered
and not before.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 3/4] drm/i915: Disable displays at the user's request
  2018-10-19  8:22   ` Daniel Vetter
@ 2018-10-19  8:39     ` Chris Wilson
  2018-11-06 17:48       ` Ville Syrjälä
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2018-10-19  8:39 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

Quoting Daniel Vetter (2018-10-19 09:22:15)
> On Mon, Oct 15, 2018 at 12:17:41PM +0100, Chris Wilson wrote:
> > If the user passes i915.disable_display=1 we want to disable all the
> > displays and associated HW like the powerwells on their behalf. Instead
> > of short circuiting the HW probe, let it run and setup all the
> > bookkeeping for the known HW. Afterwards, instead of taking over the
> > BIOS fb and installing the fbcon, we shutdown all the outputs and
> > teardown the bookkeeping, leaving us with no attached outputs or crtcs,
> > and all the HW powered down.
> > 
> > Open: wq flushes should be required but seem to deadlock the modprobe
> > under CI.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Imre Deak <imre.deak@intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> i915.disable_display was for those server chips where doing all the init
> resulted in a dead machine. So not sure we want this.

For those server chips, we don't use i915.disable_display but detect when
the fuses are lies and directly set num_pipes == 0. If we had such a
machine in CI, you would already have seen a lot of the fun with KMS being
allowed without any backing hw. Hence why Ville suggested we disable KMS
for machines without pipes to avoid having to add a lot of defense
around the driver.

> What's the issue with power wells still being on and all that? On real hw
> without display they won't exist, and I don't understand why we'd care for
> testing.

For testing. We do use .disable_display and expect rpm to still work, and
to not get random display related failures interfering in displayless
tests.

Quite clearly we haven't been testing the displayless setups at all.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 3/4] drm/i915: Disable displays at the user's request
  2018-10-19  8:39     ` Chris Wilson
@ 2018-11-06 17:48       ` Ville Syrjälä
  0 siblings, 0 replies; 13+ messages in thread
From: Ville Syrjälä @ 2018-11-06 17:48 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Fri, Oct 19, 2018 at 09:39:22AM +0100, Chris Wilson wrote:
> Quoting Daniel Vetter (2018-10-19 09:22:15)
> > On Mon, Oct 15, 2018 at 12:17:41PM +0100, Chris Wilson wrote:
> > > If the user passes i915.disable_display=1 we want to disable all the
> > > displays and associated HW like the powerwells on their behalf. Instead
> > > of short circuiting the HW probe, let it run and setup all the
> > > bookkeeping for the known HW. Afterwards, instead of taking over the
> > > BIOS fb and installing the fbcon, we shutdown all the outputs and
> > > teardown the bookkeeping, leaving us with no attached outputs or crtcs,
> > > and all the HW powered down.
> > > 
> > > Open: wq flushes should be required but seem to deadlock the modprobe
> > > under CI.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Imre Deak <imre.deak@intel.com>
> > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > i915.disable_display was for those server chips where doing all the init
> > resulted in a dead machine. So not sure we want this.
> 
> For those server chips, we don't use i915.disable_display but detect when
> the fuses are lies and directly set num_pipes == 0. If we had such a
> machine in CI, you would already have seen a lot of the fun with KMS being
> allowed without any backing hw. Hence why Ville suggested we disable KMS
> for machines without pipes to avoid having to add a lot of defense
> around the driver.
> 
> > What's the issue with power wells still being on and all that? On real hw
> > without display they won't exist, and I don't understand why we'd care for
> > testing.
> 
> For testing. We do use .disable_display and expect rpm to still work, and
> to not get random display related failures interfering in displayless
> tests.
> 
> Quite clearly we haven't been testing the displayless setups at all.

I definitely like the idea of testing this without requiring special
hardware. I guess another way to achieve the result of turning
everything off would be to 'modprobe i915 disable_display=0;
rmmod i915; modprobe i915 disable_display=1'. That should avoid the
need to have a special codepath for shutthing things down. Would that
suffice or is there a compelling reason for supporting this without
requiring the driver reload?

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

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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 11:17 [PATCH 1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Chris Wilson
2018-10-15 11:17 ` [PATCH 2/4] drm/i915/fbdev: Use i915/drm_i915_private consistently Chris Wilson
2018-10-15 11:17 ` [PATCH 3/4] drm/i915: Disable displays at the user's request Chris Wilson
2018-10-19  8:22   ` Daniel Vetter
2018-10-19  8:39     ` Chris Wilson
2018-11-06 17:48       ` Ville Syrjälä
2018-10-15 11:17 ` [PATCH 4/4] HAX: force i915.disable_display=1 Chris Wilson
2018-10-15 11:39 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/fbdev: Use an ordinary worker to avoid async deadlock Patchwork
2018-10-15 11:41 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-15 11:52 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-10-17  9:18 ` Patchwork
2018-10-19  8:23 ` [PATCH 1/4] " Daniel Vetter
2018-10-19  8:32   ` Chris Wilson

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.