gfx: pvr: Fix spinlock usage in ossync code
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 9 Mar 2012 15:26:06 +0000 (17:26 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:30:31 +0000 (12:30 +0300)
PVRSRVCallbackOnSync2() can be called with interrupts off, so use
spin_lock_irqsave() and spin_unlock_irqrestore().

[  104.859125] WARNING: at linux/kernel/lockdep.c:2507 trace_hardirqs_on_caller+0xb3/0x159()
[  104.871022] Modules linked in: btwilink wl12xx_compat(C) mac80211_compat(C) cfg80211_compat(C) compat(C) fm_drv st_drv fuse atomisp
 snd_soc_mfld_machine snd_soc_sn95031 snd_soc_sst_platform lm3554 mt9m114 mt9e013 videobuf_vmalloc videobuf_core pn544_nxp atmel_mxt_t
s
[  104.894610] Pid: 0, comm: swapper Tainted: G        WC  3.0.22-mid10-00062-g597558c-dirty #14
[  104.903174] Call Trace:
[  104.905603]  [<c1036b34>] warn_slowpath_common+0x4b/0x60
[  104.910903]  [<c1061a2b>] ? trace_hardirqs_on_caller+0xb3/0x159
[  104.916866]  [<c14edbdb>] ? _raw_spin_unlock_irq+0x22/0x43
[  104.922336]  [<c1036b58>] warn_slowpath_null+0xf/0x13
[  104.927429]  [<c1061a2b>] trace_hardirqs_on_caller+0xb3/0x159
[  104.933160]  [<c1061adc>] trace_hardirqs_on+0xb/0xd
[  104.938275]  [<c14edbdb>] _raw_spin_unlock_irq+0x22/0x43
[  104.943696]  [<c1384e29>] PVRSRVCallbackOnSync2+0x5f/0x71
[  104.949325]  [<c13a9291>] psb_fb_increase_read_ops_completed+0x3c/0x5a
[  104.955959]  [<c13b0787>] crtc_flip_complete+0xc5/0xe8
[  104.961326]  [<c139d612>] drm_flip_complete+0x17/0x6e
[  104.966480]  [<c139d8b7>] drm_flip_helper_vblank+0x53/0x9c
[  104.972192]  [<c13b05fe>] psb_intel_crtc_process_vblank+0x62/0x6a
[  104.978391]  [<c13af0b6>] mid_pipe_event_handler+0x224/0x291
[  104.984288]  [<c13af26a>] psb_irq_handler+0x147/0x1e2
[  104.989451]  [<c1081543>] handle_irq_event_percpu+0xb8/0x269
[  104.995343]  [<c1081720>] handle_irq_event+0x2c/0x43
[  105.000405]  [<c1083343>] ? handle_percpu_irq+0x3b/0x3b
[  105.005863]  [<c10833ed>] handle_edge_irq+0xaa/0xd0
[  105.010830]  <IRQ>  [<c10036fc>] ? do_IRQ+0x38/0x90
[  105.015908]  [<c14eecf5>] ? common_interrupt+0x35/0x3c
[  105.021284]  [<c124a4ee>] ? soc_s0ix_idle+0x19e/0x1ea
[  105.026443]  [<c134cef4>] ? cpuidle_idle_call+0x100/0x1ac
[  105.032070]  [<c1001a3b>] ? cpu_idle+0x93/0xc4
[  105.036629]  [<c14d8033>] ? rest_init+0xab/0xb0
[  105.041391]  [<c17a983b>] ? start_kernel+0x363/0x368
[  105.046454]  [<c17a90bc>] ? i386_start_kernel+0xbc/0xc3

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/pvr/services4/srvkm/env/linux/ossync.c

index b232d0e..751a6c0 100644 (file)
@@ -50,7 +50,10 @@ void
 PVRSRVCallbackOnSync2(struct pvr_pending_sync *pending_sync)
 {
        bool complete = false;
-       spin_lock_irq(&sync_lock);
+       unsigned long flags;
+
+       spin_lock_irqsave(&sync_lock, flags);
+
        /* If the object is already in sync, don't add it to the list */
        if (!pending_ops_completed(pending_sync->sync_info,
                                  pending_sync->flags,
@@ -60,7 +63,7 @@ PVRSRVCallbackOnSync2(struct pvr_pending_sync *pending_sync)
        else
                complete = true;
 
-       spin_unlock_irq(&sync_lock);
+       spin_unlock_irqrestore(&sync_lock, flags);
 
        if (complete)
                pending_sync->callback(pending_sync, false);