| .. | .. |
|---|
| 571 | 571 | unsigned long target, delay; |
|---|
| 572 | 572 | struct timed_fence tf; |
|---|
| 573 | 573 | |
|---|
| 574 | + preempt_disable(); |
|---|
| 574 | 575 | timed_fence_init(&tf, target = jiffies); |
|---|
| 575 | 576 | if (!i915_sw_fence_done(&tf.fence)) { |
|---|
| 576 | 577 | pr_err("Fence with immediate expiration not signaled\n"); |
|---|
| 577 | 578 | goto err; |
|---|
| 578 | 579 | } |
|---|
| 580 | + preempt_enable(); |
|---|
| 579 | 581 | timed_fence_fini(&tf); |
|---|
| 580 | 582 | |
|---|
| 581 | 583 | for_each_prime_number(delay, i915_selftest.timeout_jiffies/2) { |
|---|
| 584 | + preempt_disable(); |
|---|
| 582 | 585 | timed_fence_init(&tf, target = jiffies + delay); |
|---|
| 583 | 586 | if (i915_sw_fence_done(&tf.fence)) { |
|---|
| 584 | 587 | pr_err("Fence with future expiration (%lu jiffies) already signaled\n", delay); |
|---|
| 585 | 588 | goto err; |
|---|
| 586 | 589 | } |
|---|
| 590 | + preempt_enable(); |
|---|
| 587 | 591 | |
|---|
| 588 | 592 | i915_sw_fence_wait(&tf.fence); |
|---|
| 593 | + |
|---|
| 594 | + preempt_disable(); |
|---|
| 589 | 595 | if (!i915_sw_fence_done(&tf.fence)) { |
|---|
| 590 | 596 | pr_err("Fence not signaled after wait\n"); |
|---|
| 591 | 597 | goto err; |
|---|
| .. | .. |
|---|
| 595 | 601 | target, jiffies); |
|---|
| 596 | 602 | goto err; |
|---|
| 597 | 603 | } |
|---|
| 598 | | - |
|---|
| 604 | + preempt_enable(); |
|---|
| 599 | 605 | timed_fence_fini(&tf); |
|---|
| 600 | 606 | } |
|---|
| 601 | 607 | |
|---|
| 602 | 608 | return 0; |
|---|
| 603 | 609 | |
|---|
| 604 | 610 | err: |
|---|
| 611 | + preempt_enable(); |
|---|
| 605 | 612 | timed_fence_fini(&tf); |
|---|
| 606 | 613 | return -EINVAL; |
|---|
| 607 | 614 | } |
|---|
| .. | .. |
|---|
| 611 | 618 | return "mock"; |
|---|
| 612 | 619 | } |
|---|
| 613 | 620 | |
|---|
| 614 | | -static bool mock_enable_signaling(struct dma_fence *fence) |
|---|
| 615 | | -{ |
|---|
| 616 | | - return true; |
|---|
| 617 | | -} |
|---|
| 618 | | - |
|---|
| 619 | 621 | static const struct dma_fence_ops mock_fence_ops = { |
|---|
| 620 | 622 | .get_driver_name = mock_name, |
|---|
| 621 | 623 | .get_timeline_name = mock_name, |
|---|
| 622 | | - .enable_signaling = mock_enable_signaling, |
|---|
| 623 | | - .wait = dma_fence_default_wait, |
|---|
| 624 | | - .release = dma_fence_free, |
|---|
| 625 | 624 | }; |
|---|
| 626 | 625 | |
|---|
| 627 | 626 | static DEFINE_SPINLOCK(mock_fence_lock); |
|---|