amdkfd: init aperture once per process
Since the user space may call open() more that once from the same process, the aperture initialization should be moved from kfd_open() Signed-off-by: Alexey Skidanov <Alexey.Skidanov@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
This commit is contained in:
Родитель
f1386fbc2b
Коммит
dd59239a98
|
@ -121,13 +121,9 @@ static int kfd_open(struct inode *inode, struct file *filep)
|
||||||
if (IS_ERR(process))
|
if (IS_ERR(process))
|
||||||
return PTR_ERR(process);
|
return PTR_ERR(process);
|
||||||
|
|
||||||
process->is_32bit_user_mode = is_32bit_user_mode;
|
|
||||||
|
|
||||||
dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n",
|
dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n",
|
||||||
process->pasid, process->is_32bit_user_mode);
|
process->pasid, process->is_32bit_user_mode);
|
||||||
|
|
||||||
kfd_init_apertures(process);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,13 +299,13 @@ int kfd_init_apertures(struct kfd_process *process)
|
||||||
struct kfd_dev *dev;
|
struct kfd_dev *dev;
|
||||||
struct kfd_process_device *pdd;
|
struct kfd_process_device *pdd;
|
||||||
|
|
||||||
mutex_lock(&process->mutex);
|
|
||||||
|
|
||||||
/*Iterating over all devices*/
|
/*Iterating over all devices*/
|
||||||
while ((dev = kfd_topology_enum_kfd_devices(id)) != NULL &&
|
while ((dev = kfd_topology_enum_kfd_devices(id)) != NULL &&
|
||||||
id < NUM_OF_SUPPORTED_GPUS) {
|
id < NUM_OF_SUPPORTED_GPUS) {
|
||||||
|
|
||||||
pdd = kfd_get_process_device_data(dev, process, 1);
|
pdd = kfd_get_process_device_data(dev, process, 1);
|
||||||
|
if (!pdd)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For 64 bit process aperture will be statically reserved in
|
* For 64 bit process aperture will be statically reserved in
|
||||||
|
@ -348,8 +348,6 @@ int kfd_init_apertures(struct kfd_process *process)
|
||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&process->mutex);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/amd-iommu.h>
|
#include <linux/amd-iommu.h>
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
|
#include <linux/compat.h>
|
||||||
|
|
||||||
struct mm_struct;
|
struct mm_struct;
|
||||||
|
|
||||||
#include "kfd_priv.h"
|
#include "kfd_priv.h"
|
||||||
|
@ -285,8 +287,15 @@ static struct kfd_process *create_process(const struct task_struct *thread)
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
goto err_process_pqm_init;
|
goto err_process_pqm_init;
|
||||||
|
|
||||||
|
/* init process apertures*/
|
||||||
|
process->is_32bit_user_mode = is_compat_task();
|
||||||
|
if (kfd_init_apertures(process) != 0)
|
||||||
|
goto err_init_apretures;
|
||||||
|
|
||||||
return process;
|
return process;
|
||||||
|
|
||||||
|
err_init_apretures:
|
||||||
|
pqm_uninit(&process->pqm);
|
||||||
err_process_pqm_init:
|
err_process_pqm_init:
|
||||||
hash_del_rcu(&process->kfd_processes);
|
hash_del_rcu(&process->kfd_processes);
|
||||||
synchronize_rcu();
|
synchronize_rcu();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче