diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/2061-Revert-drm-amdkfd-Relaxed-mm_access-for-CMA.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.14.71/2061-Revert-drm-amdkfd-Relaxed-mm_access-for-CMA.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/2061-Revert-drm-amdkfd-Relaxed-mm_access-for-CMA.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/2061-Revert-drm-amdkfd-Relaxed-mm_access-for-CMA.patch new file mode 100644 index 00000000..6797ca0d --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/2061-Revert-drm-amdkfd-Relaxed-mm_access-for-CMA.patch @@ -0,0 +1,137 @@ +From edb11a4423147833df4663d2f82f8c4154491663 Mon Sep 17 00:00:00 2001 +From: "Le.Ma" <Le.Ma@amd.com> +Date: Wed, 25 Oct 2017 16:13:34 +0800 +Subject: [PATCH 2061/4131] Revert "drm/amdkfd: Relaxed mm_access for CMA" + +This reverts commit cc71bb438ee1830c9f971cb08d6e82b333cf18bb. +--- + drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 61 +++----------------------------- + drivers/gpu/drm/amd/amdkfd/kfd_module.c | 5 --- + drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 ---- + 3 files changed, 5 insertions(+), 67 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +index 75a9a45..b2795af 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +@@ -1681,58 +1681,12 @@ static int kfd_ioctl_get_tile_config(struct file *filep, + } + + #if defined(BUILD_AS_DKMS) +-static bool kfd_may_access(struct task_struct *task, unsigned int mode) +-{ +- bool access = false; +- const struct cred *cred = current_cred(), *tcred; +- kuid_t caller_uid = cred->fsuid; +- kgid_t caller_gid = cred->fsgid; +- +- task_lock(task); +- +- if (same_thread_group(task, current)) { +- access = true; +- goto ok; +- } +- +- tcred = __task_cred(task); +- if (uid_eq(caller_uid, tcred->euid) && +- uid_eq(caller_uid, tcred->suid) && +- uid_eq(caller_uid, tcred->uid) && +- gid_eq(caller_gid, tcred->egid) && +- gid_eq(caller_gid, tcred->sgid) && +- gid_eq(caller_gid, tcred->gid)) +- access = true; +- +-ok: +- task_unlock(task); +- return access; +-} +-/* mm_access() is currently not exported. This is a relaxed implementation +- * that allows access as long as both process belong to same uid +- */ +-static struct mm_struct *kfd_relaxed_mm_access(struct task_struct *task, +- unsigned int mode) ++static int kfd_ioctl_cross_memory_copy(struct file *filep, ++ struct kfd_process *local_p, void *data) + { +- struct mm_struct *mm; +- int err; +- +- err = mutex_lock_killable(&task->signal->cred_guard_mutex); +- if (err) +- return ERR_PTR(err); +- +- mm = get_task_mm(task); +- if (mm && mm != current->mm && +- !kfd_may_access(task, mode)) { +- mmput(mm); +- mm = ERR_PTR(-EACCES); +- } +- mutex_unlock(&task->signal->cred_guard_mutex); +- +- return mm; ++ return 0; + } +-#endif +- ++#else + static int kfd_ioctl_cross_memory_copy(struct file *filep, + struct kfd_process *local_p, void *data) + { +@@ -1794,13 +1748,7 @@ static int kfd_ioctl_cross_memory_copy(struct file *filep, + } + + /* Check access permission */ +-#if defined(BUILD_AS_DKMS) +- remote_mm = cma_enable ? kfd_relaxed_mm_access(remote_task, +- PTRACE_MODE_ATTACH_REALCREDS) : +- ERR_PTR(-EACCES); +-#else + remote_mm = mm_access(remote_task, PTRACE_MODE_ATTACH_REALCREDS); +-#endif + if (!remote_mm || IS_ERR(remote_mm)) { + err = IS_ERR(remote_mm) ? PTR_ERR(remote_mm) : -ESRCH; + if (err == -EACCES) { +@@ -1980,6 +1928,7 @@ static int kfd_ioctl_cross_memory_copy(struct file *filep, + args->bytes_copied = total_copied; + return err; + } ++#endif + + static int kfd_ioctl_get_queue_wave_state(struct file *filep, + struct kfd_process *p, void *data) +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c +index 36da8c4..aba3e9d 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c +@@ -89,11 +89,6 @@ module_param_named(noretry, vega10_noretry, int, 0644); + MODULE_PARM_DESC(noretry, + "Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)"); + +-int cma_enable; +-module_param(cma_enable, int, 0644); +-MODULE_PARM_DESC(cma_enable, +- "Enable CMA (1 = enable, 0 = disable (default)). Warning! relaxed access check"); +- + int kgd2kfd_init(unsigned int interface_version, + const struct kgd2kfd_calls **g2f) + { +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +index 1de2d91..cceaa89 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +@@ -139,12 +139,6 @@ extern int ignore_crat; + */ + extern int vega10_noretry; + +-/* +- * Currently, mm_access() function is not exported. So for DKMS build, +- * CMA will be enabled only if module param is set. +- */ +-extern int cma_enable; +- + /** + * enum kfd_sched_policy + * +-- +2.7.4 + |