Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: always backup and reemit fences

If when we backup the ring contents for reemit before a
ring reset, we skip jobs associated with the bad
context, however, we need to make sure the fences
are reemited as unprocessed submissions may depend on
them.

v2: clean up fence handling, make helpers static

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+23 -6
+19 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
··· 89 89 return seq; 90 90 } 91 91 92 + static void amdgpu_fence_save_fence_wptr_start(struct amdgpu_fence *af) 93 + { 94 + af->fence_wptr_start = af->ring->wptr; 95 + } 96 + 97 + static void amdgpu_fence_save_fence_wptr_end(struct amdgpu_fence *af) 98 + { 99 + af->fence_wptr_end = af->ring->wptr; 100 + } 101 + 92 102 /** 93 103 * amdgpu_fence_emit - emit a fence on the requested ring 94 104 * ··· 126 116 &ring->fence_drv.lock, 127 117 adev->fence_context + ring->idx, seq); 128 118 119 + amdgpu_fence_save_fence_wptr_start(af); 129 120 amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, 130 121 seq, flags | AMDGPU_FENCE_FLAG_INT); 122 + amdgpu_fence_save_fence_wptr_end(af); 131 123 amdgpu_fence_save_wptr(af); 132 124 pm_runtime_get_noresume(adev_to_drm(adev)->dev); 133 125 ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; ··· 754 742 /* if we've already reemitted once then just cancel everything */ 755 743 amdgpu_fence_driver_force_completion(af->ring); 756 744 af->ring->ring_backup_entries_to_copy = 0; 757 - } else { 758 - /* signal the guilty fence */ 759 - amdgpu_fence_write(ring, (u32)af->base.seqno); 760 - amdgpu_fence_process(ring); 761 745 } 762 746 } 763 747 ··· 803 795 * just save the content from other contexts. 804 796 */ 805 797 if (!fence->reemitted && 806 - (!guilty_fence || (fence->context != guilty_fence->context))) 798 + (!guilty_fence || (fence->context != guilty_fence->context))) { 807 799 amdgpu_ring_backup_unprocessed_command(ring, wptr, 808 800 fence->wptr); 801 + } else if (!fence->reemitted) { 802 + /* always save the fence */ 803 + amdgpu_ring_backup_unprocessed_command(ring, 804 + fence->fence_wptr_start, 805 + fence->fence_wptr_end); 806 + } 809 807 wptr = fence->wptr; 810 808 fence->reemitted++; 811 809 }
+4 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
··· 146 146 struct amdgpu_ring *ring; 147 147 ktime_t start_timestamp; 148 148 149 - /* wptr for the fence for resets */ 149 + /* wptr for the total submission for resets */ 150 150 u64 wptr; 151 151 /* fence context for resets */ 152 152 u64 context; 153 153 /* has this fence been reemitted */ 154 154 unsigned int reemitted; 155 + /* wptr for the fence for the submission */ 156 + u64 fence_wptr_start; 157 + u64 fence_wptr_end; 155 158 }; 156 159 157 160 extern const struct drm_sched_backend_ops amdgpu_sched_ops;