On Fri, 27 Nov 2020, Matthew Auld <matthew.auld@xxxxxxxxx> wrote: > From: CQ Tang <cq.tang@xxxxxxxxx> > > enable_eviction is used to tune if eviction is enabled (default) or not. > > Signed-off-by: Sudeep Dutt <sudeep.dutt@xxxxxxxxx> > Signed-off-by: CQ Tang <cq.tang@xxxxxxxxx> > --- > drivers/gpu/drm/i915/gem/i915_gem_object.c | 1 + > drivers/gpu/drm/i915/gem/i915_gem_region.c | 5 +++++ > drivers/gpu/drm/i915/i915_params.c | 3 +++ > drivers/gpu/drm/i915/i915_params.h | 1 + > drivers/gpu/drm/i915/intel_memory_region.c | 2 +- > 5 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c > index 7cb5f137522f..46d0f8731db0 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c > @@ -293,6 +293,7 @@ static void i915_gem_free_object(struct drm_gem_object *gem_obj) > * If object had been swapped out, free the hidden object. > */ > if (obj->swapto) { > + GEM_BUG_ON(!i915->params.enable_eviction); > i915_gem_object_put(obj->swapto); > obj->swapto = NULL; > } > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_region.c b/drivers/gpu/drm/i915/gem/i915_gem_region.c > index a437538cd872..e1793c5f8d8c 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_region.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_region.c > @@ -21,6 +21,7 @@ i915_gem_object_swapout_pages(struct drm_i915_gem_object *obj, > GEM_BUG_ON(i915_gem_object_has_pages(obj)); > GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED); > GEM_BUG_ON(obj->mm.region->type != INTEL_MEMORY_LOCAL); > + GEM_BUG_ON(!i915->params.enable_eviction); > > assert_object_held(obj); > > @@ -70,6 +71,7 @@ static int > i915_gem_object_swapin_pages(struct drm_i915_gem_object *obj, > struct sg_table *pages, unsigned int sizes) > { > + struct drm_i915_private *i915 = to_i915(obj->base.dev); > struct drm_i915_gem_object *dst, *src; > int err; > > @@ -77,6 +79,7 @@ i915_gem_object_swapin_pages(struct drm_i915_gem_object *obj, > GEM_BUG_ON(i915_gem_object_has_pages(obj)); > GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED); > GEM_BUG_ON(obj->mm.region->type != INTEL_MEMORY_LOCAL); > + GEM_BUG_ON(!i915->params.enable_eviction); > > assert_object_held(obj); > > @@ -146,6 +149,7 @@ i915_gem_object_put_pages_buddy(struct drm_i915_gem_object *obj, > int > i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj) > { > + struct drm_i915_private *i915 = to_i915(obj->base.dev); > struct intel_memory_region *mem = obj->mm.region; > struct list_head *blocks = &obj->mm.blocks; > resource_size_t size = obj->base.size; > @@ -222,6 +226,7 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj) > /* if we saved the page contents, swap them in */ > if (obj->swapto) { > GEM_BUG_ON(i915_gem_object_is_volatile(obj)); > + GEM_BUG_ON(!i915->params.enable_eviction); > > ret = i915_gem_object_swapin_pages(obj, st, > sg_page_sizes); > diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c > index 7f139ea4a90b..bb1ebb6ece95 100644 > --- a/drivers/gpu/drm/i915/i915_params.c > +++ b/drivers/gpu/drm/i915/i915_params.c > @@ -197,6 +197,9 @@ i915_param_named_unsafe(fake_lmem_start, ulong, 0400, > "Fake LMEM start offset (default: 0)"); > #endif > > +i915_param_named_unsafe(enable_eviction, bool, 0600, > + "Enable memcpy based eviction which does not rely on DMA resv refactoring)"); Does the module parameter actually need to be writable? Should be modified via debugfs as a device specific parameter? BR, Jani. > + > static __always_inline void _print_param(struct drm_printer *p, > const char *name, > const char *type, > diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h > index 330c03e2b4f7..87df407d9afb 100644 > --- a/drivers/gpu/drm/i915/i915_params.h > +++ b/drivers/gpu/drm/i915/i915_params.h > @@ -72,6 +72,7 @@ struct drm_printer; > param(char *, force_probe, CONFIG_DRM_I915_FORCE_PROBE, 0400) \ > param(unsigned long, fake_lmem_start, 0, 0400) \ > /* leave bools at the end to not create holes */ \ > + param(bool, enable_eviction, true, 0600) \ > param(bool, enable_hangcheck, true, 0600) \ > param(bool, load_detect_test, false, 0600) \ > param(bool, force_reset_modeset_test, false, 0600) \ > diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c > index afcd6fe6eaff..57f01ef16628 100644 > --- a/drivers/gpu/drm/i915/intel_memory_region.c > +++ b/drivers/gpu/drm/i915/intel_memory_region.c > @@ -175,7 +175,7 @@ static int intel_memory_region_evict(struct intel_memory_region *mem, > list_splice_tail(&still_in_list, *phase); > mutex_unlock(&mem->objects.lock); > > - if (found < target) { > + if (found < target && i915->params.enable_eviction) { > pass++; > phase++; > if (*phase) -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel