diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-12-16 17:17:09 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-17 20:22:31 -0500 |
commit | ed8b67040965e4fe695db333d5914e18ea5f146f (patch) | |
tree | 6fd9f50130f7ccaccf8070f7821ea8eb6743854c /drivers/gpu/drm/mga | |
parent | dcd6dfcfe959bade75fbf49499775985d2cac5d5 (diff) |
drm: convert drm_ioctl to unlocked_ioctl
drm_ioctl is called with the Big Kernel Lock held,
which shows up very high in statistics on vfs_ioctl.
Moving the lock into the drm_ioctl function itself
makes sure we blame the right subsystem and it gets
us one step closer to eliminating the locked version
of fops->ioctl.
Since drm_ioctl does not require the lock itself,
we only need to hold it while calling the specific
handler. The 32 bit conversion handlers do not
interact with any other code, so they don't need
the BKL here either and can just call drm_ioctl.
As a bonus, this cleans up all the other users
of drm_ioctl which now no longer have to find
the inode or call lock_kernel.
[airlied: squashed the non-driver bits
of the second patch in here, this provides
the flag for drivers to use to select unlocked
ioctls - but doesn't modify any drivers].
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.sourceforge.net
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/mga')
-rw-r--r-- | drivers/gpu/drm/mga/mga_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/mga/mga_ioc32.c | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c index 97ee566ef749..ddfe16197b59 100644 --- a/drivers/gpu/drm/mga/mga_drv.c +++ b/drivers/gpu/drm/mga/mga_drv.c | |||
@@ -68,7 +68,7 @@ static struct drm_driver driver = { | |||
68 | .owner = THIS_MODULE, | 68 | .owner = THIS_MODULE, |
69 | .open = drm_open, | 69 | .open = drm_open, |
70 | .release = drm_release, | 70 | .release = drm_release, |
71 | .ioctl = drm_ioctl, | 71 | .unlocked_ioctl = drm_ioctl, |
72 | .mmap = drm_mmap, | 72 | .mmap = drm_mmap, |
73 | .poll = drm_poll, | 73 | .poll = drm_poll, |
74 | .fasync = drm_fasync, | 74 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c index 30d00478ddee..c1f877b7bac1 100644 --- a/drivers/gpu/drm/mga/mga_ioc32.c +++ b/drivers/gpu/drm/mga/mga_ioc32.c | |||
@@ -100,8 +100,7 @@ static int compat_mga_init(struct file *file, unsigned int cmd, | |||
100 | if (err) | 100 | if (err) |
101 | return -EFAULT; | 101 | return -EFAULT; |
102 | 102 | ||
103 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 103 | return drm_ioctl(file, DRM_IOCTL_MGA_INIT, (unsigned long)init); |
104 | DRM_IOCTL_MGA_INIT, (unsigned long)init); | ||
105 | } | 104 | } |
106 | 105 | ||
107 | typedef struct drm_mga_getparam32 { | 106 | typedef struct drm_mga_getparam32 { |
@@ -125,8 +124,7 @@ static int compat_mga_getparam(struct file *file, unsigned int cmd, | |||
125 | &getparam->value)) | 124 | &getparam->value)) |
126 | return -EFAULT; | 125 | return -EFAULT; |
127 | 126 | ||
128 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 127 | return drm_ioctl(file, DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam); |
129 | DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam); | ||
130 | } | 128 | } |
131 | 129 | ||
132 | typedef struct drm_mga_drm_bootstrap32 { | 130 | typedef struct drm_mga_drm_bootstrap32 { |
@@ -166,8 +164,7 @@ static int compat_mga_dma_bootstrap(struct file *file, unsigned int cmd, | |||
166 | || __put_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size)) | 164 | || __put_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size)) |
167 | return -EFAULT; | 165 | return -EFAULT; |
168 | 166 | ||
169 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 167 | err = drm_ioctl(file, DRM_IOCTL_MGA_DMA_BOOTSTRAP, |
170 | DRM_IOCTL_MGA_DMA_BOOTSTRAP, | ||
171 | (unsigned long)dma_bootstrap); | 168 | (unsigned long)dma_bootstrap); |
172 | if (err) | 169 | if (err) |
173 | return err; | 170 | return err; |
@@ -220,12 +217,10 @@ long mga_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
220 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) | 217 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) |
221 | fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; | 218 | fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; |
222 | 219 | ||
223 | lock_kernel(); /* XXX for now */ | ||
224 | if (fn != NULL) | 220 | if (fn != NULL) |
225 | ret = (*fn) (filp, cmd, arg); | 221 | ret = (*fn) (filp, cmd, arg); |
226 | else | 222 | else |
227 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | 223 | ret = drm_ioctl(filp, cmd, arg); |
228 | unlock_kernel(); | ||
229 | 224 | ||
230 | return ret; | 225 | return ret; |
231 | } | 226 | } |