summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdkfd/kfd_process.c
diff options
context:
space:
mode:
authorBen Goz <ben.goz@amd.com>2014-07-17 01:04:10 +0300
committerOded Gabbay <oded.gabbay@amd.com>2014-07-17 01:04:10 +0300
commit45102048f77ef72a57a877efad0f012b917d4df7 (patch)
treebe08a988cacf7bf00ad66693c25cab6321ae48b8 /drivers/gpu/drm/amd/amdkfd/kfd_process.c
parent241f24f823631ced1c6f162db1deebc35037f7d0 (diff)
downloadop-kernel-dev-45102048f77ef72a57a877efad0f012b917d4df7.zip
op-kernel-dev-45102048f77ef72a57a877efad0f012b917d4df7.tar.gz
amdkfd: Add process queue manager module
The queue scheduler divides into two sections, one section is process bounded and the other section is device bounded. The process bounded section is handled by this module. The PQM handles usermode queue setup, updates and tear-down. v3: Used kernel parameter to limit queues per process instead of define Added use of doorbell address from user v4: Modified pqm_create_queue so that only when creating usermode queues the driver should return the queue properties to the userspace. Added an info message print when no more queues can be opened because of the queue per process limitation v5: Move amdkfd from drm/radeon/ to drm/amd/ Various fixes Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_process.c')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_process.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 5084794..a17e2dd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -222,6 +222,13 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn,
mutex_unlock(&kfd_processes_mutex);
synchronize_srcu(&kfd_processes_srcu);
+ mutex_lock(&p->mutex);
+
+ /* In case our notifier is called before IOMMU notifier */
+ pqm_uninit(&p->pqm);
+
+ mutex_unlock(&p->mutex);
+
/*
* Because we drop mm_count inside kfd_process_destroy_delayed
* and because the mmu_notifier_unregister function also drop
@@ -274,8 +281,16 @@ static struct kfd_process *create_process(const struct task_struct *thread)
INIT_LIST_HEAD(&process->per_device_data);
+ err = pqm_init(&process->pqm, process);
+ if (err != 0)
+ goto err_process_pqm_init;
+
return process;
+err_process_pqm_init:
+ hash_del_rcu(&process->kfd_processes);
+ synchronize_rcu();
+ mmu_notifier_unregister_no_release(&process->mmu_notifier, process->mm);
err_mmu_notifier:
kfd_pasid_free(process->pasid);
err_alloc_pasid:
@@ -300,6 +315,9 @@ struct kfd_process_device *kfd_get_process_device_data(struct kfd_dev *dev,
pdd = kzalloc(sizeof(*pdd), GFP_KERNEL);
if (pdd != NULL) {
pdd->dev = dev;
+ INIT_LIST_HEAD(&pdd->qpd.queues_list);
+ INIT_LIST_HEAD(&pdd->qpd.priv_queue_list);
+ pdd->qpd.dqm = dev->dqm;
list_add(&pdd->per_device_list, &p->per_device_data);
}
}
@@ -360,6 +378,8 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid)
mutex_lock(&p->mutex);
+ pqm_uninit(&p->pqm);
+
pdd = kfd_get_process_device_data(dev, p, 0);
/*
OpenPOWER on IntegriCloud