[Intel-gfx] [PATCH 1/5] drm/i915: Convert RPS irq worker into a tasklet

Chris Wilson chris at chris-wilson.co.uk
Thu May 19 07:48:30 UTC 2016


Using a tasklet for an irq bottom-half is the preferred form as it
should ensure minimal latency from the irq to execution of the tasklet.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h |  2 +-
 drivers/gpu/drm/i915/i915_irq.c | 13 +++++++------
 drivers/gpu/drm/i915/intel_pm.c |  2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 72f0b02a8372..b3b81c60bbb3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1128,7 +1128,7 @@ struct intel_gen6_power_mgmt {
 	 * work, interrupts_enabled and pm_iir are protected by
 	 * dev_priv->irq_lock
 	 */
-	struct work_struct work;
+	struct tasklet_struct task;
 	bool interrupts_enabled;
 	u32 pm_iir;
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index f0d941455bed..a4ca9471f3f4 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -385,7 +385,7 @@ void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv)
 	dev_priv->rps.interrupts_enabled = false;
 	spin_unlock_irq(&dev_priv->irq_lock);
 
-	cancel_work_sync(&dev_priv->rps.work);
+	tasklet_kill(&dev_priv->rps.task);
 
 	spin_lock_irq(&dev_priv->irq_lock);
 
@@ -1081,10 +1081,9 @@ static bool any_waiters(struct drm_i915_private *dev_priv)
 	return false;
 }
 
-static void gen6_pm_rps_work(struct work_struct *work)
+static void gen6_pm_rps_work(unsigned long data)
 {
-	struct drm_i915_private *dev_priv =
-		container_of(work, struct drm_i915_private, rps.work);
+	struct drm_i915_private *dev_priv = (struct drm_i915_private *)data;
 	bool client_boost;
 	int new_delay, adj, min, max;
 	u32 pm_iir;
@@ -1614,7 +1613,7 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 		gen6_disable_pm_irq(dev_priv, pm_iir & dev_priv->pm_rps_events);
 		if (dev_priv->rps.interrupts_enabled) {
 			dev_priv->rps.pm_iir |= pm_iir & dev_priv->pm_rps_events;
-			queue_work(dev_priv->wq, &dev_priv->rps.work);
+			tasklet_schedule(&dev_priv->rps.task);
 		}
 		spin_unlock(&dev_priv->irq_lock);
 	}
@@ -4570,7 +4569,9 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 
 	intel_hpd_init_work(dev_priv);
 
-	INIT_WORK(&dev_priv->rps.work, gen6_pm_rps_work);
+	tasklet_init(&dev_priv->rps.task,
+		     gen6_pm_rps_work,
+		     (unsigned long)dev_priv);
 	INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work);
 
 	/* Let's track the enabled rps events */
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index adb64638f595..0e4f783b5da9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4748,7 +4748,7 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv,
 		spin_lock_irq(&dev_priv->irq_lock);
 		if (dev_priv->rps.interrupts_enabled) {
 			dev_priv->rps.client_boost = true;
-			queue_work(dev_priv->wq, &dev_priv->rps.work);
+			tasklet_schedule(&dev_priv->rps.task);
 		}
 		spin_unlock_irq(&dev_priv->irq_lock);
 
-- 
2.8.1



More information about the Intel-gfx mailing list