Commit 8fde0248 authored by Philip Yang's avatar Philip Yang Committed by Alex Deucher

drm/amdkfd: Use atomic64_t type for pdd->tlb_seq

To support multi-thread update page table.
Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4499c90e
...@@ -705,7 +705,7 @@ struct kfd_process_device { ...@@ -705,7 +705,7 @@ struct kfd_process_device {
/* VM context for GPUVM allocations */ /* VM context for GPUVM allocations */
struct file *drm_file; struct file *drm_file;
void *drm_priv; void *drm_priv;
uint64_t tlb_seq; atomic64_t tlb_seq;
/* GPUVM allocations storage */ /* GPUVM allocations storage */
struct idr alloc_idr; struct idr alloc_idr;
......
...@@ -1560,7 +1560,7 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd, ...@@ -1560,7 +1560,7 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd,
return ret; return ret;
} }
pdd->drm_priv = drm_file->private_data; pdd->drm_priv = drm_file->private_data;
pdd->tlb_seq = 0; atomic64_set(&pdd->tlb_seq, 0);
ret = kfd_process_device_reserve_ib_mem(pdd); ret = kfd_process_device_reserve_ib_mem(pdd);
if (ret) if (ret)
...@@ -1954,10 +1954,14 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type) ...@@ -1954,10 +1954,14 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type)
uint64_t tlb_seq = amdgpu_vm_tlb_seq(vm); uint64_t tlb_seq = amdgpu_vm_tlb_seq(vm);
struct kfd_dev *dev = pdd->dev; struct kfd_dev *dev = pdd->dev;
if (pdd->tlb_seq == tlb_seq) /*
* It can be that we race and lose here, but that is extremely unlikely
* and the worst thing which could happen is that we flush the changes
* into the TLB once more which is harmless.
*/
if (atomic64_xchg(&pdd->tlb_seq, tlb_seq) == tlb_seq)
return; return;
pdd->tlb_seq = tlb_seq;
if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) { if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) {
/* Nothing to flush until a VMID is assigned, which /* Nothing to flush until a VMID is assigned, which
* only happens when the first queue is created. * only happens when the first queue is created.
......
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