[i-g-t] i915/gem_persistent_relocs: Manage the domain for the GGTT access
diff mbox series

Message ID 20191016185642.16181-1-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [i-g-t] i915/gem_persistent_relocs: Manage the domain for the GGTT access
Related show

Commit Message

Chris Wilson Oct. 16, 2019, 6:56 p.m. UTC
Since the GGTT fault will overlap with the pwrite access, there is no
implicit moment at which the kernel will automagically flush the backing
store. Userspace has to be explicit in its domain control, or do itself.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=112037
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_persistent_relocs.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Tvrtko Ursulin Oct. 17, 2019, 1:38 p.m. UTC | #1
On 16/10/2019 19:56, Chris Wilson wrote:
> Since the GGTT fault will overlap with the pwrite access, there is no
> implicit moment at which the kernel will automagically flush the backing
> store. Userspace has to be explicit in its domain control, or do itself.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=112037
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   tests/i915/gem_persistent_relocs.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/tests/i915/gem_persistent_relocs.c b/tests/i915/gem_persistent_relocs.c
> index 2ab7091ad..20ee03027 100644
> --- a/tests/i915/gem_persistent_relocs.c
> +++ b/tests/i915/gem_persistent_relocs.c
> @@ -224,8 +224,11 @@ static void do_test(int fd, bool faulting_reloc)
>   
>   		relocs_bo_handle[i] = gem_create(fd, 4096);
>   		gem_write(fd, relocs_bo_handle[i], 0, reloc, sizeof(reloc));
> +
>   		gtt_relocs_ptr[i] = gem_mmap__gtt(fd, relocs_bo_handle[i], 4096,
>   						  PROT_READ | PROT_WRITE);
> +		gem_set_domain(fd, relocs_bo_handle[i],
> +			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
>   	}
>   
>   	/* repeat must be smaller than 4096/small_pitch */
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

Patch
diff mbox series

diff --git a/tests/i915/gem_persistent_relocs.c b/tests/i915/gem_persistent_relocs.c
index 2ab7091ad..20ee03027 100644
--- a/tests/i915/gem_persistent_relocs.c
+++ b/tests/i915/gem_persistent_relocs.c
@@ -224,8 +224,11 @@  static void do_test(int fd, bool faulting_reloc)
 
 		relocs_bo_handle[i] = gem_create(fd, 4096);
 		gem_write(fd, relocs_bo_handle[i], 0, reloc, sizeof(reloc));
+
 		gtt_relocs_ptr[i] = gem_mmap__gtt(fd, relocs_bo_handle[i], 4096,
 						  PROT_READ | PROT_WRITE);
+		gem_set_domain(fd, relocs_bo_handle[i],
+			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 	}
 
 	/* repeat must be smaller than 4096/small_pitch */