drm/amdkfd: Ignored various return code
Subsystems (3)
PATCH v2 1/1 drm/amdkfd: Ignored various return code
This patch checks and handles the return code of the called function.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 19 ++++++++++++++----- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++----- 4 files changed, 23 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1 -1
@@ -2864,7 +2864,7 @@ static int runtime_disable(struct kfd_process *p) pdd->dev->vm_info.last_vmid_kfd);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + (void )debug_refresh_runlist (pdd->dev->dqm);else kfd_dbg_set_mes_debug_mode (pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev));
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2 -0
@@ -2351,6 +2351,8 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,if (kdev->kfd->hive_id) {for (nid =0 ; nid < proximity_domain; ++nid) { peer_dev =kfd_topology_device_by_proximity_domain_no_lock (nid); +if (!peer_dev) +return -ENODEV ;if (!peer_dev->gpu)continue ;if (peer_dev->gpu->kfd->hive_id != kdev->kfd->hive_id)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +14 -5
@@ -518,6 +518,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)for (i =0 ; i < target->n_pdds; i++) {struct kfd_topology_device *topo_dev =kfd_topology_device_by_id (target->pdds[i]->dev->id); +if (!topo_dev) +return -EINVAL ; +uint32_t caps = topo_dev->node_props.capability; if (!(caps & HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&
@@ -565,9 +568,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)continue ;if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + (void )debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, true); + (void )kfd_dbg_set_mes_debug_mode (pdd, true); } }
@@ -584,8 +587,8 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)*/ void kfd_dbg_trap_deactivate (struct kfd_process *target,bool unwind,int unwind_count) { -int i; +int i, r =0 ;if (!unwind) {uint32_t flags =0 ;int resume_count =resume_queues (target,0 ,NULL );
@@ -627,9 +630,11 @@ void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwindpr_err ("Failed to release debug vmid on [%i]\n" , pdd->dev->id);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + r =debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); + r =kfd_dbg_set_mes_debug_mode (pdd, !kfd_dbg_has_cwsr_workaround (pdd->dev)); +if (r) +break ; }kfd_dbg_set_workaround (target, false);
@@ -1071,6 +1076,10 @@ int kfd_dbg_trap_device_snapshot(struct kfd_process *target,for (i =0 ; i < tmp_num_devices; i++) {struct kfd_process_device *pdd = target->pdds[i];struct kfd_topology_device *topo_dev =kfd_topology_device_by_id (pdd->dev->id); +if (!topo_dev) { + r =EINVAL ; +break ; + } device_info.gpu_id = pdd->dev->id; device_info.exception_status = pdd->exception_status;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +6 -5
@@ -1907,16 +1907,18 @@ static int start_cpsch(struct device_queue_manager *dqm)static int stop_cpsch (struct device_queue_manager *dqm) { +int ret =0 ;dqm_lock (dqm);if (!dqm->sched_running) {dqm_unlock (dqm); -return 0 ; +return ret; }if (!dqm->dev->kfd->shared_resources.enable_mes) -unmap_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES ,0 ,USE_DEFAULT_GRACE_PERIOD , false); + ret =unmap_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES , +0 ,USE_DEFAULT_GRACE_PERIOD , false);else -remove_all_kfd_queues_mes (dqm); + ret =remove_all_kfd_queues_mes (dqm); dqm->sched_running = false;
@@ -1930,7 +1932,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) dqm->detect_hang_info =NULL ;dqm_unlock (dqm); -return 0 ; +return ret; } static int create_kernel_queue_cpsch(struct device_queue_manager *dqm,
@@ -3439,7 +3441,6 @@ int suspend_queues(struct kfd_process *p,else per_device_suspended++; }else if (err != -EBUSY ) { - r = err; queue_ids[q_idx] |=KFD_DBG_QUEUE_ERROR_MASK ;break ; }
Signature · 1 line
2.43.0
[Public]
Might be worth changing the commit headline to what the patch does, something like Don't ignore return codes
Or
Various return code cleanup
Otherwise it sounds like your patch is intentionally ignoring return codes, which is the opposite of what you're doing. Also 2 comments below.
Quoted 129 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrew Martin
Sent: Monday, December 30, 2024 12:02 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Russell, Kent <[email protected]>; Martin, Andrew <[email protected]>
Subject: [PATCH v2] drm/amdkfd: Ignored various return codeThis patch checks and handles the return code of the called function.
Signed-off-by Andrew Martin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 19 ++++++++++++++----- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++----- 4 files changed, 23 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1
-1@@ -2864,7 +2864,7 @@ static int runtime_disable(struct kfd_process *p) pdd->dev->vm_info.last_vmid_kfd);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + (void )debug_refresh_runlist (pdd->dev->dqm);else kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2
-0@@ -2351,6 +2351,8 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,if (kdev->kfd->hive_id) {for (nid =0 ; nid < proximity_domain; ++nid) { peer_dev =kfd_topology_device_by_proximity_domain_no_lock (nid); +if (!peer_dev) +return -ENODEV ;if (!peer_dev->gpu)continue ;if (peer_dev->gpu->kfd->hive_id != kdev->kfd->hive_id)drivers/gpu/drm/amd/amdkfd/kfd_debug.c +3
-0@@ -518,6 +518,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)for (i =0 ; i < target->n_pdds; i++) {struct kfd_topology_device *topo_dev =kfd_topology_device_by_id (target->pdds[i]->dev->id); +if (!topo_dev) +return -EINVAL ; +uint32_t caps = topo_dev->node_props.capability;if (!(caps &
HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&drivers/gpu/drm/amd/amdkfd/kfd_debug.c +3
-3@@ -565,9 +568,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags) continue;if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + (void )debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, true); + (void )kfd_dbg_set_mes_debug_mode (pdd, true); } }@@ -584,8 +587,8 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target,uint32_t *flags) */ void kfd_dbg_trap_deactivate (struct kfd_process *target,bool unwind,int unwind_count) { -int i; +int i, r =0 ;if (!unwind) {uint32_t flags = 0; int resume_count = resume_queues(target, 0, NULL);drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0
-0@@ -627,9 +630,11 @@ void kfd_dbg_trap_deactivate(struct kfd_process *target,bool unwind, int unwind
pr_err("Failed to release debug vmid on [%i]\n", pdd->dev-Quoted 1 line
id);
if (!pdd->dev->kfd->shared_resources.enable_mes)drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-debug_refresh_runlist (pdd->dev->dqm); + r =debug_refresh_runlist (pdd->dev->dqm); else - kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
+ r = kfd_dbg_set_mes_debug_mode(pdd,
!kfd_dbg_has_cwsr_workaround(pdd->dev));drivers/gpu/drm/amd/amdkfd/kfd_debug.c +6
-0+if (r) +break ; }kfd_dbg_set_workaround (target, false);@@ -1071,6 +1076,10 @@ int kfd_dbg_trap_device_snapshot(struct kfd_process *target, for (i = 0; i < tmp_num_devices; i++) {struct kfd_process_device *pdd = target->pdds[i];struct kfd_topology_device *topo_dev =kfd_topology_device_by_id (pdd->dev->id); +if (!topo_dev) { + r =EINVAL ; +break ; + }device_info.gpu_id = pdd->dev->id; device_info.exception_status = pdd->exception_status;drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int start_cpsch(struct device_queue_manager · line 1915
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1@@ -1907,16 +1907,18 @@ static int start_cpsch(struct device_queue_manager *dqm)static int stop_cpsch (struct device_queue_manager *dqm) { +int ret =0 ;dqm_lock (dqm);if (!dqm->sched_running) {dqm_unlock (dqm); -return 0 ; +return ret;
I think it's cleaner to just leave the "return 0" . e.g. If the code gets refactored and new stuff gets added above, then this might flow differently.
Quoted 16 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3
-2}if (!dqm->dev->kfd->shared_resources.enable_mes) -unmap_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES ,0 , USE_DEFAULT_GRACE_PERIOD, false); + ret =unmap_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES , +0 ,USE_DEFAULT_GRACE_PERIOD , false); else -remove_all_kfd_queues_mes (dqm); + ret =remove_all_kfd_queues_mes (dqm); dqm->sched_running = false;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int stop_cpsch(struct device_queue_manager · line 1936
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-1@@ -1930,7 +1932,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) dqm->detect_hang_info =NULL ;dqm_unlock (dqm); -return 0 ; +return ret;
Same here
Kent
Quoted 14 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-0}static int create_kernel_queue_cpsch(struct
device_queue_manager*dqm,drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-1@@ -3439,7 +3441,6 @@ int suspend_queues(struct kfd_process *p,else per_device_suspended++; }else if (err != -EBUSY ) { - r = err; queue_ids[q_idx] |=KFD_DBG_QUEUE_ERROR_MASK ;break ;}--
2.43.0
[Public]
Quoted 9 lines
-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Monday, December 30, 2024 12:44 PM
To: Martin, Andrew <[email protected]>; amd- [email protected]
Cc: Kuehling, Felix <[email protected]>; Martin, Andrew <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code
Quoted 7 lines
[Public]
Might be worth changing the commit headline to what the patch does, something like Don't ignore return codes Or Various return code cleanup
Otherwise it sounds like your patch is intentionally ignoring return codes, which is the opposite of what you're doing. Also 2 comments below.
Thanks, will do!, Please see response to your 2 comments also!
Quoted 141 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c static int kfd_create_vcrat_image_gpu(void
Quoted 43 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrew Martin
Sent: Monday, December 30, 2024 12:02 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Russell, Kent <[email protected]>; Martin, Andrew <[email protected]>
Subject: [PATCH v2] drm/amdkfd: Ignored various return codeThis patch checks and handles the return code of the called function.
Signed-off-by Andrew Martin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 19 ++++++++++++++----- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++----- 4 files changed, 23 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -2864,7 +2864,7 @@ static int runtime_disable(struct kfd_process *p) pdd->dev->vm_info.last_vmid_kfd);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0
-0@@ -2351,6 +2351,8 @@ static int kfd_create_vcrat_image_gpu(void
*pcrat_image,Quoted 97 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2
-0if (kdev->kfd->hive_id) {for (nid =0 ; nid < proximity_domain; ++nid) { peer_dev =kfd_topology_device_by_proximity_domain_no_lock (nid); +if (!peer_dev) +return -ENODEV ;if (!peer_dev->gpu)continue ;if (peer_dev->gpu->kfd->hive_id !=
kdev->kfd->hive_id) diff --gita/drivers/gpu/drm/amd/amdkfd/kfd_debug.cb/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
indexa8abc3091801..b4db409d90a1100644drivers/gpu/drm/amd/amdkfd/kfd_debug.c +3
-0@@ -518,6 +518,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)for (i =0 ; i < target->n_pdds; i++) {struct kfd_topology_device *topo_dev =kfd_topology_device_by_id (target->pdds[i]->dev->id); +if (!topo_dev) +return -EINVAL ; +uint32_t caps = topo_dev->node_props.capability;if (!(caps &
HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&drivers/gpu/drm/amd/amdkfd/kfd_debug.c +4
-2@@ -565,9 +568,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)continue ;if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, true); + (void )kfd_dbg_set_mes_debug_mode (pdd, + true); } }@@ -584,8 +587,8 @@ int kfd_dbg_trap_set_flags(struct kfd_process*target, uint32_t *flags) */ void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind,int
unwind_count)
{drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-int i; +int i, r =0 ;if (!unwind) {uint32_t flags =0 ; int resume_count = resume_queues(target, 0, NULL); @@ -627,9 +630,11 @@ void kfd_dbg_trap_deactivate(struct kfd_process*target, bool unwind, int unwind
pr_err("Failed to release debug vmid on [%i]\n",
pdd->dev-Quoted 1 line
id);
if (!pdd->dev->kfd->shared_resources.enable_mes)drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-debug_refresh_runlist (pdd->dev->dqm); + r =debug_refresh_runlist (pdd->dev->dqm); else - kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
+ r = kfd_dbg_set_mes_debug_mode(pdd,
!kfd_dbg_has_cwsr_workaround(pdd->dev));drivers/gpu/drm/amd/amdkfd/kfd_debug.c +2
-0+if (r) +break ; } kfd_dbg_set_workaround(target, false); @@ -1071,6 +1076,10 @@int kfd_dbg_trap_device_snapshot(struct
kfd_process*target,for (i = 0; i < tmp_num_devices; i++) { struct kfd_process_device *pdd = target->pdds[i]; struct kfd_topology_device *topo_dev =
kfd_topology_device_by_id(pdd->dev->id);drivers/gpu/drm/amd/amdkfd/kfd_debug.c +4
-0+if (!topo_dev) { + r =EINVAL ; +break ; + } device_info.gpu_id = pdd->dev->id; device_info.exception_status = pdd->exception_status;drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-0@@ -1907,16 +1907,18 @@ static int start_cpsch(struct
device_queue_manager
*dqm)
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int start_cpsch(struct device_queue_manager *dqm) · line 1914
Quoted 7 lines
static int
stop_cpsch(struct device_queue_manager *dqm){drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1+int ret =0 ;dqm_lock (dqm);if (!dqm->sched_running) {dqm_unlock (dqm); -return 0 ; +return ret;
I can agree with this one, since it minimizes the changes, but it does flow the same.
Quoted 28 lines
I think it's cleaner to just leave the "return 0" . e.g. If the code gets refactored and new stuff gets added above, then this might flow differently.
Quoted 5 lines
} if (!dqm->dev->kfd->shared_resources.enable_mes)- unmap_queues_cpsch(dqm,
KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0,
USE_DEFAULT_GRACE_PERIOD,Quoted 17 lines
false);
+ ret = unmap_queues_cpsch(dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES,drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3
-1+0 ,USE_DEFAULT_GRACE_PERIOD , + false); else -remove_all_kfd_queues_mes (dqm); + ret =remove_all_kfd_queues_mes (dqm); dqm->sched_running = false;@@ -1930,7 +1932,7 @@ static int stop_cpsch(struct
device_queue_manager
*dqm)dqm->detect_hang_info = NULL; dqm_unlock(dqm);
Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-1-return 0 ; +return ret;Same here
If I change this back to "return 0 ;" then I would have lost the return value from "unmap_queues_cpsch()" or "remove_all_kfd_queues_mes()" which was the whole point of touching this function. But since we in the "stop_cpch()" perhaps it is a more optimal solution is to ignore the return code with
...
(void)unmap_queues_cpsch()
else
(void)remove_all_kfd_queues_mes()
...
Which would be the only change here. Otherwise, I would need to introduce a 3rd return statement. So do let me know which path complements the design more.
Quoted 17 lines
Kent
Quoted 14 lines
}
static int create_kernel_queue_cpsch(struct
device_queue_manager
*dqm, @@ -3439,7 +3441,6 @@ int suspend_queues(structkfd_process*p,else per_device_suspended++; } else if (err != -EBUSY) { - r = err; queue_ids[q_idx] |= KFD_DBG_QUEUE_ERROR_MASK; break; }--
2.43.0
[Public]
Quoted 224 lines
-----Original Message-----
From: Martin, Andrew <[email protected]>
Sent: Monday, December 30, 2024 1:15 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Kuehling, Felix <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code[Public]
Quoted 9 lines
-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Monday, December 30, 2024 12:44 PM
To: Martin, Andrew <[email protected]>; amd- [email protected]
Cc: Kuehling, Felix <[email protected]>; Martin, Andrew <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return codeQuoted 7 lines
[Public]
Might be worth changing the commit headline to what the patch does, something like Don't ignore return codes Or Various return code cleanup
Otherwise it sounds like your patch is intentionally ignoring return codes, which is the opposite of what you're doing. Also 2 comments below.
Thanks, will do!, Please see response to your 2 comments also!
Quoted 64 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c static int kfd_create_vcrat_image_gpu(void
Quoted 43 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrew Martin
Sent: Monday, December 30, 2024 12:02 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Russell, Kent <[email protected]>; Martin, Andrew <[email protected]>
Subject: [PATCH v2] drm/amdkfd: Ignored various return codeThis patch checks and handles the return code of the called function.
Signed-off-by Andrew Martin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 19 ++++++++++++++----- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++----- 4 files changed, 23 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -2864,7 +2864,7 @@ static int runtime_disable(struct kfd_process *p) pdd->dev->vm_info.last_vmid_kfd);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0
-0@@ -2351,6 +2351,8 @@ static int kfd_create_vcrat_image_gpu(void
*pcrat_image,Quoted 20 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2
-0if (kdev->kfd->hive_id) {for (nid =0 ; nid < proximity_domain; ++nid) { peer_dev =kfd_topology_device_by_proximity_domain_no_lock (nid); +if (!peer_dev) +return -ENODEV ;if (!peer_dev->gpu)continue ;if (peer_dev->gpu->kfd->hive_id !=
kdev->kfd->hive_id) diff --gita/drivers/gpu/drm/amd/amdkfd/kfd_debug.cb/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
indexa8abc3091801..b4db409d90a1100644drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0
-0@@ -518,6 +518,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)for (i =0 ; i < target->n_pdds; i++) { struct kfd_topology_device *topo_dev =Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +3
-0kfd_topology_device_by_id (target->pdds[i]->dev->id); +if (!topo_dev) +return -EINVAL ; +uint32_t caps = topo_dev->node_props.capability;if (!(caps &
HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED)Quoted 69 lines
Quoted 69 lines
&&
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +4
-2@@ -565,9 +568,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)continue ;if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, true); + (void )kfd_dbg_set_mes_debug_mode (pdd, + true); } }@@ -584,8 +587,8 @@ int kfd_dbg_trap_set_flags(struct kfd_process*target, uint32_t *flags) */ void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind,int
unwind_count)
{drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-int i; +int i, r =0 ;if (!unwind) {uint32_t flags =0 ; int resume_count = resume_queues(target, 0, NULL); @@ -627,9 +630,11 @@ void kfd_dbg_trap_deactivate(struct kfd_process*target, bool unwind, int unwind
pr_err("Failed to release debug vmid on [%i]\n",
pdd->dev-Quoted 1 line
id);
if (!pdd->dev->kfd->shared_resources.enable_mes)drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-debug_refresh_runlist (pdd->dev->dqm); + r =debug_refresh_runlist (pdd->dev->dqm); else - kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
+ r = kfd_dbg_set_mes_debug_mode(pdd,
!kfd_dbg_has_cwsr_workaround(pdd->dev));drivers/gpu/drm/amd/amdkfd/kfd_debug.c +2
-0+if (r) +break ; } kfd_dbg_set_workaround(target, false); @@ -1071,6 +1076,10 @@int kfd_dbg_trap_device_snapshot(struct
kfd_process*target,for (i = 0; i < tmp_num_devices; i++) { struct kfd_process_device *pdd = target->pdds[i]; struct kfd_topology_device *topo_dev =
kfd_topology_device_by_id(pdd->dev->id);drivers/gpu/drm/amd/amdkfd/kfd_debug.c +4
-0+if (!topo_dev) { + r =EINVAL ; +break ; + } device_info.gpu_id = pdd->dev->id; device_info.exception_status = pdd->exception_status;drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-0@@ -1907,16 +1907,18 @@ static int start_cpsch(struct
device_queue_manager
*dqm)Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int start_cpsch(struct device_queue_manager *dqm) · line 1914
Quoted 7 lines
static int
stop_cpsch(struct device_queue_manager *dqm){drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1+int ret =0 ;dqm_lock (dqm);if (!dqm->sched_running) {dqm_unlock (dqm); -return 0 ; +return ret;I can agree with this one, since it minimizes the changes, but it does flow the same.
Quoted 28 lines
I think it's cleaner to just leave the "return 0" . e.g. If the code gets refactored and new stuff gets added above, then this might flow differently.
Quoted 5 lines
} if (!dqm->dev->kfd->shared_resources.enable_mes)- unmap_queues_cpsch(dqm,
KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0,
USE_DEFAULT_GRACE_PERIOD,Quoted 17 lines
false);
+ ret = unmap_queues_cpsch(dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES,drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3
-1+0 ,USE_DEFAULT_GRACE_PERIOD , + false); else -remove_all_kfd_queues_mes (dqm); + ret =remove_all_kfd_queues_mes (dqm); dqm->sched_running = false;@@ -1930,7 +1932,7 @@ static int stop_cpsch(struct
device_queue_manager
*dqm)dqm->detect_hang_info = NULL; dqm_unlock(dqm);Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-1-return 0 ; +return ret;Same here
If I change this back to "return 0 ;" then I would have lost the return value from "
unmap_queues_cpsch()" or "remove_all_kfd_queues_mes()" which was the whole point of touching this function. But since we in the "stop_cpch()" perhaps it is a more optimal solution is to ignore the return code with
...
(void)unmap_queues_cpsch()
else
(void)remove_all_kfd_queues_mes()
...
Quoted 3 lines
Which would be the only change here. Otherwise, I would need to introduce a 3rd return statement. So do let me know which path complements the design more.
Good point, I missed that it would drop the one from above. That's fine to leave in then.
Kent
Quoted 18 lines
Quoted 17 lines
Kent
Quoted 14 lines
}
static int create_kernel_queue_cpsch(struct
device_queue_manager
*dqm, @@ -3439,7 +3441,6 @@ int suspend_queues(structkfd_process*p,else per_device_suspended++; } else if (err != -EBUSY) { - r = err; queue_ids[q_idx] |= KFD_DBG_QUEUE_ERROR_MASK; break; }--
2.43.0
[Public]
@Russell, Kent
Thanks, I will send out the next version soon!
Quoted 275 lines
-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Monday, December 30, 2024 1:37 PM
To: Martin, Andrew <[email protected]>; amd- [email protected]
Cc: Kuehling, Felix <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code[Public]
Quoted 8 lines
-----Original Message-----
From: Martin, Andrew <[email protected]>
Sent: Monday, December 30, 2024 1:15 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Kuehling, Felix <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return codeQuoted 19 lines
[Public]
Quoted 17 lines
-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Monday, December 30, 2024 12:44 PM
To: Martin, Andrew <[email protected]>; amd- [email protected]
Cc: Kuehling, Felix <[email protected]>; Martin, Andrew <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code[Public]
Might be worth changing the commit headline to what the patch does, something like Don't ignore return codes Or Various return code cleanup
Otherwise it sounds like your patch is intentionally ignoring return codes, which is the opposite of what you're doing. Also 2 comments
below.
Quoted 11 lines
Thanks, will do!, Please see response to your 2 comments also!
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrew Martin
Sent: Monday, December 30, 2024 12:02 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Russell, Kent <[email protected]>; Martin, AndrewQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
Subject: [PATCH v2] drm/amdkfd: Ignored various return code
This patch checks and handles the return code of the called function.
Signed-off-by Andrew Martin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 19 ++++++++++++++-----
Quoted 130 lines
Quoted 48 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c static int kfd_create_vcrat_image_gpu(void
Quoted 27 lines
.../drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++----- 4 files changed, 23 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -2864,7 +2864,7 @@ static int runtime_disable(struct kfd_process *p) pdd->dev->vm_info.last_vmid_kfd);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0
-0@@ -2351,6 +2351,8 @@ static int kfd_create_vcrat_image_gpu(void
*pcrat_image,Quoted 20 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2
-0if (kdev->kfd->hive_id) {for (nid =0 ; nid < proximity_domain; ++nid) { peer_dev =kfd_topology_device_by_proximity_domain_no_lock (nid); +if (!peer_dev) +return -ENODEV ;if (!peer_dev->gpu)continue ;if (peer_dev->gpu->kfd->hive_id !=
kdev->kfd->hive_id) diff --gita/drivers/gpu/drm/amd/amdkfd/kfd_debug.cb/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
indexa8abc3091801..b4db409d90a1100644drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0
-0@@ -518,6 +518,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)for (i =0 ; i < target->n_pdds; i++) { struct kfd_topology_device *topo_dev =Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +3
-0kfd_topology_device_by_id (target->pdds[i]->dev->id); +if (!topo_dev) +return -EINVAL ; +uint32_t caps = topo_dev->node_props.capability;if (!(caps &
HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED)Quoted 73 lines
Quoted 73 lines
&&
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +5
-2@@ -565,9 +568,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)continue ;if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, true); + + (void )kfd_dbg_set_mes_debug_mode (pdd, + true); } }@@ -584,8 +587,8 @@ int kfd_dbg_trap_set_flags(struct kfd_process*target, uint32_t *flags) */ void kfd_dbg_trap_deactivate(struct kfd_process *target, boolunwind, int
unwind_count)
{drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-1-int i; +int i, r =0 ;if (!unwind) {uint32_t flags =0 ;int resume_count =resume_queues (target,0 ,NULL );@@
-627,9 +630,11 @@ void kfd_dbg_trap_deactivate(structkfd_process*target, bool unwind, int unwind
pr_err("Failed to release debug vmid on
[%i]\n",
pdd->dev-Quoted 1 line
id);
if (!pdd->dev->kfd->shared_resources.enable_mes)drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-debug_refresh_runlist (pdd->dev->dqm); + r =debug_refresh_runlist (pdd->dev->dqm); else - kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
+ r = kfd_dbg_set_mes_debug_mode(pdd,
!kfd_dbg_has_cwsr_workaround(pdd->dev));drivers/gpu/drm/amd/amdkfd/kfd_debug.c +2
-0+if (r) +break ; } kfd_dbg_set_workaround(target, false); @@ -1071,6 +1076,10@@ int kfd_dbg_trap_device_snapshot(struct
kfd_process*target,for (i = 0; i < tmp_num_devices; i++) { struct kfd_process_device *pdd = target->pdds[i]; struct kfd_topology_device *topo_dev =
kfd_topology_device_by_id(pdd->dev->id);drivers/gpu/drm/amd/amdkfd/kfd_debug.c +4
-0+if (!topo_dev) { + r =EINVAL ; +break ; + } device_info.gpu_id = pdd->dev->id; device_info.exception_status =
pdd->exception_status; diff --gita/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.cb/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.cindex1405e8affd48..250aa43a39c8100644drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-0@@ -1907,16 +1907,18 @@ static int start_cpsch(struct
device_queue_manager
*dqm)Quoted 9 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int start_cpsch(struct device_queue_manager *dqm) · line 1914
Quoted 7 lines
static int
stop_cpsch(struct device_queue_manager *dqm){drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1+int ret =0 ;dqm_lock (dqm);if (!dqm->sched_running) {dqm_unlock (dqm); -return 0 ; +return ret;I can agree with this one, since it minimizes the changes, but it does flow
the same.
Quoted 4 lines
Quoted 4 lines
I think it's cleaner to just leave the "return 0" . e.g. If the code gets refactored and new stuff gets added above, then this might flow
differently.
Quoted 41 lines
Quoted 25 lines
Quoted 7 lines
} if (!dqm->dev->kfd->shared_resources.enable_mes)- unmap_queues_cpsch(dqm,
KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0,
USE_DEFAULT_GRACE_PERIOD,Quoted 17 lines
false);
+ ret = unmap_queues_cpsch(dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES,drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3
-1+0 , + USE_DEFAULT_GRACE_PERIOD, false); else -remove_all_kfd_queues_mes (dqm); + ret =remove_all_kfd_queues_mes (dqm); dqm->sched_running = false;@@ -1930,7 +1932,7 @@ static int stop_cpsch(struct
device_queue_manager
*dqm)dqm->detect_hang_info = NULL; dqm_unlock(dqm);Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-1-return 0 ; +return ret;Same here
If I change this back to "return 0 ;" then I would have lost the return value from "
unmap_queues_cpsch()" or "remove_all_kfd_queues_mes()" which was the whole point of touching this function. But since we in the "stop_cpch()" perhaps it is a more optimal solution is to ignore the return code with ... (void)unmap_queues_cpsch()
else
(void)remove_all_kfd_queues_mes()
...Quoted 2 lines
Which would be the only change here. Otherwise, I would need to introduce a 3rd return statement. So do let me know which path
complements the design more.
Quoted 1 line
Good point, I missed that it would drop the one from above. That's fine to leave in then.
Kent
Quoted 6 lines
Quoted 6 lines
Kent
Quoted 4 lines
}
static int create_kernel_queue_cpsch(struct
device_queue_manager
*dqm, @@ -3439,7 +3441,6 @@ int suspend_queues(structkfd_process*p,
Quoted 12 lines
Quoted 11 lines
Quoted 10 lines
else per_device_suspended++; } else if (err != -EBUSY) { - r = err; queue_ids[q_idx] |= KFD_DBG_QUEUE_ERROR_MASK; break; }--
2.43.0
[Public]
Greetings, sending peace.
Still seeking a review on this. These changes are simple and should not take much of your time, so please send me a "Reviewed By:" or your comments.
One love!
Quoted 299 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Martin, Andrew
Sent: Monday, December 30, 2024 2:10 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Kuehling, Felix <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code[Public]
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
[Public]
@Russell, Kent
Thanks, I will send out the next version soon!
Quoted 279 lines
-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Monday, December 30, 2024 1:37 PM
To: Martin, Andrew <[email protected]>; amd- [email protected]
Cc: Kuehling, Felix <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code[Public]
Quoted 8 lines
-----Original Message-----
From: Martin, Andrew <[email protected]>
Sent: Monday, December 30, 2024 1:15 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Kuehling, Felix <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return codeQuoted 20 lines
[Public]
Quoted 18 lines
-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Monday, December 30, 2024 12:44 PM
To: Martin, Andrew <[email protected]>; amd- [email protected]
Cc: Kuehling, Felix <[email protected]>; Martin, Andrew <[email protected]>
Subject: RE: [PATCH v2] drm/amdkfd: Ignored various return code[Public]
Might be worth changing the commit headline to what the patch does, something like Don't ignore return codes Or Various return code cleanup
Otherwise it sounds like your patch is intentionally ignoring return codes, which is the opposite of what you're doing. Also 2 comments
below.
Quoted 11 lines
Thanks, will do!, Please see response to your 2 comments also!
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrew Martin
Sent: Monday, December 30, 2024 12:02 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Russell, Kent <[email protected]>; Martin, AndrewQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
Subject: [PATCH v2] drm/amdkfd: Ignored various return code
This patch checks and handles the return code of the called function.
Signed-off-by Andrew Martin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 19 ++++++++++++++-----
Quoted 130 lines
Quoted 48 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c static int kfd_create_vcrat_image_gpu(void
Quoted 27 lines
.../drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++----- 4 files changed, 23 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -2864,7 +2864,7 @@ static int runtime_disable(struct kfd_process *p) pdd->dev->vm_info.last_vmid_kfd);if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0
-0@@ -2351,6 +2351,8 @@ static int kfd_create_vcrat_image_gpu(void
*pcrat_image,Quoted 20 lines
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2
-0if (kdev->kfd->hive_id) {for (nid =0 ; nid < proximity_domain; ++nid) { peer_dev =kfd_topology_device_by_proximity_domain_no_lock (nid); +if (!peer_dev) +return -ENODEV ;if (!peer_dev->gpu)continue ;if (peer_dev->gpu->kfd->hive_id !=
kdev->kfd->hive_id) diff --gita/drivers/gpu/drm/amd/amdkfd/kfd_debug.cb/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
indexa8abc3091801..b4db409d90a1100644drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0
-0@@ -518,6 +518,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)for (i =0 ; i < target->n_pdds; i++) { struct kfd_topology_device *topo_dev =Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +3
-0kfd_topology_device_by_id (target->pdds[i]->dev->id); +if (!topo_dev) +return -EINVAL ; +uint32_t caps = topo_dev->node_props.capability;if (!(caps &
HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED)Quoted 73 lines
Quoted 73 lines
&&
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +5
-2@@ -565,9 +568,9 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)continue ;if (!pdd->dev->kfd->shared_resources.enable_mes) -debug_refresh_runlist (pdd->dev->dqm); + + (void )debug_refresh_runlist (pdd->dev->dqm);else -kfd_dbg_set_mes_debug_mode (pdd, true); + + (void )kfd_dbg_set_mes_debug_mode (pdd, + true); } }@@ -584,8 +587,8 @@ int kfd_dbg_trap_set_flags(structkfd_process *target, uint32_t *flags) */ void kfd_dbg_trap_deactivate(struct kfd_process *target, boolunwind, int
unwind_count)
{drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-1-int i; +int i, r =0 ;if (!unwind) {uint32_t flags =0 ;int resume_count =resume_queues (target,0 ,NULL );@@
-627,9 +630,11 @@ void kfd_dbg_trap_deactivate(structkfd_process*target, bool unwind, int unwind
pr_err("Failed to release debug vmid on
[%i]\n",
pdd->dev-Quoted 1 line
id);
if (!pdd->dev->kfd->shared_resources.enable_mes)drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1
-2-debug_refresh_runlist (pdd->dev->dqm); + r =debug_refresh_runlist (pdd->dev->dqm); else - kfd_dbg_set_mes_debug_mode(pdd,!kfd_dbg_has_cwsr_workaround(pdd->dev));
+ r = kfd_dbg_set_mes_debug_mode(pdd,
!kfd_dbg_has_cwsr_workaround(pdd->dev));drivers/gpu/drm/amd/amdkfd/kfd_debug.c +2
-0+if (r) +break ; } kfd_dbg_set_workaround(target, false); @@ -1071,6 +1076,10@@ int kfd_dbg_trap_device_snapshot(struct
kfd_process*target,for (i = 0; i < tmp_num_devices; i++) { struct kfd_process_device *pdd = target->pdds[i]; struct kfd_topology_device *topo_dev =
kfd_topology_device_by_id(pdd->dev->id);drivers/gpu/drm/amd/amdkfd/kfd_debug.c +4
-0+if (!topo_dev) { + r =EINVAL ; +break ; + } device_info.gpu_id = pdd->dev->id; device_info.exception_status =
pdd->exception_status; diff --gita/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.cb/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.cindex1405e8affd48..250aa43a39c8100644drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0
-0@@ -1907,16 +1907,18 @@ static int start_cpsch(struct
device_queue_manager
*dqm)Quoted 10 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int start_cpsch(struct device_queue_manager *dqm) · line 1914
Quoted 7 lines
static int
stop_cpsch(struct device_queue_manager *dqm){drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2
-1+int ret =0 ;dqm_lock (dqm);if (!dqm->sched_running) {dqm_unlock (dqm); -return 0 ; +return ret;I can agree with this one, since it minimizes the changes, but it does flow
the same.
Quoted 5 lines
Quoted 5 lines
I think it's cleaner to just leave the "return 0" . e.g. If the code gets refactored and new stuff gets added above, then this might flow
differently.
Quoted 41 lines
Quoted 25 lines
Quoted 7 lines
} if (!dqm->dev->kfd->shared_resources.enable_mes)- unmap_queues_cpsch(dqm,
KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0,
USE_DEFAULT_GRACE_PERIOD,Quoted 17 lines
false);
+ ret = unmap_queues_cpsch(dqm,KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES,drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3
-1+0 , + USE_DEFAULT_GRACE_PERIOD, false); else -remove_all_kfd_queues_mes (dqm); + ret =remove_all_kfd_queues_mes (dqm); dqm->sched_running = false;@@ -1930,7 +1932,7 @@ static int stop_cpsch(struct
device_queue_manager
*dqm)dqm->detect_hang_info = NULL; dqm_unlock(dqm);Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +1
-1-return 0 ; +return ret;Same here
If I change this back to "return 0 ;" then I would have lost the return value from "
unmap_queues_cpsch()" or "remove_all_kfd_queues_mes()" which was the whole point of touching this function. But since we in the "stop_cpch()" perhaps it is a more optimal solution is to ignore the return code with ... (void)unmap_queues_cpsch()
else
(void)remove_all_kfd_queues_mes()
...Quoted 2 lines
Which would be the only change here. Otherwise, I would need to introduce a 3rd return statement. So do let me know which path
complements the design more.
Quoted 1 line
Good point, I missed that it would drop the one from above. That's fine to leave in then.
Kent
Quoted 7 lines
Quoted 7 lines
Kent
Quoted 5 lines
}
static int create_kernel_queue_cpsch(struct
device_queue_manager*dqm, @@ -3439,7 +3441,6 @@ int suspend_queues(structkfd_process*p,
Quoted 12 lines
Quoted 11 lines
Quoted 10 lines
else per_device_suspended++; } else if (err != -EBUSY) { - r = err; queue_ids[q_idx] |= KFD_DBG_QUEUE_ERROR_MASK; break; }--
2.43.0