drm/i915/gem: Pin the L-shape quirked object as unshrinkable
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 17 May 2021 08:46:40 +0000 (09:46 +0100)
committerJani Nikula <jani.nikula@intel.com>
Wed, 19 May 2021 06:50:08 +0000 (09:50 +0300)
commit036867e93ebf4d7e70eba6a8c72db74ee3760bc3
treeb0bdfb0a363f1995d6badc368400e8a5154f736c
parentd07f6ca923ea0927a1024dfccafc5b53b61cfecc
drm/i915/gem: Pin the L-shape quirked object as unshrinkable

When instantiating a tiled object on an L-shaped memory machine, we mark
the object as unshrinkable to prevent the shrinker from trying to swap
out the pages. We have to do this as we do not know the swizzling on the
individual pages, and so the data will be scrambled across swap out/in.

Not only do we need to move the object off the shrinker list, we need to
mark the object with shrink_pin so that the counter is consistent across
calls to madvise.

v2: in the madvise ioctl we need to check if the object is currently
shrinkable/purgeable, not if the object type supports shrinking

Fixes: 0175969e489a ("drm/i915/gem: Use shrinkable status for unknown swizzle quirks")
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3293
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3450
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: <stable@vger.kernel.org> # v5.12+
Link: https://patchwork.freedesktop.org/patch/msgid/20210517084640.18862-1-matthew.auld@intel.com
(cherry picked from commit 8777d17b68dcfbfbd4d524f444adefae56f41225)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/gem/i915_gem_pages.c
drivers/gpu/drm/i915/i915_gem.c