All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: Avoid null pointer in SMI event
@ 2021-03-30 21:02 Amber Lin
  2021-04-01 18:52 ` Joshi, Mukul
  0 siblings, 1 reply; 2+ messages in thread
From: Amber Lin @ 2021-03-30 21:02 UTC (permalink / raw)
  To: amd-gfx; +Cc: Amber Lin, mukul.joshi

Power Management IP is initialized/enabled before KFD init. When a
thermal throttling happens before kfd_smi_init is done, calling the KFD
SMI update function causes a stack dump by referring a NULL pointer (
smi_clients list). Check if kfd_init is completed before calling the
function.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 72c893fff61a..3cd46d7190b3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -1297,7 +1297,7 @@ void kfd_dec_compute_active(struct kfd_dev *kfd)
 
 void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask)
 {
-	if (kfd)
+	if (kfd && kfd->init_complete)
 		kfd_smi_event_update_thermal_throttling(kfd, throttle_bitmask);
 }
 
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] drm/amdkfd: Avoid null pointer in SMI event
  2021-03-30 21:02 [PATCH] drm/amdkfd: Avoid null pointer in SMI event Amber Lin
@ 2021-04-01 18:52 ` Joshi, Mukul
  0 siblings, 0 replies; 2+ messages in thread
From: Joshi, Mukul @ 2021-04-01 18:52 UTC (permalink / raw)
  To: Lin, Amber, amd-gfx@lists.freedesktop.org

[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>

Regards,
Mukul

-----Original Message-----
From: Lin, Amber <Amber.Lin@amd.com> 
Sent: Tuesday, March 30, 2021 5:03 PM
To: amd-gfx@lists.freedesktop.org
Cc: Joshi, Mukul <Mukul.Joshi@amd.com>; Lin, Amber <Amber.Lin@amd.com>
Subject: [PATCH] drm/amdkfd: Avoid null pointer in SMI event

Power Management IP is initialized/enabled before KFD init. When a thermal throttling happens before kfd_smi_init is done, calling the KFD SMI update function causes a stack dump by referring a NULL pointer ( smi_clients list). Check if kfd_init is completed before calling the function.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 72c893fff61a..3cd46d7190b3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -1297,7 +1297,7 @@ void kfd_dec_compute_active(struct kfd_dev *kfd)
 
 void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint32_t throttle_bitmask)  {
-	if (kfd)
+	if (kfd && kfd->init_complete)
 		kfd_smi_event_update_thermal_throttling(kfd, throttle_bitmask);  }
 
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-01 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-30 21:02 [PATCH] drm/amdkfd: Avoid null pointer in SMI event Amber Lin
2021-04-01 18:52 ` Joshi, Mukul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.