drm/i915: s/assert_spin_locked/lockdep_assert_held/
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 2 Mar 2017 13:28:01 +0000 (13:28 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 2 Mar 2017 15:18:55 +0000 (15:18 +0000)
assert_spin_locked() becomes an unconditionally compiled BUG_ON(),
adding debug code right into the heart of critical routines like
interrupt handlers.

   text    data     bss     dec     hex
1296480   19944    2272 1318696  141f28 before (lockdep disabled)
1295984   19944    2272 1318200  141d38 after

1336261   21139    3208 1360608  14c2e0 before (lockdep enabled)
1339920   21139    3208 1364267  14d12b after

Small saving for release; hopefully more instructive in debug.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302132801.599-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_gem_request.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_perf.c
drivers/gpu/drm/i915/intel_breadcrumbs.c
drivers/gpu/drm/i915/intel_fifo_underrun.c
drivers/gpu/drm/i915/intel_hotplug.c
drivers/gpu/drm/i915/intel_pipe_crc.c
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_uncore.c

index 582471c00fce1281ae984a19bf4118818b51f2e3..b881d4e1bd1e2fd76c73d1f74e2672c0c0f6c3e8 100644 (file)
@@ -401,7 +401,7 @@ void __i915_gem_request_submit(struct drm_i915_gem_request *request)
        u32 seqno;
 
        GEM_BUG_ON(!irqs_disabled());
-       assert_spin_locked(&engine->timeline->lock);
+       lockdep_assert_held(&engine->timeline->lock);
 
        trace_i915_gem_request_execute(request);
 
@@ -449,7 +449,7 @@ void __i915_gem_request_unsubmit(struct drm_i915_gem_request *request)
        struct intel_timeline *timeline;
 
        GEM_BUG_ON(!irqs_disabled());
-       assert_spin_locked(&engine->timeline->lock);
+       lockdep_assert_held(&engine->timeline->lock);
 
        /* Only unwind in reverse order, required so that the per-context list
         * is kept in seqno/ring order.
index 19892854707fd7f5b168ab6a7203ded2158ee82b..e0aa686f9c68d7774081158910c15abd580492c9 100644 (file)
@@ -180,7 +180,7 @@ i915_hotplug_interrupt_update_locked(struct drm_i915_private *dev_priv,
 {
        uint32_t val;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
        WARN_ON(bits & ~mask);
 
        val = I915_READ(PORT_HOTPLUG_EN);
@@ -222,7 +222,7 @@ void ilk_update_display_irq(struct drm_i915_private *dev_priv,
 {
        uint32_t new_val;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
@@ -250,7 +250,7 @@ static void ilk_update_gt_irq(struct drm_i915_private *dev_priv,
                              uint32_t interrupt_mask,
                              uint32_t enabled_irq_mask)
 {
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
@@ -302,7 +302,7 @@ static void snb_update_pm_irq(struct drm_i915_private *dev_priv,
 
        WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        new_val = dev_priv->pm_imr;
        new_val &= ~interrupt_mask;
@@ -340,7 +340,7 @@ void gen6_reset_pm_iir(struct drm_i915_private *dev_priv, u32 reset_mask)
 {
        i915_reg_t reg = gen6_pm_iir(dev_priv);
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        I915_WRITE(reg, reset_mask);
        I915_WRITE(reg, reset_mask);
@@ -349,7 +349,7 @@ void gen6_reset_pm_iir(struct drm_i915_private *dev_priv, u32 reset_mask)
 
 void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, u32 enable_mask)
 {
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        dev_priv->pm_ier |= enable_mask;
        I915_WRITE(gen6_pm_ier(dev_priv), dev_priv->pm_ier);
@@ -359,7 +359,7 @@ void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, u32 enable_mask)
 
 void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, u32 disable_mask)
 {
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        dev_priv->pm_ier &= ~disable_mask;
        __gen6_mask_pm_irq(dev_priv, disable_mask);
@@ -463,7 +463,7 @@ static void bdw_update_port_irq(struct drm_i915_private *dev_priv,
        uint32_t new_val;
        uint32_t old_val;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
@@ -496,7 +496,7 @@ void bdw_update_pipe_irq(struct drm_i915_private *dev_priv,
 {
        uint32_t new_val;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
@@ -530,7 +530,7 @@ void ibx_display_interrupt_update(struct drm_i915_private *dev_priv,
 
        WARN_ON(enabled_irq_mask & ~interrupt_mask);
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if (WARN_ON(!intel_irqs_enabled(dev_priv)))
                return;
@@ -546,7 +546,7 @@ __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
        i915_reg_t reg = PIPESTAT(pipe);
        u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
        WARN_ON(!intel_irqs_enabled(dev_priv));
 
        if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
@@ -573,7 +573,7 @@ __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
        i915_reg_t reg = PIPESTAT(pipe);
        u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
        WARN_ON(!intel_irqs_enabled(dev_priv));
 
        if (WARN_ONCE(enable_mask & ~PIPESTAT_INT_ENABLE_MASK ||
@@ -3399,7 +3399,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 
 void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv)
 {
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if (dev_priv->display_irqs_enabled)
                return;
@@ -3414,7 +3414,7 @@ void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv)
 
 void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv)
 {
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if (!dev_priv->display_irqs_enabled)
                return;
@@ -4090,7 +4090,7 @@ static void i915_hpd_irq_setup(struct drm_i915_private *dev_priv)
 {
        u32 hotplug_en;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        /* Note HDMI and DP share hotplug bits */
        /* enable bits are the same for all generations */
index a1b7eec58be2742e6d94e5566b09fbb61e54df9d..8c121187ff390df2800a41d659a0df76b4c83552 100644 (file)
@@ -1008,7 +1008,7 @@ static void hsw_disable_metric_set(struct drm_i915_private *dev_priv)
 
 static void gen7_update_oacontrol_locked(struct drm_i915_private *dev_priv)
 {
-       assert_spin_locked(&dev_priv->perf.hook_lock);
+       lockdep_assert_held(&dev_priv->perf.hook_lock);
 
        if (dev_priv->perf.oa.exclusive_stream->enabled) {
                struct i915_gem_context *ctx =
index ba54dd1949e88e30040f95b29f96e7d130ab1382..235d4645a5cf9acf0ea9a1fb083dbc99f3ef0d14 100644 (file)
@@ -164,7 +164,7 @@ void __intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine)
 {
        struct intel_breadcrumbs *b = &engine->breadcrumbs;
 
-       assert_spin_locked(&b->lock);
+       lockdep_assert_held(&b->lock);
 
        if (b->irq_enabled) {
                irq_disable(engine);
@@ -228,7 +228,7 @@ static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b)
                container_of(b, struct intel_engine_cs, breadcrumbs);
        struct drm_i915_private *i915 = engine->i915;
 
-       assert_spin_locked(&b->lock);
+       lockdep_assert_held(&b->lock);
        if (b->irq_armed)
                return;
 
@@ -276,7 +276,7 @@ static inline struct intel_wait *to_wait(struct rb_node *node)
 static inline void __intel_breadcrumbs_finish(struct intel_breadcrumbs *b,
                                              struct intel_wait *wait)
 {
-       assert_spin_locked(&b->lock);
+       lockdep_assert_held(&b->lock);
 
        /* This request is completed, so remove it from the tree, mark it as
         * complete, and *then* wake up the associated task.
@@ -432,7 +432,7 @@ static void __intel_engine_remove_wait(struct intel_engine_cs *engine,
 {
        struct intel_breadcrumbs *b = &engine->breadcrumbs;
 
-       assert_spin_locked(&b->lock);
+       lockdep_assert_held(&b->lock);
 
        if (RB_EMPTY_NODE(&wait->node))
                goto out;
@@ -654,7 +654,7 @@ void intel_engine_enable_signaling(struct drm_i915_gem_request *request)
 
        /* locked by dma_fence_enable_sw_signaling() (irqsafe fence->lock) */
        GEM_BUG_ON(!irqs_disabled());
-       assert_spin_locked(&request->lock);
+       lockdep_assert_held(&request->lock);
 
        seqno = i915_gem_request_global_seqno(request);
        if (!seqno)
@@ -711,7 +711,7 @@ void intel_engine_cancel_signaling(struct drm_i915_gem_request *request)
        struct intel_breadcrumbs *b = &engine->breadcrumbs;
 
        GEM_BUG_ON(!irqs_disabled());
-       assert_spin_locked(&request->lock);
+       lockdep_assert_held(&request->lock);
        GEM_BUG_ON(!request->signaling.wait.seqno);
 
        spin_lock(&b->lock);
index e660d8b4bbc3e06312b575fd0dcd94f770709871..f5ddacc90fde5a3130f3fcfec079a91b20b9ec92 100644 (file)
@@ -54,7 +54,7 @@ static bool ivb_can_enable_err_int(struct drm_device *dev)
        struct intel_crtc *crtc;
        enum pipe pipe;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        for_each_pipe(dev_priv, pipe) {
                crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
@@ -72,7 +72,7 @@ static bool cpt_can_enable_serr_int(struct drm_device *dev)
        enum pipe pipe;
        struct intel_crtc *crtc;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        for_each_pipe(dev_priv, pipe) {
                crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
@@ -90,7 +90,7 @@ static void i9xx_check_fifo_underruns(struct intel_crtc *crtc)
        i915_reg_t reg = PIPESTAT(crtc->pipe);
        u32 pipestat = I915_READ(reg) & 0xffff0000;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if ((pipestat & PIPE_FIFO_UNDERRUN_STATUS) == 0)
                return;
@@ -109,7 +109,7 @@ static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev,
        i915_reg_t reg = PIPESTAT(pipe);
        u32 pipestat = I915_READ(reg) & 0xffff0000;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if (enable) {
                I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS);
@@ -139,7 +139,7 @@ static void ivybridge_check_fifo_underruns(struct intel_crtc *crtc)
        enum pipe pipe = crtc->pipe;
        uint32_t err_int = I915_READ(GEN7_ERR_INT);
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if ((err_int & ERR_INT_FIFO_UNDERRUN(pipe)) == 0)
                return;
@@ -204,7 +204,7 @@ static void cpt_check_pch_fifo_underruns(struct intel_crtc *crtc)
        enum transcoder pch_transcoder = (enum transcoder) crtc->pipe;
        uint32_t serr_int = I915_READ(SERR_INT);
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        if ((serr_int & SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)) == 0)
                return;
@@ -248,7 +248,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
        struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
        bool old;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        old = !crtc->cpu_fifo_underrun_disabled;
        crtc->cpu_fifo_underrun_disabled = !enable;
index 0756bdc672b3f1cdf3cbbd594ae0591f00d2688d..ba763e7d7dcfdede1c708af9da0f205c84a7fdc5 100644 (file)
@@ -157,7 +157,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
        enum hpd_pin pin;
        bool hpd_disabled = false;
 
-       assert_spin_locked(&dev_priv->irq_lock);
+       lockdep_assert_held(&dev_priv->irq_lock);
 
        list_for_each_entry(connector, &mode_config->connector_list, head) {
                if (connector->polled != DRM_CONNECTOR_POLL_HPD)
index c0b1f99da37b34c914fe180c856bec51dc4c333f..c782b7878288d21a026a1a60f793c06d65fb8f21 100644 (file)
@@ -105,7 +105,7 @@ static int i915_pipe_crc_release(struct inode *inode, struct file *filep)
 
 static int pipe_crc_data_count(struct intel_pipe_crc *pipe_crc)
 {
-       assert_spin_locked(&pipe_crc->lock);
+       lockdep_assert_held(&pipe_crc->lock);
        return CIRC_CNT(pipe_crc->head, pipe_crc->tail,
                        INTEL_PIPE_CRC_ENTRIES_NR);
 }
index b00c95e4a81f6e5766796e972f52ff40f44027cb..50e672f842763e973e38a8fdc5944c7b8d8be62a 100644 (file)
@@ -4672,7 +4672,7 @@ bool ironlake_set_drps(struct drm_i915_private *dev_priv, u8 val)
 {
        u16 rgvswctl;
 
-       assert_spin_locked(&mchdev_lock);
+       lockdep_assert_held(&mchdev_lock);
 
        rgvswctl = I915_READ16(MEMSWCTL);
        if (rgvswctl & MEMCTL_CMD_STS) {
@@ -6203,7 +6203,7 @@ static unsigned long __i915_chipset_val(struct drm_i915_private *dev_priv)
        unsigned long now = jiffies_to_msecs(jiffies), diff1;
        int i;
 
-       assert_spin_locked(&mchdev_lock);
+       lockdep_assert_held(&mchdev_lock);
 
        diff1 = now - dev_priv->ips.last_time1;
 
@@ -6308,7 +6308,7 @@ static void __i915_update_gfx_val(struct drm_i915_private *dev_priv)
        u64 now, diff, diffms;
        u32 count;
 
-       assert_spin_locked(&mchdev_lock);
+       lockdep_assert_held(&mchdev_lock);
 
        now = ktime_get_raw_ns();
        diffms = now - dev_priv->ips.last_time2;
@@ -6353,7 +6353,7 @@ static unsigned long __i915_gfx_val(struct drm_i915_private *dev_priv)
        unsigned long t, corr, state1, corr2, state2;
        u32 pxvid, ext_v;
 
-       assert_spin_locked(&mchdev_lock);
+       lockdep_assert_held(&mchdev_lock);
 
        pxvid = I915_READ(PXVFREQ(dev_priv->rps.cur_freq));
        pxvid = (pxvid >> 24) & 0x7f;
index 441c51fd97469a6dbd585ea631e2fd5138ab9029..b35b7a03eeaf87f26e1e0be6b994ced838adce25 100644 (file)
@@ -506,7 +506,7 @@ void intel_uncore_forcewake_get(struct drm_i915_private *dev_priv,
 void intel_uncore_forcewake_get__locked(struct drm_i915_private *dev_priv,
                                        enum forcewake_domains fw_domains)
 {
-       assert_spin_locked(&dev_priv->uncore.lock);
+       lockdep_assert_held(&dev_priv->uncore.lock);
 
        if (!dev_priv->uncore.funcs.force_wake_get)
                return;
@@ -564,7 +564,7 @@ void intel_uncore_forcewake_put(struct drm_i915_private *dev_priv,
 void intel_uncore_forcewake_put__locked(struct drm_i915_private *dev_priv,
                                        enum forcewake_domains fw_domains)
 {
-       assert_spin_locked(&dev_priv->uncore.lock);
+       lockdep_assert_held(&dev_priv->uncore.lock);
 
        if (!dev_priv->uncore.funcs.force_wake_put)
                return;