forked from mirrors/linux
		
	drm/i915/selftests: Disable preemption while setting up fence-timers
The impossible happens and a future fence expired while we were still initialising. The probable cause is that the test was preempted and we lost our scheduler cpu slice. Disable preemption during this test to rule out preemption as a source of timer disruption. References: https://bugs.freedesktop.org/show_bug.cgi?id=110039 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190313205944.5768-1-chris@chris-wilson.co.uk
This commit is contained in:
		
							parent
							
								
									628ac441e8
								
							
						
					
					
						commit
						d2eeaf2bc0
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -571,21 +571,27 @@ static int test_timer(void *arg)
 | 
			
		|||
	unsigned long target, delay;
 | 
			
		||||
	struct timed_fence tf;
 | 
			
		||||
 | 
			
		||||
	preempt_disable();
 | 
			
		||||
	timed_fence_init(&tf, target = jiffies);
 | 
			
		||||
	if (!i915_sw_fence_done(&tf.fence)) {
 | 
			
		||||
		pr_err("Fence with immediate expiration not signaled\n");
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	preempt_enable();
 | 
			
		||||
	timed_fence_fini(&tf);
 | 
			
		||||
 | 
			
		||||
	for_each_prime_number(delay, i915_selftest.timeout_jiffies/2) {
 | 
			
		||||
		preempt_disable();
 | 
			
		||||
		timed_fence_init(&tf, target = jiffies + delay);
 | 
			
		||||
		if (i915_sw_fence_done(&tf.fence)) {
 | 
			
		||||
			pr_err("Fence with future expiration (%lu jiffies) already signaled\n", delay);
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
		preempt_enable();
 | 
			
		||||
 | 
			
		||||
		i915_sw_fence_wait(&tf.fence);
 | 
			
		||||
 | 
			
		||||
		preempt_disable();
 | 
			
		||||
		if (!i915_sw_fence_done(&tf.fence)) {
 | 
			
		||||
			pr_err("Fence not signaled after wait\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
| 
						 | 
				
			
			@ -595,13 +601,14 @@ static int test_timer(void *arg)
 | 
			
		|||
			       target, jiffies);
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		preempt_enable();
 | 
			
		||||
		timed_fence_fini(&tf);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
err:
 | 
			
		||||
	preempt_enable();
 | 
			
		||||
	timed_fence_fini(&tf);
 | 
			
		||||
	return -EINVAL;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue