Skip to contentSkip to conversation

drm/i915: cancel hotplug and dig_port work during suspend and unload

PATCH Superseded Imre Deak 2 participants 5 messages Aug 11, 2014 – Aug 12, 2014

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 2/4 drm/i915: cancel hotplug and dig_port work during suspend and unload

Make sure these work handlers don't run after we system suspend or unload the driver. Note that we don't cancel the handlers during runtime suspend. That could lead to a lockup, since we take a runtime PM ref from the handlers themselves. Fortunaltely canceling there is not needed since the RPM ref itself provides for the needed serialization.

---
 drivers/gpu/drm/i915/i915_drv.c      | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h      | 1 +
 drivers/gpu/drm/i915/intel_display.c | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +8 -0
index ec96f9a..0653761 100644
@@ -494,6 +494,13 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 	return true;
 }
 
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
+{
+	cancel_work_sync(&dev_priv->hotplug_work);
+	cancel_work_sync(&dev_priv->dig_port_work);
+	cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work);
+}
+
 static int i915_drm_freeze(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -538,6 +545,7 @@ static int i915_drm_freeze(struct drm_device *dev)
 		flush_delayed_work(&dev_priv->rps.delayed_resume_work);
 
 		intel_runtime_pm_disable_interrupts(dev);
+		intel_hpd_cancel_work(dev_priv);
 
 		intel_suspend_gt_powersave(dev);
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 35d150a..8776847 100644
@@ -2218,6 +2218,7 @@ extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
 int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on);
 
 extern void intel_console_resume(struct work_struct *work);
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv);
 
 /* i915_irq.c */
 void i915_queue_hangcheck(struct drm_device *dev);
drivers/gpu/drm/i915/intel_display.c +1 -2
index b3a3168..ab90301 100644
@@ -13100,8 +13100,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
 	 * experience fancy races otherwise.
 	 */
 	drm_irq_uninstall(dev);
-	cancel_work_sync(&dev_priv->hotplug_work);
-	cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work);
+	intel_hpd_cancel_work(dev_priv);
 	dev_priv->pm._irqs_disabled = true;
 
 	/*
Signature · 1 line
1.8.4
#1 lore raw
Quoted 18 lines · Imre Deak

Make sure these work handlers don't run after we system suspend or unload the driver. Note that we don't cancel the handlers during runtime suspend. That could lead to a lockup, since we take a runtime PM ref from the handlers themselves. Fortunaltely canceling there is not needed since the RPM ref itself provides for the needed serialization.

---
 drivers/gpu/drm/i915/i915_drv.c      | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h      | 1 +
 drivers/gpu/drm/i915/intel_display.c | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ec96f9a..0653761 100644

drivers/gpu/drm/i915/i915_drv.c bool i915_semaphore_is_enabled(struct drm_device *dev) · line 500

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
@@ -494,6 +494,13 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 	return true;
 }
 
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
+{
+	cancel_work_sync(&dev_priv->hotplug_work);
+	cancel_work_sync(&dev_priv->dig_port_work);

Since dig_port_work can queue a hotplug_work shouldn't these two be swapped?

I wonder if we should also clear hpd_event_bits and {long,short}_hpd_port_mask before cancelling the works? At least it might make the works end a bit quicker if the are already running.

I also noticed that we don't seem to grab any rpm/powerwell references in ->hpd_pulse() or i915_digport_work_func(). That doesn't seem right. Or maybe you already addressed that in another patch?

Quoted 47 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+	cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work);
+}
+
 static int i915_drm_freeze(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -538,6 +545,7 @@ static int i915_drm_freeze(struct drm_device *dev)
 		flush_delayed_work(&dev_priv->rps.delayed_resume_work);
 
 		intel_runtime_pm_disable_interrupts(dev);
+		intel_hpd_cancel_work(dev_priv);
 
 		intel_suspend_gt_powersave(dev);
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 35d150a..8776847 100644
@@ -2218,6 +2218,7 @@ extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
 int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on);
 
 extern void intel_console_resume(struct work_struct *work);
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv);
 
 /* i915_irq.c */
 void i915_queue_hangcheck(struct drm_device *dev);
drivers/gpu/drm/i915/intel_display.c +1 -2
index b3a3168..ab90301 100644
@@ -13100,8 +13100,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
 	 * experience fancy races otherwise.
 	 */
 	drm_irq_uninstall(dev);
-	cancel_work_sync(&dev_priv->hotplug_work);
-	cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work);
+	intel_hpd_cancel_work(dev_priv);
 	dev_priv->pm._irqs_disabled = true;
 
 	/*
Signature · 6 lines
1.8.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
author
#2 lore raw
Quoted 22 lines · Ville Syrjälä
Quoted 21 lines · Imre Deak

Make sure these work handlers don't run after we system suspend or unload the driver. Note that we don't cancel the handlers during runtime suspend. That could lead to a lockup, since we take a runtime PM ref from the handlers themselves. Fortunaltely canceling there is not needed since the RPM ref itself provides for the needed serialization.

---
 drivers/gpu/drm/i915/i915_drv.c      | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h      | 1 +
 drivers/gpu/drm/i915/intel_display.c | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ec96f9a..0653761 100644
@@ -494,6 +494,13 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 	return true;
 }
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c bool i915_semaphore_is_enabled(struct drm_device *dev) · line 500

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
+{
+	cancel_work_sync(&dev_priv->hotplug_work);
+	cancel_work_sync(&dev_priv->dig_port_work);

Since dig_port_work can queue a hotplug_work shouldn't these two be swapped?

Right, will fix that.

Quoted 3 lines

I wonder if we should also clear hpd_event_bits and {long,short}_hpd_port_mask before cancelling the works? At least it might make the works end a bit quicker if the are already running.

Makes sense for speed, will fix it. Another thing is that a final instance of these works can now run with interrupts disabled that could cause DP AUX timeouts for example. That could be avoided for example by adding a new dev_priv->hpd_irqs_disabled flag and setting it before disabling interrupts, but I didn't want to make things more complicated before getting some feedback.

Quoted 3 lines

I also noticed that we don't seem to grab any rpm/powerwell references in ->hpd_pulse() or i915_digport_work_func(). That doesn't seem right. Or maybe you already addressed that in another patch?

No, I haven't. I thought it's enough that all low level functions like DPCD read, link training do take already the needed refs. Isn't that enough?

--Imre

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

#3 lore raw
Quoted 44 lines · Imre Deak
Quoted 22 lines · Ville Syrjälä
Quoted 21 lines · Imre Deak

Make sure these work handlers don't run after we system suspend or unload the driver. Note that we don't cancel the handlers during runtime suspend. That could lead to a lockup, since we take a runtime PM ref from the handlers themselves. Fortunaltely canceling there is not needed since the RPM ref itself provides for the needed serialization.

---
 drivers/gpu/drm/i915/i915_drv.c      | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h      | 1 +
 drivers/gpu/drm/i915/intel_display.c | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ec96f9a..0653761 100644
@@ -494,6 +494,13 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 	return true;
 }
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c bool i915_semaphore_is_enabled(struct drm_device *dev) · line 500

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
+{
+	cancel_work_sync(&dev_priv->hotplug_work);
+	cancel_work_sync(&dev_priv->dig_port_work);

Since dig_port_work can queue a hotplug_work shouldn't these two be swapped?

Right, will fix that.

Quoted 3 lines

I wonder if we should also clear hpd_event_bits and {long,short}_hpd_port_mask before cancelling the works? At least it might make the works end a bit quicker if the are already running.

Makes sense for speed, will fix it. Another thing is that a final instance of these works can now run with interrupts disabled that could cause DP AUX timeouts for example. That could be avoided for example by adding a new dev_priv->hpd_irqs_disabled flag and setting it before disabling interrupts, but I didn't want to make things more complicated before getting some feedback.

Quoted 7 lines
Quoted 3 lines

I also noticed that we don't seem to grab any rpm/powerwell references in ->hpd_pulse() or i915_digport_work_func(). That doesn't seem right. Or maybe you already addressed that in another patch?

No, I haven't. I thought it's enough that all low level functions like DPCD read, link training do take already the needed refs. Isn't that enough?

There's at least the call to ibx_digital_port_connected() which isn't covered by any rpm/powerwell reference.

Signature · 2 lines
Ville Syrjälä
Intel OTC
author
#4 lore raw
Quoted 49 lines · Ville Syrjälä
Quoted 48 lines · Imre Deak
Quoted 22 lines · Ville Syrjälä
Quoted 21 lines · Imre Deak

Make sure these work handlers don't run after we system suspend or unload the driver. Note that we don't cancel the handlers during runtime suspend. That could lead to a lockup, since we take a runtime PM ref from the handlers themselves. Fortunaltely canceling there is not needed since the RPM ref itself provides for the needed serialization.

---
 drivers/gpu/drm/i915/i915_drv.c      | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h      | 1 +
 drivers/gpu/drm/i915/intel_display.c | 3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index ec96f9a..0653761 100644
@@ -494,6 +494,13 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
 	return true;
 }
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c bool i915_semaphore_is_enabled(struct drm_device *dev) · line 500

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
+void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
+{
+	cancel_work_sync(&dev_priv->hotplug_work);
+	cancel_work_sync(&dev_priv->dig_port_work);

Since dig_port_work can queue a hotplug_work shouldn't these two be swapped?

Right, will fix that.

Quoted 3 lines

I wonder if we should also clear hpd_event_bits and {long,short}_hpd_port_mask before cancelling the works? At least it might make the works end a bit quicker if the are already running.

Makes sense for speed, will fix it. Another thing is that a final instance of these works can now run with interrupts disabled that could cause DP AUX timeouts for example. That could be avoided for example by adding a new dev_priv->hpd_irqs_disabled flag and setting it before disabling interrupts, but I didn't want to make things more complicated before getting some feedback.

Quoted 3 lines

I also noticed that we don't seem to grab any rpm/powerwell references in ->hpd_pulse() or i915_digport_work_func(). That doesn't seem right. Or maybe you already addressed that in another patch?

Quoted 6 lines
Quoted 3 lines

No, I haven't. I thought it's enough that all low level functions like DPCD read, link training do take already the needed refs. Isn't that enough?

There's at least the call to ibx_digital_port_connected() which isn't covered by any rpm/powerwell reference.

Right, haven't noticed :/ I can fix this by taking the display port power domain around ->hpd_pulse(), similar to all the other DP encoder/connector handlers (get_modes, detect etc.).

--Imre

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