summaryrefslogtreecommitdiffstats
path: root/drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2019-10-11 15:52:45 -0400
committerLaura Abbott <labbott@redhat.com>2019-10-11 15:56:54 -0400
commita7207dfa0c14751c9cc358360227c1a48c7f0ffa (patch)
tree8663f5225f930a6569df5974001ebe205ae5be65 /drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch
parentbb6f824ef6d6471ed1ba20779cdbd252a5936fc6 (diff)
downloadkernel-a7207dfa0c14751c9cc358360227c1a48c7f0ffa.tar.gz
kernel-a7207dfa0c14751c9cc358360227c1a48c7f0ffa.tar.xz
kernel-a7207dfa0c14751c9cc358360227c1a48c7f0ffa.zip
Fix disappearching cursor issue (rhbz 1738614)
Diffstat (limited to 'drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch')
-rw-r--r--drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch b/drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch
new file mode 100644
index 000000000..fd85fd874
--- /dev/null
+++ b/drm-i915-Mark-contents-as-dirty-on-a-write-fault.patch
@@ -0,0 +1,54 @@
+From 7a78f4f0497f903756183f8b227f6fddaba8cdb0 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Fri, 20 Sep 2019 13:18:21 +0100
+Subject: [PATCH] drm/i915: Mark contents as dirty on a write fault
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since dropping the set-to-gtt-domain in commit a679f58d0510 ("drm/i915:
+Flush pages on acquisition"), we no longer mark the contents as dirty on
+a write fault. This has the issue of us then not marking the pages as
+dirty on releasing the buffer, which means the contents are not written
+out to the swap device (should we ever pick that buffer as a victim).
+Notably, this is visible in the dumb buffer interface used for cursors.
+Having updated the cursor contents via mmap, and swapped away, if the
+shrinker should evict the old cursor, upon next reuse, the cursor would
+be invisible.
+
+E.g. echo 80 > /proc/sys/kernel/sysrq ; echo f > /proc/sysrq-trigger
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111541
+Fixes: a679f58d0510 ("drm/i915: Flush pages on acquisition")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Matthew Auld <matthew.william.auld@gmail.com>
+Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Cc: <stable@vger.kernel.org> # v5.2+
+Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190920121821.7223-1-chris@chris-wilson.co.uk
+(cherry picked from commit 5028851cdfdf78dc22eacbc44a0ab0b3f599ee4a)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+---
+ drivers/gpu/drm/i915/gem/i915_gem_mman.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+index 39a661927d8e..c201289039fe 100644
+--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+@@ -317,7 +317,11 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
+ msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
+ GEM_BUG_ON(!obj->userfault_count);
+
+- i915_vma_set_ggtt_write(vma);
++ if (write) {
++ GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
++ i915_vma_set_ggtt_write(vma);
++ obj->mm.dirty = true;
++ }
+
+ err_fence:
+ i915_vma_unpin_fence(vma);
+--
+2.21.0
+