[igt-dev] [PATCH i-g-t v2] tests/i915/gem_ctx_engines: Avoid SET_CACHING ioctl during fork

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 28 08:33:50 UTC 2022


On 2022-10-21 at 18:49:33 +0530, Vikas Srivastava wrote:
> From: Jonathan Cavitt <jonathan.cavitt at intel.com>
> 
> Some subtests for gem_ctx_engines require the SET_CACHING
> ioctl to run.  However, the function that calls it is
> wrapped by an igt_require and thus causes a skip when the
> ioctl fails.  Unfortunately, MTL currently fails this check
> with -EOPNOTSUPP.
> 
> While the ioctl failing and resulting in a skip wouldn't
> normally be a problem, the failing call is occasionally
> made within a forked child process, which causes an error.
> Fortunately, use of the ioctl can be avoided by using wc
> instead of cpu for mmapping and domain operations.
> 
> v2: Use gem_mmap__device_coherent instead of gem_mmap__wc
> 
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> Acked-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> CC: Fei Yang <fei.yang at intel.com>
> CC: Chris Wilson <chris.p.wilson at intel.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> 
> ---
>  tests/i915/gem_ctx_engines.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/i915/gem_ctx_engines.c b/tests/i915/gem_ctx_engines.c
> index b0646516..e9cc25d6 100644
> --- a/tests/i915/gem_ctx_engines.c
> +++ b/tests/i915/gem_ctx_engines.c
> @@ -492,12 +492,10 @@ static void independent(int i915, const intel_ctx_t *base_ctx,
>  	}
>  	param.ctx_id = gem_context_create(i915);
>  	gem_context_set_param(i915, &param);
> -
> -	if (!gem_has_lmem(i915))
> -		gem_set_caching(i915, results.handle, I915_CACHING_CACHED);
> -	map = gem_mmap__cpu(i915, results.handle, 0, 4096, PROT_READ);
> +	
> +	map = gem_mmap__device_coherent(i915, results.handle, 0, 4096, PROT_READ);
>  	gem_set_domain(i915, results.handle,
> -		       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
> +		       I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
>  
>  	for (int i = 0; i < I915_EXEC_RING_MASK + 1; i++) {
>  		struct drm_i915_gem_exec_object2 obj[2] = {
> @@ -515,8 +513,7 @@ static void independent(int i915, const intel_ctx_t *base_ctx,
>  		uint32_t *cs;
>  		int j = 0;
>  
> -		cs = gem_mmap__cpu(i915, obj[1].handle, 0, 4096, PROT_WRITE);
> -
> +		cs = gem_mmap__device_coherent(i915, obj[1].handle, 0, 4096, PROT_WRITE);
>  		cs[j] = 0x24 << 23 | 1; /* SRM */
>  		if (has_64bit_reloc)
>  			cs[j]++;
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list