Message ID | 1374213086-2337-1-git-send-email-xiong.y.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jul 19, 2013 at 01:51:24PM +0800, Xiong Zhang wrote: > 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: Xiong Zhang <xiong.y.zhang@intel.com> lgtm, queued for -next, thanks for the patch. -Daniel > --- > drivers/gpu/drm/i915/i915_drv.c | 5 +++++ > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/i915/i915_gem.c | 12 +++++++----- > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 ++++-- > 4 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index b07362f..dac6bd3 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -137,6 +137,11 @@ module_param_named(fastboot, i915_fastboot, bool, 0600); > MODULE_PARM_DESC(fastboot, "Try to skip unnecessary mode sets at boot time " > "(default: false)"); > > +bool i915_prefault_disable __read_mostly = false; > +module_param_named(prefault_disable, i915_prefault_disable, bool, 0600); > +MODULE_PARM_DESC(prefault_disable, > + "Try to disable pre page fault for pread/pwrite/reloc (default:false)"); > + > static struct drm_driver driver; > extern int intel_agp_enabled; > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 7fdc8e3..9516e19 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -1587,6 +1587,7 @@ extern unsigned int i915_preliminary_hw_support __read_mostly; > extern int i915_disable_power_well __read_mostly; > extern int i915_enable_ips __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_resume(struct drm_device *dev); > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index c9d9d20..de59154 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -465,7 +465,7 @@ i915_gem_shmem_pread(struct drm_device *dev, > > mutex_unlock(&dev->struct_mutex); > > - if (!prefaulted) { > + if (likely(!i915_prefault_disable) && !prefaulted) { > ret = fault_in_multipages_writeable(user_data, remain); > /* Userspace is tricking us, but we've already clobbered > * its pages with the prefault and promised to write the > @@ -860,10 +860,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, > args->size)) > return -EFAULT; > > - ret = fault_in_multipages_readable(to_user_ptr(args->data_ptr), > - args->size); > - if (ret) > - return -EFAULT; > + if (likely(!i915_prefault_disable)) { > + ret = fault_in_multipages_readable(to_user_ptr(args->data_ptr), > + args->size); > + if (ret) > + return -EFAULT; > + } > > ret = i915_mutex_lock_interruptible(dev); > if (ret) > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > index 1b58694..1734825 100644 > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > @@ -759,8 +759,10 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, > if (!access_ok(VERIFY_WRITE, ptr, length)) > return -EFAULT; > > - if (fault_in_multipages_readable(ptr, length)) > - return -EFAULT; > + if (likely(!i915_prefault_disable)) { > + if (fault_in_multipages_readable(ptr, length)) > + return -EFAULT; > + } > } > > return 0; > -- > 1.8.3.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index b07362f..dac6bd3 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -137,6 +137,11 @@ module_param_named(fastboot, i915_fastboot, bool, 0600); MODULE_PARM_DESC(fastboot, "Try to skip unnecessary mode sets at boot time " "(default: false)"); +bool i915_prefault_disable __read_mostly = false; +module_param_named(prefault_disable, i915_prefault_disable, bool, 0600); +MODULE_PARM_DESC(prefault_disable, + "Try to disable pre page fault for pread/pwrite/reloc (default:false)"); + static struct drm_driver driver; extern int intel_agp_enabled; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7fdc8e3..9516e19 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1587,6 +1587,7 @@ extern unsigned int i915_preliminary_hw_support __read_mostly; extern int i915_disable_power_well __read_mostly; extern int i915_enable_ips __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_resume(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c9d9d20..de59154 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -465,7 +465,7 @@ i915_gem_shmem_pread(struct drm_device *dev, mutex_unlock(&dev->struct_mutex); - if (!prefaulted) { + if (likely(!i915_prefault_disable) && !prefaulted) { ret = fault_in_multipages_writeable(user_data, remain); /* Userspace is tricking us, but we've already clobbered * its pages with the prefault and promised to write the @@ -860,10 +860,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, args->size)) return -EFAULT; - ret = fault_in_multipages_readable(to_user_ptr(args->data_ptr), - args->size); - if (ret) - return -EFAULT; + if (likely(!i915_prefault_disable)) { + ret = fault_in_multipages_readable(to_user_ptr(args->data_ptr), + args->size); + if (ret) + return -EFAULT; + } ret = i915_mutex_lock_interruptible(dev); if (ret) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 1b58694..1734825 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -759,8 +759,10 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, if (!access_ok(VERIFY_WRITE, ptr, length)) return -EFAULT; - if (fault_in_multipages_readable(ptr, length)) - return -EFAULT; + if (likely(!i915_prefault_disable)) { + if (fault_in_multipages_readable(ptr, length)) + return -EFAULT; + } } return 0;
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: Xiong Zhang <xiong.y.zhang@intel.com> --- drivers/gpu/drm/i915/i915_drv.c | 5 +++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem.c | 12 +++++++----- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 ++++-- 4 files changed, 17 insertions(+), 7 deletions(-)