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: Handle GPU page faults correctly on non-4K page systems

During a GPU page fault, the driver restores the SVM range and then maps it
into the GPU page tables. The current implementation passes a GPU-page-size
(4K-based) PFN to svm_range_restore_pages() to restore the range.

SVM ranges are tracked using system-page-size PFNs. On systems where the
system page size is larger than 4K, using GPU-page-size PFNs to restore the
range causes two problems:

Range lookup fails:
Because the restore function receives PFNs in GPU (4K) units, the SVM
range lookup does not find the existing range. This will result in a
duplicate SVM range being created.

VMA lookup failure:
The restore function also tries to locate the VMA for the faulting address.
It converts the GPU-page-size PFN into an address using the system page
size, which results in an incorrect address on non-4K page-size systems.
As a result, the VMA lookup fails with the message: "address 0xxxx VMA is
removed".

This patch passes the system-page-size PFN to svm_range_restore_pages() so
that the SVM range is restored correctly on non-4K page systems.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Donet Tom and committed by
Alex Deucher
074fe395 94c7e966

+3 -3
+3 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 2992 2992 if (!root) 2993 2993 return false; 2994 2994 2995 - addr /= AMDGPU_GPU_PAGE_SIZE; 2996 - 2997 2995 if (is_compute_context && !svm_range_restore_pages(adev, pasid, vmid, 2998 - node_id, addr, ts, write_fault)) { 2996 + node_id, addr >> PAGE_SHIFT, ts, write_fault)) { 2999 2997 amdgpu_bo_unref(&root); 3000 2998 return true; 3001 2999 } 3000 + 3001 + addr /= AMDGPU_GPU_PAGE_SIZE; 3002 3002 3003 3003 r = amdgpu_bo_reserve(root, true); 3004 3004 if (r)