Displaying 3 results from an estimated 3 matches for "ioctls_rwsem".
2012 Apr 22
1
[PATCH 1/5] drm: add optional per device rwsem for all ioctls
.../drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 6116e3b..c54e9f8 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -464,6 +464,9 @@ long drm_ioctl(struct file *filp,
} else
memset(kdata, 0, usize);
+ if (dev->driver->ioctls_need_rwsem)
+ down_read(&dev->ioctls_rwsem);
+
if (ioctl->flags & DRM_UNLOCKED)
retcode = func(dev, kdata, file_priv);
else {
@@ -472,6 +475,9 @@ long drm_ioctl(struct file *filp,
mutex_unlock(&drm_global_mutex);
}
+ if (dev->driver->ioctls_need_rwsem)
+ up_read(&dev->ioctls_rwsem);
+
if (cmd...
2012 Apr 25
5
[PATCH v2 4/4] drm/nouveau: gpu lockup recovery
...file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ struct drm_file *file_priv = filp->private_data;
+ struct drm_device *dev = file_priv->minor->dev;
+ struct drm_nouveau_private *dev_priv = dev->dev_private;
+
+ long ret = intr_rwsem_down_read_interruptible(&dev_priv->ioctls_rwsem);
+ if (ret)
+ return ret;
+
+ ret = drm_ioctl(filp, cmd, arg);
+
+ intr_rwsem_up_read(&dev_priv->ioctls_rwsem);
+
+ return ret;
+}
+
static const struct file_operations nouveau_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
- .unlocked_ioctl = drm_io...
2012 Apr 22
2
[RFC PATCH 5/5] drm/nouveau: gpu lockup recovery
...ouveau_drv.h"
+
+static bool off(struct drm_device *dev)
+{
+ struct pci_dev *pdev = dev->pdev;
+ struct drm_nouveau_private *dev_priv = dev->dev_private;
+
+ pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
+ atomic_inc(&dev_priv->gpureset_in_progress);
+ down_write(&dev->ioctls_rwsem);
+
+ dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
+ if (nouveau_pci_suspend(pdev, pmm))
+ goto fail;
+
+ dev->switch_power_state = DRM_SWITCH_POWER_OFF;
+ return true;
+
+fail:
+ dev->switch_power_state = DRM_SWITCH_POWER_ON;
+ up_write(&dev->ioctls_rwsem);
+ return false;...