[Intel-gfx] [PATCH] drm/i915: Use fault-injection to force the shrinker to run in live GTT tests
Matthew Auld
matthew.william.auld at gmail.com
Fri Feb 10 15:46:52 UTC 2017
On 8 February 2017 at 11:40, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> It is possible whilst allocating the page-directory tree for a ppgtt
> bind that the shrinker may run and reap unused parts of the tree. If the
> shrinker happens to remove a chunk of the tree that the
> allocate_va_range has already processed, we may then try to insert into
> the dangling tree. This test uses the fault-injection framework to force
> the shrinker to be invoked before we allocate new pages, i.e. new chunks
> of the PD tree.
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=99295
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/Kconfig.debug | 1 +
> drivers/gpu/drm/i915/i915_drv.h | 2 +
> drivers/gpu/drm/i915/i915_gem_gtt.c | 6 ++
> drivers/gpu/drm/i915/i915_selftest.h | 2 +
> drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 98 +++++++++++++++++++++++++++
> 5 files changed, 109 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
> index a4d8cfd77c3c..68ff072f8b76 100644
> --- a/drivers/gpu/drm/i915/Kconfig.debug
> +++ b/drivers/gpu/drm/i915/Kconfig.debug
> @@ -65,6 +65,7 @@ config DRM_I915_SELFTEST
> bool "Enable selftests upon driver load"
> depends on DRM_I915
> default n
> + select FAULT_INJECTION
> select PRIME_NUMBERS
> help
> Choose this option to allow the driver to perform selftests upon
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 56a3de94ecf4..f298da9eaebc 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2468,6 +2468,8 @@ struct drm_i915_private {
> int irq;
> } lpe_audio;
>
> + I915_SELFTEST_DECLARE(struct fault_attr vm_fault);
> +
> /*
> * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
> * will be rejected. Instead look for a better place.
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 36142d3d99d2..0247b26265dd 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -23,6 +23,9 @@
> *
> */
>
> +#include <linux/slab.h> /* fault-inject.h is not standalone! */
What do you mean by not standalone, it doesn't build without this?
> +
> +#include <linux/fault-inject.h>
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) ?
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
More information about the Intel-gfx
mailing list