aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1249-Fix-a-memory-leak-due-to-unused-memory-allocation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1249-Fix-a-memory-leak-due-to-unused-memory-allocation.patch')
-rw-r--r--meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1249-Fix-a-memory-leak-due-to-unused-memory-allocation.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1249-Fix-a-memory-leak-due-to-unused-memory-allocation.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1249-Fix-a-memory-leak-due-to-unused-memory-allocation.patch
new file mode 100644
index 00000000..7b807701
--- /dev/null
+++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1249-Fix-a-memory-leak-due-to-unused-memory-allocation.patch
@@ -0,0 +1,77 @@
+From f06c24023afcf221d3ccd380b9495be2e577d7bc Mon Sep 17 00:00:00 2001
+From: Yong Zhao <Yong.Zhao@amd.com>
+Date: Mon, 27 Mar 2017 15:11:58 -0400
+Subject: [PATCH 1249/4131] Fix a memory leak due to unused memory allocation
+
+With the new design introduced to support Vega 10, pm->pmf will be
+assigned, so it does not need memory allocation any more.
+
+Change-Id: Ibed0aa7a63daaa86db5e983a78ddca2c8492df4b
+Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_cik.c | 27 ++++++++++++++++++-----
+ drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | 2 --
+ 2 files changed, 21 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_cik.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_cik.c
+index 8c69ea7..a06b0d4 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_cik.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_cik.c
+@@ -157,13 +157,28 @@ static struct packet_manager_funcs kfd_cik_pm_funcs = {
+ .get_release_mem_packet_size = pm_get_release_mem_packet_size_vi,
+ };
+
++static struct packet_manager_funcs kfd_cik_scratch_pm_funcs = {
++ .map_process = pm_map_process_scratch_cik,
++ .runlist = pm_runlist_vi,
++ .set_resources = pm_set_resources_vi,
++ .map_queues = pm_map_queues_vi,
++ .unmap_queues = pm_unmap_queues_vi,
++ .query_status = pm_query_status_vi,
++ .release_mem = pm_release_mem_vi,
++ .get_map_process_packet_size =
++ pm_get_map_process_scratch_packet_size_cik,
++ .get_runlist_packet_size = pm_get_runlist_packet_size_vi,
++ .get_set_resources_packet_size = pm_get_set_resources_packet_size_vi,
++ .get_map_queues_packet_size = pm_get_map_queues_packet_size_vi,
++ .get_unmap_queues_packet_size = pm_get_unmap_queues_packet_size_vi,
++ .get_query_status_packet_size = pm_get_query_status_packet_size_vi,
++ .get_release_mem_packet_size = pm_get_release_mem_packet_size_vi,
++};
+
+ void kfd_pm_func_init_cik(struct packet_manager *pm, uint16_t fw_ver)
+ {
+- pm->pmf = &kfd_cik_pm_funcs;
+- if (fw_ver >= KFD_SCRATCH_KV_FW_VER) {
+- pm->pmf->map_process = pm_map_process_scratch_cik;
+- pm->pmf->get_map_process_packet_size =
+- pm_get_map_process_scratch_packet_size_cik;
+- }
++ if (fw_ver >= KFD_SCRATCH_KV_FW_VER)
++ pm->pmf = &kfd_cik_scratch_pm_funcs;
++ else
++ pm->pmf = &kfd_cik_pm_funcs;
+ }
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
+index c03b1e2..453cab4 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
+@@ -234,7 +234,6 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm,
+ mutex_destroy(&pm->lock);
+ return -ENOMEM;
+ }
+- pm->pmf = kzalloc(sizeof(struct packet_manager_funcs), GFP_KERNEL);
+ pm->allocated = false;
+
+ switch (pm->dqm->dev->device_info->asic_family) {
+@@ -264,7 +263,6 @@ void pm_uninit(struct packet_manager *pm)
+
+ mutex_destroy(&pm->lock);
+ kernel_queue_uninit(pm->priv_queue);
+- kfree(pm->pmf);
+ }
+
+ int pm_send_set_resources(struct packet_manager *pm,
+--
+2.7.4
+