aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1162-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1162-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch')
-rw-r--r--meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1162-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1162-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1162-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch
new file mode 100644
index 00000000..2f39f3e0
--- /dev/null
+++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1162-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch
@@ -0,0 +1,54 @@
+From bde5632fe56cf6aaaec61f7b0192449f585fca6e Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Tue, 26 Jul 2016 17:22:46 -0400
+Subject: [PATCH 1162/4131] drm/amdkfd: Get reference to lead_thread task
+ struct
+
+Increment the kfd_process.lead_thread's reference counter to make
+it safe to dereference. This will be needed for getting a safe
+reference to the process' mm_struct.
+
+Change-Id: I2a38f5f2de989dd4f19115d21d31ea6df953806c
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++
+ drivers/gpu/drm/amd/amdkfd/kfd_process.c | 3 +++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+index 1a9aab7..054a784 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+@@ -618,6 +618,8 @@ struct kfd_process {
+ * In any process, the thread that started main() is the lead
+ * thread and outlives the rest.
+ * It is here because amd_iommu_bind_pasid wants a task_struct.
++ * It can also be used for safely getting a reference to the
++ * mm_struct of the process.
+ */
+ struct task_struct *lead_thread;
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+index ec066d8..889d165 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+@@ -466,6 +466,8 @@ static void kfd_process_ref_release(struct kref *ref)
+
+ kfd_pasid_free(p->pasid);
+
++ put_task_struct(p->lead_thread);
++
+ kfree(p);
+ }
+
+@@ -647,6 +649,7 @@ static struct kfd_process *create_process(const struct task_struct *thread)
+ (uintptr_t)process->mm);
+
+ process->lead_thread = thread->group_leader;
++ get_task_struct(process->lead_thread);
+
+ INIT_LIST_HEAD(&process->per_device_data);
+
+--
+2.7.4
+