Patch "drm/i915/gem: Flush coherency domains on first set-domain-ioctl" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/i915/gem: Flush coherency domains on first set-domain-ioctl

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-i915-gem-flush-coherency-domains-on-first-set-do.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 796f969672c3ccafe78d092aef05be6de0fac156
Author: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Date:   Mon Oct 19 21:38:25 2020 +0100

    drm/i915/gem: Flush coherency domains on first set-domain-ioctl
    
    [ Upstream commit 59dd13ad310793757e34afa489dd6fc8544fc3da ]
    
    Avoid skipping what appears to be a no-op set-domain-ioctl if the cache
    coherency state is inconsistent with our target domain. This also has
    the utility of using the population of the pages to validate the backing
    store.
    
    The danger in skipping the first set-domain is leaving the cache
    inconsistent and submitting stale data, or worse leaving the clean data
    in the cache and not flushing it to the GPU. The impact should be small
    as it requires a no-op set-domain as the very first ioctl in a
    particular sequence not found in typical userspace.
    
    Reported-by: Zbigniew KempczyÅ?ski <zbigniew.kempczynski@xxxxxxxxx>
    Fixes: 754a25442705 ("drm/i915: Skip object locking around a no-op set-domain ioctl")
    Testcase: igt/gem_mmap_offset/blt-coherency
    Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
    Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
    Cc: Matthew Auld <matthew.william.auld@xxxxxxxxx>
    Cc: Zbigniew KempczyÅ?ski <zbigniew.kempczynski@xxxxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx> # v5.2+
    Reviewed-by: Matthew Auld <matthew.auld@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20201019203825.10966-1-chris@xxxxxxxxxxxxxxxxxx
    (cherry picked from commit 44c2200afcd59f441b43f27829b4003397cc495d)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
index 7f76fc68f498a..ba8758011e297 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
@@ -484,21 +484,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 	if (!obj)
 		return -ENOENT;
 
-	/*
-	 * Already in the desired write domain? Nothing for us to do!
-	 *
-	 * We apply a little bit of cunning here to catch a broader set of
-	 * no-ops. If obj->write_domain is set, we must be in the same
-	 * obj->read_domains, and only that domain. Therefore, if that
-	 * obj->write_domain matches the request read_domains, we are
-	 * already in the same read/write domain and can skip the operation,
-	 * without having to further check the requested write_domain.
-	 */
-	if (READ_ONCE(obj->write_domain) == read_domains) {
-		err = 0;
-		goto out;
-	}
-
 	/*
 	 * Try to flush the object off the GPU without holding the lock.
 	 * We will repeat the flush holding the lock in the normal manner
@@ -536,6 +521,19 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 	if (err)
 		goto out;
 
+	/*
+	 * Already in the desired write domain? Nothing for us to do!
+	 *
+	 * We apply a little bit of cunning here to catch a broader set of
+	 * no-ops. If obj->write_domain is set, we must be in the same
+	 * obj->read_domains, and only that domain. Therefore, if that
+	 * obj->write_domain matches the request read_domains, we are
+	 * already in the same read/write domain and can skip the operation,
+	 * without having to further check the requested write_domain.
+	 */
+	if (READ_ONCE(obj->write_domain) == read_domains)
+		goto out_unpin;
+
 	err = i915_gem_object_lock_interruptible(obj);
 	if (err)
 		goto out_unpin;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux