]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdkfd: Fix wrong usage of INIT_WORK()
authorYuan Can <yuancan@huawei.com>
Wed, 6 Nov 2024 01:35:41 +0000 (09:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:50:58 +0000 (19:50 +0100)
[ Upstream commit 21cae8debc6a1d243f64fa82cd1b41cb612b5c61 ]

In kfd_procfs_show(), the sdma_activity_work_handler is a local variable
and the sdma_activity_work_handler.sdma_activity_work should initialize
with INIT_WORK_ONSTACK() instead of INIT_WORK().

Fixes: 32cb59f31362 ("drm/amdkfd: Track SDMA utilization per process")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index 7f69031f2b61a85f19741fb87dd7a20465d5723c..49810642bc2b8e5c06441951c87c9aaf23e7c1cd 100644 (file)
@@ -311,8 +311,8 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr,
                                                              attr_sdma);
                struct kfd_sdma_activity_handler_workarea sdma_activity_work_handler;
 
-               INIT_WORK(&sdma_activity_work_handler.sdma_activity_work,
-                                       kfd_sdma_activity_worker);
+               INIT_WORK_ONSTACK(&sdma_activity_work_handler.sdma_activity_work,
+                                 kfd_sdma_activity_worker);
 
                sdma_activity_work_handler.pdd = pdd;
                sdma_activity_work_handler.sdma_activity_counter = 0;
@@ -320,6 +320,7 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr,
                schedule_work(&sdma_activity_work_handler.sdma_activity_work);
 
                flush_work(&sdma_activity_work_handler.sdma_activity_work);
+               destroy_work_on_stack(&sdma_activity_work_handler.sdma_activity_work);
 
                return snprintf(buffer, PAGE_SIZE, "%llu\n",
                                (sdma_activity_work_handler.sdma_activity_counter)/