Commit 0b74b508 authored by Xiong Zhang's avatar Xiong Zhang Committed by Daniel Vetter

drm/i915: add prefault_disable module option

prefault is stll enabled by default which prevent most of pwrite/pread/reloc
from running slow path, in order to verify these slow pathes, prefault need
to be disabled.
Signed-off-by: default avatarXiong Zhang <xiong.y.zhang@intel.com>
[danvet: Make checkpatch happy and bikeshed the module option help
text a bit.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 6286ef9b
...@@ -141,6 +141,11 @@ module_param_named(fastboot, i915_fastboot, bool, 0600); ...@@ -141,6 +141,11 @@ module_param_named(fastboot, i915_fastboot, bool, 0600);
MODULE_PARM_DESC(fastboot, "Try to skip unnecessary mode sets at boot time " MODULE_PARM_DESC(fastboot, "Try to skip unnecessary mode sets at boot time "
"(default: false)"); "(default: false)");
bool i915_prefault_disable __read_mostly;
module_param_named(prefault_disable, i915_prefault_disable, bool, 0600);
MODULE_PARM_DESC(prefault_disable,
"Disable page prefaulting for pread/pwrite/reloc (default:false). For developers only.");
static struct drm_driver driver; static struct drm_driver driver;
extern int intel_agp_enabled; extern int intel_agp_enabled;
......
...@@ -1627,6 +1627,7 @@ extern unsigned int i915_preliminary_hw_support __read_mostly; ...@@ -1627,6 +1627,7 @@ extern unsigned int i915_preliminary_hw_support __read_mostly;
extern int i915_disable_power_well __read_mostly; extern int i915_disable_power_well __read_mostly;
extern int i915_enable_ips __read_mostly; extern int i915_enable_ips __read_mostly;
extern bool i915_fastboot __read_mostly; extern bool i915_fastboot __read_mostly;
extern bool i915_prefault_disable __read_mostly;
extern int i915_suspend(struct drm_device *dev, pm_message_t state); extern int i915_suspend(struct drm_device *dev, pm_message_t state);
extern int i915_resume(struct drm_device *dev); extern int i915_resume(struct drm_device *dev);
......
...@@ -465,7 +465,7 @@ i915_gem_shmem_pread(struct drm_device *dev, ...@@ -465,7 +465,7 @@ i915_gem_shmem_pread(struct drm_device *dev,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (!prefaulted) { if (likely(!i915_prefault_disable) && !prefaulted) {
ret = fault_in_multipages_writeable(user_data, remain); ret = fault_in_multipages_writeable(user_data, remain);
/* Userspace is tricking us, but we've already clobbered /* Userspace is tricking us, but we've already clobbered
* its pages with the prefault and promised to write the * its pages with the prefault and promised to write the
...@@ -860,10 +860,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, ...@@ -860,10 +860,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
args->size)) args->size))
return -EFAULT; return -EFAULT;
ret = fault_in_multipages_readable(to_user_ptr(args->data_ptr), if (likely(!i915_prefault_disable)) {
args->size); ret = fault_in_multipages_readable(to_user_ptr(args->data_ptr),
if (ret) args->size);
return -EFAULT; if (ret)
return -EFAULT;
}
ret = i915_mutex_lock_interruptible(dev); ret = i915_mutex_lock_interruptible(dev);
if (ret) if (ret)
......
...@@ -759,8 +759,10 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, ...@@ -759,8 +759,10 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
if (!access_ok(VERIFY_WRITE, ptr, length)) if (!access_ok(VERIFY_WRITE, ptr, length))
return -EFAULT; return -EFAULT;
if (fault_in_multipages_readable(ptr, length)) if (likely(!i915_prefault_disable)) {
return -EFAULT; if (fault_in_multipages_readable(ptr, length))
return -EFAULT;
}
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment