Skip to contentSkip to conversation

drm/amdgpu: disable workload profile switching when OD is enabled

PATCH In review Alex Deucher 2 participants 2 messages May 29, 2025 – May 30, 2025

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: disable workload profile switching when OD is enabled

Users have reported that they have to reduce the level of undervolting to acheive stability when dynamic workload profiles are enabled on GC 10.3.x. Disable dynamic workload profiles if the user has enabled OD.

Fixes b9467983b774 ("drm/amdgpu: add dynamic workload profile switching for gfx10")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |  8 ++++++++
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c     | 22 ++++++++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h |  1 +
 3 files changed, 31 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +8 -0
index 1db1e6ec0184f..c5646af055abc 100644
@@ -2228,6 +2228,9 @@ void amdgpu_gfx_profile_ring_begin_use(struct amdgpu_ring *ring)
 	enum PP_SMC_POWER_PROFILE profile;
 	int r;
 
+	if (amdgpu_dpm_is_overdrive_enabled(adev))
+		return;
+
 	if (adev->gfx.num_gfx_rings)
 		profile = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
 	else
@@ -2258,6 +2261,11 @@ void amdgpu_gfx_profile_ring_begin_use(struct amdgpu_ring *ring)
 
 void amdgpu_gfx_profile_ring_end_use(struct amdgpu_ring *ring)
 {
+	struct amdgpu_device *adev = ring->adev;
+
+	if (amdgpu_dpm_is_overdrive_enabled(adev))
+		return;
+
 	atomic_dec(&ring->adev->gfx.total_submission_cnt);
 
 	schedule_delayed_work(&ring->adev->gfx.idle_work, GFX_PROFILE_IDLE_TIMEOUT);
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +22 -0
index b5477e02fe996..353f01c0d1000 100644
@@ -1701,6 +1701,28 @@ int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
 	}
 }
 
+int amdgpu_dpm_is_overdrive_enabled(struct amdgpu_device *adev)
+{
+	if (is_support_sw_smu(adev)) {
+		struct smu_context *smu = adev->powerplay.pp_handle;
+
+		return smu->od_enabled;
+	} else {
+		struct pp_hwmgr *hwmgr;
+
+		/*
+		 * dpm on some legacy asics don't carry od_enabled member
+		 * as its pp_handle is casted directly from adev.
+		 */
+		if (amdgpu_dpm_is_legacy_dpm(adev))
+			return false;
+
+		hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle;
+
+		return hwmgr->od_enabled;
+	}
+}
+
 int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
 			    const char *buf,
 			    size_t size)
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1 -0
index b52162112fa68..9163962814ea8 100644
@@ -563,6 +563,7 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev,
 				       void **addr,
 				       size_t *size);
 int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev);
+int amdgpu_dpm_is_overdrive_enabled(struct amdgpu_device *adev);
 int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
 			    const char *buf,
 			    size_t size);
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, May 29, 2025 10:19 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: disable workload profile switching when OD is enabled

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Users have reported that they have to reduce the level of undervolting to acheive stability when dynamic workload profiles are enabled on GC 10.3.x. Disable dynamic workload profiles if the user has enabled OD.

Fixes b9467983b774 ("drm/amdgpu: add dynamic workload profile switching for gfx10")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |  8 ++++++++
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c     | 22 ++++++++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h |  1 +
 3 files changed, 31 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +8 -0
index 1db1e6ec0184f..c5646af055abc 100644
@@ -2228,6 +2228,9 @@ void amdgpu_gfx_profile_ring_begin_use(struct amdgpu_ring *ring)
        enum PP_SMC_POWER_PROFILE profile;
        int r;
 
+       if (amdgpu_dpm_is_overdrive_enabled(adev))
+               return;
+
        if (adev->gfx.num_gfx_rings)
                profile = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
        else
@@ -2258,6 +2261,11 @@ void amdgpu_gfx_profile_ring_begin_use(struct amdgpu_ring *ring)
 
 void amdgpu_gfx_profile_ring_end_use(struct amdgpu_ring *ring)  {
+       struct amdgpu_device *adev = ring->adev;
+
+       if (amdgpu_dpm_is_overdrive_enabled(adev))
+               return;
+
        atomic_dec(&ring->adev->gfx.total_submission_cnt);
 
        schedule_delayed_work(&ring->adev->gfx.idle_work, GFX_PROFILE_IDLE_TIMEOUT); diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c

index b5477e02fe996..353f01c0d1000 100644

drivers/gpu/drm/amd/pm/amdgpu_dpm.c +21 -0
@@ -1701,6 +1701,28 @@ int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
        }
 }
 
+int amdgpu_dpm_is_overdrive_enabled(struct amdgpu_device *adev) {
+       if (is_support_sw_smu(adev)) {
+               struct smu_context *smu = adev->powerplay.pp_handle;
+
+               return smu->od_enabled;
+       } else {
+               struct pp_hwmgr *hwmgr;
+
+               /*
+                * dpm on some legacy asics don't carry od_enabled member
+                * as its pp_handle is casted directly from adev.
+                */
+               if (amdgpu_dpm_is_legacy_dpm(adev))
+                       return false;
+
+               hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle;
+
+               return hwmgr->od_enabled;
+       }
+}
+
 int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
                            const char *buf,
                            size_t size) diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h

index b52162112fa68..9163962814ea8 100644

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1 -1
@@ -563,6 +563,7 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev,
                                       void **addr,
                                       size_t *size);  int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev);
+int amdgpu_dpm_is_overdrive_enabled(struct amdgpu_device *adev);
 int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
                            const char *buf,
                            size_t size);
--

2.49.0