summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/powervr-drivers/omap3-sgx-modules-5.01.01.01/0003-SGX-displayclass-am335x-am437x-fix-mutex-deadlock-wa.patch
blob: 0e2902d3ef44f1e3b13414ca44691228abdd6821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
From cf5156ff82e14fe01a194f9fa9a9adc528ac72f0 Mon Sep 17 00:00:00 2001
From: Darren Etheridge <detheridge@ti.com>
Date: Tue, 29 Jul 2014 15:39:56 -0500
Subject: [PATCH 3/4] SGX: displayclass: am335x, am437x - fix mutex deadlock
 warning

Rearrange the locking semantics in the Unblank screen function to
remove the kernel warning about a possible deadlock scenario.

The warning presents itself on the console like this:
[ 2976.202979] ======================================================
[ 2976.202983] [ INFO: possible circular locking dependency detected ]
[ 2976.202994] 3.14.11-00997-gb20d0ac-dirty #53 Tainted: G           O
[ 2976.202997] -------------------------------------------------------
[ 2976.203005] OGLES2Chameleon/1203 is trying to acquire lock:
[ 2976.203058]  (console_lock){+.+.+.}, at: [<bf07a310>]
OMAPLFBUnblankDisplay+0x24/0xbc [omaplfb]
[ 2976.203062]
[ 2976.203062] but task is already holding lock:
[ 2976.203087]  (&fb_info->lock){+.+.+.}, at: [<c0312358>]
lock_fb_info+0x18/0x3c
[ 2976.203090]
[ 2976.203090] which lock already depends on the new lock.
[ 2976.203090]
[ 2976.203093]
[ 2976.203093] the existing dependency chain (in reverse order) is:
[ 2976.203101]
[ 2976.203101] -> #1 (&fb_info->lock){+.+.+.}:
[ 2976.203112]        [<c0312358>] lock_fb_info+0x18/0x3c
[ 2976.203124]        [<c0313a7c>] register_framebuffer+0x174/0x26c
[ 2976.203146]        [<c033c314>] omapfb_create_framebuffers+0x48c/0x7ac
[ 2976.203157]        [<c033d3c4>] omapfb_probe+0x4d4/0x848
[ 2976.203170]        [<c0381cc8>] platform_drv_probe+0x18/0x48
[ 2976.203189]        [<c038096c>] driver_probe_device+0x10c/0x238
[ 2976.203199]        [<c0380b2c>] __driver_attach+0x94/0x98
[ 2976.203208]        [<c037f0f0>] bus_for_each_dev+0x54/0x88
[ 2976.203216]        [<c03800f0>] bus_add_driver+0xd8/0x1d8
[ 2976.203223]        [<c038115c>] driver_register+0x78/0xf4
[ 2976.203234]        [<c0008968>] do_one_initcall+0xe4/0x144
[ 2976.203250]        [<c07d3c18>] kernel_init_freeable+0xfc/0x1cc
[ 2976.203261]        [<c0563260>] kernel_init+0x8/0xec
[ 2976.203275]        [<c000e648>] ret_from_fork+0x14/0x2c
[ 2976.203284]
[ 2976.203284] -> #0 (console_lock){+.+.+.}:
[ 2976.203301]        [<c008bc00>] console_lock+0x4c/0x60
[ 2976.203328]        [<bf07a310>] OMAPLFBUnblankDisplay+0x24/0xbc [omaplfb]
[ 2976.203340]        [<bf0797f4>] OpenDCDevice+0x60/0x78 [omaplfb]
[ 2976.203459]        [<bf041ac0>] PVRSRVOpenDCDeviceKM+0xec/0x178 [pvrsrvkm]
[ 2976.203654]        [<bf05645c>] PVRSRVOpenDCDeviceBW+0x6c/0xac [pvrsrvkm]
[ 2976.203811]        [<bf056d10>] BridgedDispatchKM+0xf4/0x14c [pvrsrvkm]
[ 2976.203966]        [<bf04f304>] PVRSRV_BridgeDispatchKM+0xf0/0x204
[pvrsrvkm]
[ 2976.203987]        [<c0129500>] do_vfs_ioctl+0x78/0x61c
[ 2976.203997]        [<c0129b08>] SyS_ioctl+0x64/0x74
[ 2976.204013]        [<c000e580>] ret_fast_syscall+0x0/0x48
[ 2976.204016]
[ 2976.204016] other info that might help us debug this:
[ 2976.204016]
[ 2976.204019]  Possible unsafe locking scenario:
[ 2976.204019]
[ 2976.204022]        CPU0                    CPU1
[ 2976.204024]        ----                    ----
[ 2976.204030]   lock(&fb_info->lock);
[ 2976.204036]                                lock(console_lock);
[ 2976.204041]                                lock(&fb_info->lock);
[ 2976.204046]   lock(console_lock);
[ 2976.204048]
[ 2976.204048]  *** DEADLOCK ***
[ 2976.204048]
[ 2976.204055] 2 locks held by OGLES2Chameleon/1203:
[ 2976.204217]  #0:  (psPVRSRVMutex#2/1){+.+.+.}, at: [<bf04f238>]
PVRSRV_BridgeDispatchKM+0x24/0x204 [pvrsrvkm]
[ 2976.204240]  #1:  (&fb_info->lock){+.+.+.}, at: [<c0312358>]
lock_fb_info+0x18/0x3c

Signed-off-by: Darren Etheridge <detheridge@ti.com>
---
 GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux/omaplfb_linux.c | 8 +++++---
 GFX_Linux_KM/services4/3rdparty/dc_ti43xx_linux/omaplfb_linux.c | 7 +++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux/omaplfb_linux.c b/GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux/omaplfb_linux.c
index 3857b95..a5cc7d0 100644
--- a/GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux/omaplfb_linux.c
+++ b/GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux/omaplfb_linux.c
@@ -812,10 +812,13 @@ static OMAPLFB_ERROR OMAPLFBBlankOrUnblankDisplay(OMAPLFB_DEVINFO *psDevInfo, IM
 {
 #ifdef FBDEV_PRESENT
 	int res;
+
+	OMAPLFB_CONSOLE_LOCK();
 	if (!lock_fb_info(psDevInfo->psLINFBInfo))
 	{
 		printk(KERN_ERR DRIVER_PREFIX
 			": %s: Device %u: Couldn't lock FB info\n", __FUNCTION__,  psDevInfo->uiFBDevID);
+		OMAPLFB_CONSOLE_UNLOCK();
 		return (OMAPLFB_ERROR_GENERIC);
 	}
 
@@ -825,14 +828,13 @@ static OMAPLFB_ERROR OMAPLFBBlankOrUnblankDisplay(OMAPLFB_DEVINFO *psDevInfo, IM
 	* notification.
 	*/
 
-
-	OMAPLFB_CONSOLE_LOCK();
 	psDevInfo->psLINFBInfo->flags |= FBINFO_MISC_USEREVENT;
 	res = fb_blank(psDevInfo->psLINFBInfo, bBlank ? 1 : 0);
 	psDevInfo->psLINFBInfo->flags &= ~FBINFO_MISC_USEREVENT;
 
-	OMAPLFB_CONSOLE_UNLOCK();
 	unlock_fb_info(psDevInfo->psLINFBInfo);
+	OMAPLFB_CONSOLE_UNLOCK();
+
 	if (res != 0 && res != -EINVAL)
 	{
 		printk(KERN_ERR DRIVER_PREFIX
diff --git a/GFX_Linux_KM/services4/3rdparty/dc_ti43xx_linux/omaplfb_linux.c b/GFX_Linux_KM/services4/3rdparty/dc_ti43xx_linux/omaplfb_linux.c
index c79dbd0..58b8640 100755
--- a/GFX_Linux_KM/services4/3rdparty/dc_ti43xx_linux/omaplfb_linux.c
+++ b/GFX_Linux_KM/services4/3rdparty/dc_ti43xx_linux/omaplfb_linux.c
@@ -948,10 +948,13 @@ static OMAPLFB_ERROR OMAPLFBBlankOrUnblankDisplay(OMAPLFB_DEVINFO *psDevInfo, IM
 {
 #ifdef FBDEV_PRESENT
 	int res;
+
+	OMAPLFB_CONSOLE_LOCK();
 	if (!lock_fb_info(psDevInfo->psLINFBInfo))
 	{
 		printk(KERN_ERR DRIVER_PREFIX
 		": %s: Device %u: Couldn't lock FB info\n", __FUNCTION__,  psDevInfo->uiFBDevID);
+		OMAPLFB_CONSOLE_UNLOCK();
 		return (OMAPLFB_ERROR_GENERIC);
 	}
 
@@ -961,13 +964,13 @@ static OMAPLFB_ERROR OMAPLFBBlankOrUnblankDisplay(OMAPLFB_DEVINFO *psDevInfo, IM
 	* notification.
 	*/
 
-	OMAPLFB_CONSOLE_LOCK();
 	psDevInfo->psLINFBInfo->flags |= FBINFO_MISC_USEREVENT;
 	res = fb_blank(psDevInfo->psLINFBInfo, bBlank ? 1 : 0);
 	psDevInfo->psLINFBInfo->flags &= ~FBINFO_MISC_USEREVENT;
 
-	OMAPLFB_CONSOLE_UNLOCK();
 	unlock_fb_info(psDevInfo->psLINFBInfo);
+	OMAPLFB_CONSOLE_UNLOCK();
+
 	if (res != 0 && res != -EINVAL)
 	{
 		printk(KERN_ERR DRIVER_PREFIX
-- 
1.9.1