Commit 5017bf82 authored by Philip Yang's avatar Philip Yang Committed by Alex Deucher

drm/amdkfd: handle fault counters on invalid address

prange is NULL if vm fault retry on invalid address, for this case, can
not use prange to get pdd, use adev to get gpuidx and then get pdd
instead, then increase pdd vm fault counter.
Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fa8f311e
...@@ -2375,21 +2375,27 @@ static bool svm_range_skip_recover(struct svm_range *prange) ...@@ -2375,21 +2375,27 @@ static bool svm_range_skip_recover(struct svm_range *prange)
static void static void
svm_range_count_fault(struct amdgpu_device *adev, struct kfd_process *p, svm_range_count_fault(struct amdgpu_device *adev, struct kfd_process *p,
struct svm_range *prange, int32_t gpuidx) int32_t gpuidx)
{ {
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
if (gpuidx == MAX_GPU_INSTANCE)
/* fault is on different page of same range /* fault is on different page of same range
* or fault is skipped to recover later * or fault is skipped to recover later
* or fault is on invalid virtual address
*/ */
pdd = svm_range_get_pdd_by_adev(prange, adev); if (gpuidx == MAX_GPU_INSTANCE) {
else uint32_t gpuid;
/* fault recovered int r;
r = kfd_process_gpuid_from_kgd(p, adev, &gpuid, &gpuidx);
if (r < 0)
return;
}
/* fault is recovered
* or fault cannot recover because GPU no access on the range * or fault cannot recover because GPU no access on the range
*/ */
pdd = kfd_process_device_from_gpuidx(p, gpuidx); pdd = kfd_process_device_from_gpuidx(p, gpuidx);
if (pdd) if (pdd)
WRITE_ONCE(pdd->faults, pdd->faults + 1); WRITE_ONCE(pdd->faults, pdd->faults + 1);
} }
...@@ -2525,7 +2531,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid, ...@@ -2525,7 +2531,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
mutex_unlock(&svms->lock); mutex_unlock(&svms->lock);
mmap_read_unlock(mm); mmap_read_unlock(mm);
svm_range_count_fault(adev, p, prange, gpuidx); svm_range_count_fault(adev, p, gpuidx);
mmput(mm); mmput(mm);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment