Skip to contentSkip to conversation

drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

PATCH Superseded Rex Zhu 3 participants 16 messages Jan 25, 2018 – Jan 29, 2018 14 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/2 drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15 +++++++--------
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -2
index 1812009..66b4df0 100644
@@ -152,7 +152,6 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
 			(level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
 			(level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
 			(level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-			(level == AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" :
 			(level == AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :
 			(level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :
 			(level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :
@@ -186,7 +185,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
 	} else if (strncmp("auto", buf, strlen("auto")) == 0) {
 		level = AMD_DPM_FORCED_LEVEL_AUTO;
 	} else if (strncmp("manual", buf, strlen("manual")) == 0) {
-		level = AMD_DPM_FORCED_LEVEL_MANUAL;
+		pr_info("No need to set manual mode, Just go ahead\n");
 	} else if (strncmp("profile_exit", buf, strlen("profile_exit")) == 0) {
 		level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
 	} else if (strncmp("profile_standard", buf, strlen("profile_standard")) == 0) {
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
index ab45232..8ddc978 100644
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct ci_power_info *pi = ci_get_pi(adev);
 
-	if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!pi->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
index b9aa9f4..3fab686 100644
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
 	AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-	AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-	AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-	AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-	AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-	AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-	AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+	AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+	AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+	AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+	AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+	AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -4
index dec8dd9..60d280c 100644
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 	case AMD_DPM_FORCED_LEVEL_AUTO:
 		ret = cz_phm_unforce_dpm_levels(hwmgr);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr,
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
 		enum pp_clock_type type, uint32_t mask)
 {
-	if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		smum_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
index 409a56b..eddcbcd 100644
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 						PPSMC_MSG_SetSoftMaxFclkByFreq,
 						RAVEN_UMD_PSTATE_MIN_FCLK);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -6
index 13db75c..e3a8374 100644
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
 		smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-					AMD_DPM_FORCED_LEVEL_LOW |
-					AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!data->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -6
index 6b28896..828677e 100644
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 		vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
 		vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		data->smc_state_table.gfx_boot_level = mask ? (ffs(mask) - 1) : 0;
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1516879614-11533-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amd/pp: Fix sysfs pp_dpm_pcie bug on CI/VI

when echo "01">pp_dpm_pcie
the pcie dpm will fix in highest link speed.
But user should expect auto speed between
level 0 and level1

Change-Id I89b8fef3c179c3729b1c06b17e9cb86b52244d7b
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c              | 17 ++++++++++-------
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 17 ++++++++++-------
 2 files changed, 20 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +10 -7
index 8ddc978..fc19d10 100644
@@ -6639,6 +6639,9 @@ static int ci_dpm_force_clock_level(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct ci_power_info *pi = ci_get_pi(adev);
 
+	if (mask == 0)
+		return -EINVAL;
+
 	switch (type) {
 	case PP_SCLK:
 		if (!pi->sclk_dpm_key_disabled)
@@ -6657,15 +6660,15 @@ static int ci_dpm_force_clock_level(void *handle,
 	case PP_PCIE:
 	{
 		uint32_t tmp = mask & pi->dpm_level_enable_mask.pcie_dpm_enable_mask;
-		uint32_t level = 0;
 
-		while (tmp >>= 1)
-			level++;
-
-		if (!pi->pcie_dpm_key_disabled)
-			amdgpu_ci_send_msg_to_smc_with_parameter(adev,
+		if (!pi->pcie_dpm_key_disabled) {
+			if (fls(tmp) != ffs(tmp))
+				amdgpu_ci_send_msg_to_smc(adev, PPSMC_MSG_PCIeDPM_UnForceLevel);
+			else
+				amdgpu_ci_send_msg_to_smc_with_parameter(adev,
 					PPSMC_MSG_PCIeDPM_ForceLevel,
-					level);
+					fls(tmp) - 1);
+		}
 		break;
 	}
 	default:
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +10 -7
index e3a8374..88aaac1 100644
@@ -4310,6 +4310,9 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
+	if (mask == 0)
+		return -EINVAL;
+
 	switch (type) {
 	case PP_SCLK:
 		if (!data->sclk_dpm_key_disabled)
@@ -4326,15 +4329,15 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 	case PP_PCIE:
 	{
 		uint32_t tmp = mask & data->dpm_level_enable_mask.pcie_dpm_enable_mask;
-		uint32_t level = 0;
 
-		while (tmp >>= 1)
-			level++;
-
-		if (!data->pcie_dpm_key_disabled)
-			smum_send_msg_to_smc_with_parameter(hwmgr,
+		if (!data->pcie_dpm_key_disabled) {
+			if (fls(tmp) != ffs(tmp))
+				smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PCIeDPM_UnForceLevel);
+			else
+				smum_send_msg_to_smc_with_parameter(hwmgr,
 					PPSMC_MSG_PCIeDPM_ForceLevel,
-					level);
+					fls(tmp) - 1);
+		}
 		break;
 	}
 	default:
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw
In reply to a message not in the archive

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
  Felix

Quoted 155 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15 +++++++--------
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -2
index 1812009..66b4df0 100644
@@ -152,7 +152,6 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
 			(level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
 			(level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
 			(level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-			(level == AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" :
 			(level == AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :
 			(level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :
 			(level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :
@@ -186,7 +185,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
 	} else if (strncmp("auto", buf, strlen("auto")) == 0) {
 		level = AMD_DPM_FORCED_LEVEL_AUTO;
 	} else if (strncmp("manual", buf, strlen("manual")) == 0) {
-		level = AMD_DPM_FORCED_LEVEL_MANUAL;
+		pr_info("No need to set manual mode, Just go ahead\n");
 	} else if (strncmp("profile_exit", buf, strlen("profile_exit")) == 0) {
 		level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
 	} else if (strncmp("profile_standard", buf, strlen("profile_standard")) == 0) {
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
index ab45232..8ddc978 100644
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct ci_power_info *pi = ci_get_pi(adev);
 
-	if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!pi->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
index b9aa9f4..3fab686 100644
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
 	AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-	AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-	AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-	AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-	AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-	AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-	AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+	AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+	AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+	AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+	AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+	AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+	AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -4
index dec8dd9..60d280c 100644
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 	case AMD_DPM_FORCED_LEVEL_AUTO:
 		ret = cz_phm_unforce_dpm_levels(hwmgr);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr,
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
 		enum pp_clock_type type, uint32_t mask)
 {
-	if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		smum_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
index 409a56b..eddcbcd 100644
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 						PPSMC_MSG_SetSoftMaxFclkByFreq,
 						RAVEN_UMD_PSTATE_MIN_FCLK);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -6
index 13db75c..e3a8374 100644
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
 		smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-					AMD_DPM_FORCED_LEVEL_LOW |
-					AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!data->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
index 6b28896..828677e 100644
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 		vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
 		vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,
 {

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct pp_hwmgr *hwmgr, · line 4504

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
 	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		data->smc_state_table.gfx_boot_level = mask ? (ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 51c6111b-78ec-36f8-b5e0-4a23ccea6de4-5C7GfCeVMHo@public.gmane.org

author
#5 lore raw

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think?if user change back the clk range through pp dpm clk.

we are in manual mode, and user set auto mode, in fact, driver change nothing.

Comparatively speaking, better set manual mode after user call pp dpm clk. Thanks very much.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Friday, January 26, 2018 12:55:19 AM
To: [email protected]; Zhu, Rex
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 155 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15 +++++++--------
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -2
index 1812009..66b4df0 100644
@@ -152,7 +152,6 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" :
                       (level == AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :
                       (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :
                       (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :
@@ -186,7 +185,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go ahead\n");
       } else if (strncmp("profile_exit", buf, strlen("profile_exit")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf, strlen("profile_standard")) == 0) {
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
index ab45232..8ddc978 100644
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
index b9aa9f4..3fab686 100644
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -4
index dec8dd9..60d280c 100644
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr,
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)
 {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
index 409a56b..eddcbcd 100644
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                                               PPSMC_MSG_SetSoftMaxFclkByFreq,
                                               RAVEN_UMD_PSTATE_MIN_FCLK);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -6
index 13db75c..e3a8374 100644
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
index 6b28896..828677e 100644
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
               vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
               vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,
 {

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct pp_hwmgr *hwmgr, · line 4504

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
       struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
 
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ? (ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1687930CD8F44390C3791A63FBE10-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#7 lore raw
Quoted 6 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

Quoted 7 lines

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm clk.

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
  Felix

Quoted 211 lines

Thanks very much.

Best Regards
Rex
------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex
*Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
  Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 11 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +-- drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----

Review

Quoted 8 lines
  drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15 +++++++--------
  drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
  drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
  7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 4 lines

                        (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
                        (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                        (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
         } else if (strncmp("auto", buf, strlen("auto")) == 0) {
                 level = AMD_DPM_FORCED_LEVEL_AUTO;
         } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go ahead\n");
         } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                 level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
         } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

Quoted 15 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         struct ci_power_info *pi = ci_get_pi(adev);


-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                             AMD_DPM_FORCED_LEVEL_LOW | -                             AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                if (!pi->sclk_dpm_key_disabled)

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Quoted 25 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -0
@@ -41,14 +41,13 @@ struct amd_vce_state {


  enum amd_dpm_forced_level { AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10, -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20, -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40, -     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80, -     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100, +     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8, +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10, +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20, +     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40, +     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80, };

  enum amd_pm_state_type {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines

        case AMD_DPM_FORCED_LEVEL_AUTO:
                ret = cz_phm_unforce_dpm_levels(hwmgr); break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
   static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
                 enum pp_clock_type type, uint32_t mask)
   {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
         switch (type) {

        case PP_SCLK:
                smum_send_msg_to_smc_with_parameter(hwmgr,

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines

                break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
                 smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
                 smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
                 break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:

        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
   {
         struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);


-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                                     AMD_DPM_FORCED_LEVEL_LOW | -                                     AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                if (!data->sclk_dpm_key_disabled)

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
                 vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
                 vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
                 break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:

        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
   {

        struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

Quoted 9 lines


-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                             AMD_DPM_FORCED_LEVEL_LOW | -                             AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                data->smc_state_table.gfx_boot_level = mask ?

Quoted 2 lines

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 0ce63372-dc11-9710-f11d-0cf6abf326b4-5C7GfCeVMHo@public.gmane.org

author
#9 lore raw

Hi Felix,

Quoted 3 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once this sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

________________________________
From: Kuehling, Felix
Sent: Friday, January 26, 2018 8:26 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 6 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

Quoted 7 lines

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm clk.

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 211 lines

Thanks very much.

Best Regards
Rex
------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 18 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15 +++++++--------
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 157

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go ahead\n");
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

Review

Quoted 16 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)
 {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 12 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
               vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
               vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4500

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
 {
       struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4503

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?
Quoted 2 lines

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB168744ABA067C470390EA34EFBE00-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#11 lore raw

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools
2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
  Felix

Quoted 255 lines · Rex

Hi Felix,

Quoted 3 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through power_profile_mode,

      2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once this sysffs was called, set the dpm level mode to unknown)

      3. adjust power limit through pp_od_power_limit(maybe equal to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 6 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

Quoted 7 lines

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm clk.

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
  Felix

Quoted 15 lines

Thanks very much.

Best Regards
Rex
------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex
*Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Quoted 20 lines

Regards,
  Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 12 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +-- drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 ----- drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 35 lines

Review

Quoted 7 lines

  drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ---- drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 - drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------ drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------

  7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 4 lines

                        (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
                        (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                        (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
         } else if (strncmp("auto", buf, strlen("auto")) == 0) {
                 level = AMD_DPM_FORCED_LEVEL_AUTO;
         } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go ahead\n");
         } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                 level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
         } else if (strncmp("profile_standard", buf,
Quoted 7 lines

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 95 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         struct ci_power_info *pi = ci_get_pi(adev);


-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                             AMD_DPM_FORCED_LEVEL_LOW | -                             AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                if (!pi->sclk_dpm_key_disabled)

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Quoted 25 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -0
@@ -41,14 +41,13 @@ struct amd_vce_state {


  enum amd_dpm_forced_level { AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10, -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20, -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40, -     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80, -     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100, +     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8, +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10, +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20, +     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40, +     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80, };

  enum amd_pm_state_type {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines

        case AMD_DPM_FORCED_LEVEL_AUTO:
                ret = cz_phm_unforce_dpm_levels(hwmgr); break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
   static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
                 enum pp_clock_type type, uint32_t mask)
   {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
         switch (type) {

        case PP_SCLK:
                smum_send_msg_to_smc_with_parameter(hwmgr,

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines

                break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
                 smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
                 smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
                 break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:

        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 43 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
   {

        struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 39 lines

Review

Quoted 10 lines


-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                                     AMD_DPM_FORCED_LEVEL_LOW | -                                     AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                if (!data->sclk_dpm_key_disabled)

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
                 vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
                 vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
                 break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:

        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
   {

        struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

Quoted 9 lines


-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                             AMD_DPM_FORCED_LEVEL_LOW | -                             AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): ec6ea7dd-0096-dd92-8c49-b2992b5bf506-5C7GfCeVMHo@public.gmane.org

author
#13 lore raw
Quoted 2 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Quoted 3 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left (level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

Best Regards
Rex

________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 12:49 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools
2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 255 lines · Rex

Hi Felix,

Quoted 3 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once this
sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal to
disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 6 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

Quoted 7 lines

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm clk.

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 15 lines

Thanks very much.

Best Regards
Rex
------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Quoted 20 lines

Regards,
Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 12 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 35 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ? "auto" :
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 157

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go ahead\n");
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,
Quoted 7 lines

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 95 lines

Review

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)
 {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 43 lines
Quoted 2 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct · line 4311

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 39 lines

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
               vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
               vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4500

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
 {
       struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4503

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1687BFBCA906C0B17D52089BFBE00-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#15 lore raw
Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through  pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command,  if still receive the manual command, driver just return sucess to user in order not  break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines

 >2. You're taking the clock limits out of the power profile. >  Automatically adjusting the minimum sclk/mclk is a requirement for >   the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
  Felix

Quoted 307 lines

Best Regards
Rex

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

 1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools
 2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
  Felix

Quoted 7 lines · Rex

Hi Felix,

Quoted 3 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 37 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

  1. configure uphyst/downhyst/min_ativity through power_profile_mode,

      2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once this sysffs was called, set the dpm level mode to unknown)

      3. adjust power limit through pp_od_power_limit(maybe equal to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

Quoted 18 lines

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 10 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 10 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

Quoted 14 lines

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
  Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

------------------------------------------------------------------------

Quoted 24 lines
Quoted 24 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex
*Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
  Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +-- drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 ----- drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines

  drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ---- drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 - drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------ drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------

  7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line

                        (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

                        (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                        (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

Quoted 1 line

                        (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line

                        (level ==

Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
         } else if (strncmp("auto", buf, strlen("auto")) == 0) {
                 level = AMD_DPM_FORCED_LEVEL_AUTO;
         } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 126 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
         } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                 level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
         } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 86 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         struct ci_power_info *pi = ci_get_pi(adev);


-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                             AMD_DPM_FORCED_LEVEL_LOW | -                             AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                if (!pi->sclk_dpm_key_disabled)

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Quoted 25 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -0
@@ -41,14 +41,13 @@ struct amd_vce_state {


  enum amd_dpm_forced_level { AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10, -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20, -     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40, -     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80, -     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100, +     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8, +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10, +     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20, +     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40, +     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80, };

  enum amd_pm_state_type {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines

        case AMD_DPM_FORCED_LEVEL_AUTO:
                ret = cz_phm_unforce_dpm_levels(hwmgr); break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
   static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
                 enum pp_clock_type type, uint32_t mask)
   {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
         switch (type) {

        case PP_SCLK:
                smum_send_msg_to_smc_with_parameter(hwmgr,

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines

                break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
                 smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
                 smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
                 break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:

        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
   {

        struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 16 lines

Review

Quoted 10 lines


-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                                     AMD_DPM_FORCED_LEVEL_LOW | -                                     AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                if (!data->sclk_dpm_key_disabled)

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 27 lines
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct · line 4241

Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
                 vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct · line 4242

Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
                 vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 22 lines
Quoted 21 lines

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
                 break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:

        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
   {

        struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

Quoted 9 lines


-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO | -                             AMD_DPM_FORCED_LEVEL_LOW | -                             AMD_DPM_FORCED_LEVEL_HIGH)) -             return -EINVAL;
-
        switch (type) {
        case PP_SCLK:
                data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): cc9e6d84-9720-15fb-15ec-f608f8d9392d-5C7GfCeVMHo@public.gmane.org

author
#17 lore raw
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 1 line

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 307 lines

Best Regards
Rex

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools
2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 7 lines · Rex

Hi Felix,

Quoted 3 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 37 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once this
sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal to
disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

Quoted 18 lines

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 10 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 10 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

Quoted 14 lines

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

------------------------------------------------------------------------

Quoted 24 lines
Quoted 24 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 154

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 126 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 86 lines

Review

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)
 {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 16 lines

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 27 lines
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct · line 4241

Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
               vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct · line 4242

Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
               vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 22 lines
Quoted 21 lines

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4500

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
 {
       struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4503

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1687274014BDD739BE44DF6CFBE00-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#19 lore raw

I think we have two use cases for the profiles:

1. automatic profile switching for different driver use cases
2. manually tweaking profiles/clocks/power for testing

How about we make the profile selection dependent on selecting the manual force_performance_level and not add an auto to the profile selector. Then when you select manual you can tweak the clocks and profile heuristics and power containment via their respective knobs.

Alex

Quoted 403 lines · Rex
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 2 lines

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 307 lines

Best Regards
Rex

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools
2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 7 lines · Rex

Hi Felix,

Quoted 3 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 37 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once this
sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal to
disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

Quoted 18 lines

------------------------------------------------------------------------
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 10 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 10 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

Quoted 14 lines

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

------------------------------------------------------------------------

Quoted 24 lines
Quoted 24 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 2 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools,
when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 154

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 126 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 86 lines

Review

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)
 {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 16 lines

Review

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct

Quoted 4 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 27 lines
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct · line 4241

Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
               vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_dpm_force_dpm_level(struct · line 4242

Quoted 1 line
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
               vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 22 lines
Quoted 21 lines

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct

Quoted 6 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4500

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
 {
       struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static int vega10_force_clock_level(struct · line 4503

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

Quoted 5 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_Ni6j8ONe7f5rDMprbeB6Mq1RVXJAonUO2VTp+1Dgf+Gw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#21 lore raw

Hi Alex,

Quoted 1 line

How about we make the profile selection dependent on selecting the manual force_performance_level

If so, we need to check pm.dpm.forced_level before "profile heuristics" and "disable power containment" as same as pp_dpm_sclk/mclk/pcie.

if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |

                               AMD_DPM_FORCED_LEVEL_LOW |
                               AMD_DPM_FORCED_LEVEL_HIGH))
               return -EINVAL; 

How about delete judging code before force_clock_level and just change force_level to manual after force_clock_level. Please see the attached patch.

This change have no impact on existing interface and tools.
It just refine the logic of power_dpm_force_performance_level and pp_dpm_sclk/mclk/pcie. Also has no impact to power/computer profile mode on smu7.

The difference is:

New user can have one less command need to input if they want to use pp_dpm_sclk/mclk/pcie.

Best Regards
Rex
-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Saturday, January 27, 2018 7:51 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

I think we have two use cases for the profiles:

1. automatic profile switching for different driver use cases 2. manually tweaking profiles/clocks/power for testing

How about we make the profile selection dependent on selecting the manual force_performance_level and not add an auto to the profile selector. Then when you select manual you can tweak the clocks and profile heuristics and power containment via their respective knobs.

Alex

Quoted 411 lines · Rex
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 2 lines

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 314 lines

Best Regards
Rex

---------------------------------------------------------------------
---
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools 2. You're taking the
clock limits out of the power profile.
Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 8 lines · Rex

Hi Felix,

Quoted 4 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 46 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through
power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once
this sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal
to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

-------------------------------------------------------------------
-----
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines
Quoted 11 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 10 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

Quoted 14 lines

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

---------------------------------------------------------------------
---

Quoted 25 lines
Quoted 25 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 3 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools, when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 154

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 126 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 85 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled) diff --git 
Quoted 1 line

a/drivers/gpu/drm/amd/include/kgd_pp_interface.h

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)  {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 17 lines
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled) diff --git 

a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 5 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int 

vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 28 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 23 lines
Quoted 22 lines
Quoted 7 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int 

vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines

{
struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

Quoted 5 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

From d58a303fea24c777fbdab41a0af0bf981ffe5ecf Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Mon, 29 Jan 2018 15:09:01 +0800
Subject: [PATCH] drm/amd/pp: Refine manual mode for
power_dpm_force_performance_level

Delete current performance mode code check before change clock range through pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie, just notify user that the performance mode has been changed by setting the mode to manual.

Change-Id I9cdedee7f8f6dd320458ff905680dde1932aded7
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             | 2 +-
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                | 7 +------
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     | 1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 ------
 7 files changed, 3 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
index 39ef93a..b0cdb14 100644
@@ -186,7 +186,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
 	} else if (strncmp("auto", buf, strlen("auto")) == 0) {
 		level = AMD_DPM_FORCED_LEVEL_AUTO;
 	} else if (strncmp("manual", buf, strlen("manual")) == 0) {
-		level = AMD_DPM_FORCED_LEVEL_MANUAL;
+		return count;
 	} else if (strncmp("profile_exit", buf, strlen("profile_exit")) == 0) {
 		level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
 	} else if (strncmp("profile_standard", buf, strlen("profile_standard")) == 0) {
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -6
index 5ceb5a2..cf4b55e 100644
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct ci_power_info *pi = ci_get_pi(adev);
 
-	if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!pi->sclk_dpm_key_disabled)
@@ -6676,7 +6671,7 @@ static int ci_dpm_force_clock_level(void *handle,
 	default:
 		break;
 	}
-
+	adev->pm.dpm.forced_level = AMD_DPM_FORCED_LEVEL_MANUAL;
 	return 0;
 }
 
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -0
index 173382c..86c5e28 100644
@@ -840,6 +840,7 @@ static int pp_dpm_force_clock_level(void *handle,
 	}
 	mutex_lock(&pp_handle->pp_lock);
 	hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);
+	hwmgr->dpm_level = AMD_DPM_FORCED_LEVEL_MANUAL;
 	mutex_unlock(&pp_handle->pp_lock);
 	return ret;
 }
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -4
index 1394b2b..fe6e161 100644
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 	case AMD_DPM_FORCED_LEVEL_AUTO:
 		ret = cz_phm_unforce_dpm_levels(hwmgr);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr,
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
 		enum pp_clock_type type, uint32_t mask)
 {
-	if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		smum_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
index 409a56b..eddcbcd 100644
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 						PPSMC_MSG_SetSoftMaxFclkByFreq,
 						RAVEN_UMD_PSTATE_MIN_FCLK);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -6
index 715880b..ec12fba 100644
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
 		smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-					AMD_DPM_FORCED_LEVEL_LOW |
-					AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!data->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -6
index 4c259cd..47b8583 100644
@@ -4241,7 +4241,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 		vega10_force_clock_level(hwmgr, PP_SCLK, 1<<sclk_mask);
 		vega10_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
 		break;
-	case AMD_DPM_FORCED_LEVEL_MANUAL:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -4500,11 +4499,6 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		data->smc_state_table.gfx_boot_level = mask ? (ffs(mask) - 1) : 0;
Signature · 1 line
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1687A63BA8F717170700292DFBE50-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#23 lore raw
Quoted 13 lines · Rex

Hi Alex,

Quoted 1 line

How about we make the profile selection dependent on selecting the manual force_performance_level

If so, we need to check pm.dpm.forced_level before "profile heuristics" and "disable power containment" as same as pp_dpm_sclk/mclk/pcie.

if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |

                               AMD_DPM_FORCED_LEVEL_LOW |
                               AMD_DPM_FORCED_LEVEL_HIGH))
               return -EINVAL;

How about delete judging code before force_clock_level and just change force_level to manual after force_clock_level. Please see the attached patch.

Quoted 7 lines

This change have no impact on existing interface and tools.
It just refine the logic of power_dpm_force_performance_level and pp_dpm_sclk/mclk/pcie. Also has no impact to power/computer profile mode on smu7.

The difference is:

New user can have one less command need to input if they want to use pp_dpm_sclk/mclk/pcie.

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Alex

Quoted 13 lines

Best Regards
Rex
-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Saturday, January 27, 2018 7:51 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

I think we have two use cases for the profiles:

Quoted 424 lines

1. automatic profile switching for different driver use cases 2. manually tweaking profiles/clocks/power for testing

How about we make the profile selection dependent on selecting the manual force_performance_level and not add an auto to the profile selector. Then when you select manual you can tweak the clocks and profile heuristics and power containment via their respective knobs.

Alex

Quoted 416 lines · Rex
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 2 lines

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 314 lines

Best Regards
Rex

---------------------------------------------------------------------
---
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools 2. You're taking the
clock limits out of the power profile.
Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 8 lines · Rex

Hi Felix,

Quoted 4 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 46 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through
power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once
this sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal
to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

-------------------------------------------------------------------
-----
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines
Quoted 11 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 10 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

Quoted 14 lines

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

---------------------------------------------------------------------
---

Quoted 25 lines
Quoted 25 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 3 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools, when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 154

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 126 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 85 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled) diff --git
Quoted 1 line

a/drivers/gpu/drm/amd/include/kgd_pp_interface.h

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)  {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 17 lines
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled) diff --git

a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 5 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int

vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 28 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 23 lines
Quoted 22 lines
Quoted 7 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int

vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines

{
struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_Njpv+OnXRD0bo4ZefjxR8LLnfsyTCoTmdmYzgYAuBXOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#25 lore raw
Quoted 7 lines

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Hi Alex,

so you mean use "auto" state of force_performance_leve as reset mode to all the performance related sysfs.

Currently we just unfore the clock range in the auto state.

Anyway, I will drop this patch.

Best Regards

Rex

________________________________
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 30, 2018 2:02 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 13 lines · Rex

Hi Alex,

Quoted 1 line

How about we make the profile selection dependent on selecting the manual force_performance_level

If so, we need to check pm.dpm.forced_level before "profile heuristics" and "disable power containment" as same as pp_dpm_sclk/mclk/pcie.

if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |

                               AMD_DPM_FORCED_LEVEL_LOW |
                               AMD_DPM_FORCED_LEVEL_HIGH))
               return -EINVAL;

How about delete judging code before force_clock_level and just change force_level to manual after force_clock_level. Please see the attached patch.

Quoted 7 lines

This change have no impact on existing interface and tools.
It just refine the logic of power_dpm_force_performance_level and pp_dpm_sclk/mclk/pcie. Also has no impact to power/computer profile mode on smu7.

The difference is:

New user can have one less command need to input if they want to use pp_dpm_sclk/mclk/pcie.

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Alex

Quoted 13 lines

Best Regards
Rex
-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Saturday, January 27, 2018 7:51 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

I think we have two use cases for the profiles:

Quoted 424 lines

1. automatic profile switching for different driver use cases 2. manually tweaking profiles/clocks/power for testing

How about we make the profile selection dependent on selecting the manual force_performance_level and not add an auto to the profile selector. Then when you select manual you can tweak the clocks and profile heuristics and power containment via their respective knobs.

Alex

Quoted 416 lines · Rex
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 2 lines

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 314 lines

Best Regards
Rex

---------------------------------------------------------------------
---
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools 2. You're taking the
clock limits out of the power profile.
Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 8 lines · Rex

Hi Felix,

Quoted 4 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 46 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through
power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once
this sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal
to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

-------------------------------------------------------------------
-----
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines
Quoted 11 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 10 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

Quoted 14 lines

dpm clk.

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

---------------------------------------------------------------------
---

Quoted 25 lines
Quoted 25 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 3 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools, when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 154

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
-                     (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 155

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 126 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 85 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled) diff --git
Quoted 1 line

a/drivers/gpu/drm/amd/include/kgd_pp_interface.h

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)  {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 11 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK, 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 17 lines
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled) diff --git

a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 5 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int

vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 28 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 23 lines
Quoted 22 lines
Quoted 7 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int

vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines

{
struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB16876451346CA39EE72B4844FBE50-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#27 lore raw
Quoted 9 lines · Rex
Quoted 7 lines

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Quoted 5 lines

Hi Alex,

so you mean use "auto" state of force_performance_leve as reset mode to all the performance related sysfs.

My thinking was that with force_performance_level set to auto, the driver will handle everything by itself. The driver would pick the power profile dynamically, all of the dpm states relevant to the power profiles would be enabled, etc. If the user selects manual in force_performance_level, then they can select which sclk/mclk/pcie dpm states are active as before, and now with the profile stuff, they can select either a predefined profile (video, vr, 3d, etc.) or a custom one. If they want to go back to automatic driver control, they just switch force_performance_level back to auto. That way we have just one interface to control the behavior and there are fewer corner cases where features interact. Either select auto and let the driver handle it all, or select manual and tweak everything manually.

Alex

Quoted 59 lines

Currently we just unfore the clock range in the auto state.

Anyway, I will drop this patch.

Best Regards

Rex

________________________________
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 30, 2018 2:02 AM

To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 22 lines · Rex

Hi Alex,

Quoted 2 lines

How about we make the profile selection dependent on selecting the manual force_performance_level

If so, we need to check pm.dpm.forced_level before "profile heuristics" and "disable power containment" as same as pp_dpm_sclk/mclk/pcie.

if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |

                               AMD_DPM_FORCED_LEVEL_LOW |
                               AMD_DPM_FORCED_LEVEL_HIGH))
               return -EINVAL;

How about delete judging code before force_clock_level and just change force_level to manual after force_clock_level. Please see the attached patch.

This change have no impact on existing interface and tools. It just refine the logic of power_dpm_force_performance_level and pp_dpm_sclk/mclk/pcie.
Also has no impact to power/computer profile mode on smu7.

Quoted 4 lines

The difference is:

New user can have one less command need to input if they want to use pp_dpm_sclk/mclk/pcie.

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Quoted 450 lines

Alex

Quoted 448 lines

Best Regards
Rex
-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Saturday, January 27, 2018 7:51 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

I think we have two use cases for the profiles:

1. automatic profile switching for different driver use cases 2. manually tweaking profiles/clocks/power for testing

How about we make the profile selection dependent on selecting the manual force_performance_level and not add an auto to the profile selector. Then when you select manual you can tweak the clocks and profile heuristics and power containment via their respective knobs.

Alex

Quoted 422 lines · Rex
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 2 lines

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 320 lines

Best Regards
Rex

---------------------------------------------------------------------
---
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools 2. You're taking the
clock limits out of the power profile.
Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 8 lines · Rex

Hi Felix,

Quoted 4 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 46 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through
power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once
this sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal
to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

-------------------------------------------------------------------
-----
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 13 lines
Quoted 12 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 12 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

dpm clk.

Quoted 13 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

---------------------------------------------------------------------
---

Quoted 25 lines
Quoted 25 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 3 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools, when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low"

:

                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

- (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

Quoted 1 line
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

Quoted 1 line
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 129 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 86 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device
 *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled) diff --git
Quoted 1 line

a/drivers/gpu/drm/amd/include/kgd_pp_interface.h

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)  {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 13 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK,
 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE,
 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 17 lines
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled) diff --git

a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 5 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int

vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 28 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 23 lines
Quoted 22 lines
Quoted 7 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int

vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines

{
struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_O-43_fW4_4D=ztPDhww44fADHFLyHkNCT+WRLv3usQxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#29 lore raw

Hi Alex,

It's Ok, I got it.

Thanks.

Best Regards
Rex

________________________________
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 30, 2018 6:26 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 9 lines · Rex
Quoted 7 lines

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Quoted 5 lines

Hi Alex,

so you mean use "auto" state of force_performance_leve as reset mode to all the performance related sysfs.

My thinking was that with force_performance_level set to auto, the driver will handle everything by itself. The driver would pick the power profile dynamically, all of the dpm states relevant to the power profiles would be enabled, etc. If the user selects manual in force_performance_level, then they can select which sclk/mclk/pcie dpm states are active as before, and now with the profile stuff, they can select either a predefined profile (video, vr, 3d, etc.) or a custom one. If they want to go back to automatic driver control, they just switch force_performance_level back to auto. That way we have just one interface to control the behavior and there are fewer corner cases where features interact. Either select auto and let the driver handle it all, or select manual and tweak everything manually.

Alex

Quoted 59 lines

Currently we just unfore the clock range in the auto state.

Anyway, I will drop this patch.

Best Regards

Rex

________________________________
From: Alex Deucher <[email protected]>
Sent: Tuesday, January 30, 2018 2:02 AM

To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 22 lines · Rex

Hi Alex,

Quoted 2 lines

How about we make the profile selection dependent on selecting the manual force_performance_level

If so, we need to check pm.dpm.forced_level before "profile heuristics" and "disable power containment" as same as pp_dpm_sclk/mclk/pcie.

if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |

                               AMD_DPM_FORCED_LEVEL_LOW |
                               AMD_DPM_FORCED_LEVEL_HIGH))
               return -EINVAL;

How about delete judging code before force_clock_level and just change force_level to manual after force_clock_level. Please see the attached patch.

This change have no impact on existing interface and tools. It just refine the logic of power_dpm_force_performance_level and pp_dpm_sclk/mclk/pcie.
Also has no impact to power/computer profile mode on smu7.

Quoted 4 lines

The difference is:

New user can have one less command need to input if they want to use pp_dpm_sclk/mclk/pcie.

I'd prefer to keep the requirement to select manual mode to be able to manually mess with the clock levels. This also makes simplifies the profile interface by only allowing you to change the profile if you select manual mode first. That way we don't have to add an AUTO profile to the profile selection to let the driver pick the profile. that can happen automatically if the user sets the force_performance level to auto.

Quoted 450 lines

Alex

Quoted 448 lines

Best Regards
Rex
-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Saturday, January 27, 2018 7:51 AM
To: Zhu, Rex
Cc: Kuehling, Felix; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

I think we have two use cases for the profiles:

1. automatic profile switching for different driver use cases 2. manually tweaking profiles/clocks/power for testing

How about we make the profile selection dependent on selecting the manual force_performance_level and not add an auto to the profile selector. Then when you select manual you can tweak the clocks and profile heuristics and power containment via their respective knobs.

Alex

Quoted 422 lines · Rex
Quoted 3 lines

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

I have sent the patch v2 to fix this problem. user can swith back auto mode and all manual clock setting will be removed.

Quoted 2 lines

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

this is an old logic, maybe ref radeon driver.
Driver can allow to set pp_dpm_sclk/mclk range in auto/high/low mode.

Best Regards
Rex
________________________________
From: Kuehling, Felix
Sent: Saturday, January 27, 2018 3:32 AM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 12 lines · Rex
Quoted 3 lines

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools

Rex: I don't think the patch will affects existing tools.

User set "manual" to power_performance_level, and then change the clock range through pp_dpm_sclk/mclk/pcie.

Quoted 6 lines

with this patch, User dont need to set "manual" command, if still receive the manual command, driver just return sucess to user in order not break existing

tools.

Existing tools and users expect that switching back to auto removes the manual clock settings. If you allow changing the clock in auto mode, that won't happen any more.

Quoted 6 lines
Quoted 4 lines

2. You're taking the clock limits out of the power profile. Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Quoted 6 lines

Rex: In vega10, under default comput mode(with busy_set_point/fps/use_rlc_busy/min_active_level set), just two performance levels left
(level0 and level7). and clock just switch between lowest and highest.

I am not sure in this case, driver still can set min sclk/mclk.

One more reason why allowing the user to set pp_dpm_sckl/mclk shouldn't be allowed in auto-mode.

Regards,
Felix

Quoted 320 lines

Best Regards
Rex

---------------------------------------------------------------------
---
*From:* Kuehling, Felix
*Sent:* Saturday, January 27, 2018 12:49 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Hi Rex,

I think I understand what you're trying to do. To summarize my concerns, there are two reasons I'm against your plan:

1. You're breaking the semantics of the existing pp_dpm_sclk/mclk/pcie interfaces, which affects existing tools 2. You're taking the
clock limits out of the power profile.
Automatically adjusting the minimum sclk/mclk is a requirement for the compute power profile

Regards,
Felix

Quoted 8 lines · Rex

Hi Felix,

Quoted 4 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these

files.

Quoted 46 lines

Rex:

I am not very clear the old logic of gfx/compute power profile switch.

But with new sysfs,

The logic is(those sysfs are independent)

1. configure uphyst/downhyst/min_ativity through
power_profile_mode,

2. adjust clock range through pp_dpm_sclk/mclk/pcie.(once
this sysffs was called, set the dpm level mode to unknown)

3. adjust power limit through pp_od_power_limit(maybe equal
to disable power containment).

In those functions, driver do not check the dpm level mode.

the dpm level mode just used by power_dpm_force_performance_level functions.

Best Regards

Rex

-------------------------------------------------------------------
-----
*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 8:26 AM
*To:* Zhu, Rex; [email protected] *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

Quoted 13 lines
Quoted 12 lines · Rex

I also think about this problem.
just think user should unforced clk level through pp dpm sclk/mclk/pcie if they change the clock logic through those sysfs.

The logic seems weird, As we supply many sysfs for adjust clock range.

We can fix this problem by change current mode to manual mode after user call pp dpm sclk/mclk/pcie.

But another think,if user change back the clk range through pp dpm

clk.

Quoted 12 lines
Quoted 3 lines

we are in manual mode, and user set auto mode, in fact, driver change nothing.

With profiles, switching back to auto mode would select the appropriate profile, which may have a different clock mask. For example for compute we enable only the highest two sclk levels.

Quoted 2 lines

Comparatively speaking, better set manual mode after user call pp

dpm clk.

Quoted 13 lines

That would make sense. But switching to manual mode would disable profiles and automatic profile selection. That was one reason why I objected to your plan to control profile clock limits using these files.

Regards,
Felix

Quoted 5 lines

Thanks very much.

Best Regards
Rex

---------------------------------------------------------------------
---

Quoted 25 lines
Quoted 25 lines

*From:* Kuehling, Felix
*Sent:* Friday, January 26, 2018 12:55:19 AM
*To:* [email protected]; Zhu, Rex *Subject:* Re: [PATCH 1/2] drm/amd/pp: Remove manual mode for power_dpm_force_performance_level

This patch breaks unforcing of clocks, which is currently done by switching back from "manual" to "auto". By removing "manual" mode, you remove the ability to unset forced clocks.

Regards,
Felix

Quoted 3 lines · Rex Zhu

Driver do not maintain manual mode for dpm_force_performance_level, User can set sclk/mclk/pcie range through

pp_dpm_sclk/pp_dpm_mclk/pp_dpm_pcie

Quoted 6 lines

directly.

In order to not break currently tools, when set "manual" to power_dpm_force_performance_level driver will do nothing and just return successful.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Change-Id Iaf672b9abc7fa57b765ceb7fa2fba6ad3e80c50b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  3 +--
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                |  5 -----
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 15

+++++++--------

Quoted 14 lines

Review

Quoted 7 lines
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     |  4 ----
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c     |  1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  6 ------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  6 ------
 7 files changed, 8 insertions(+), 32 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 4 lines

index 1812009..66b4df0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -152,7 +152,6 @@ static ssize_t

amdgpu_get_dpm_forced_performance_level(struct device *dev,

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_AUTO) ?

"auto" :

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
                       (level == AMD_DPM_FORCED_LEVEL_LOW) ? "low"

:

                       (level == AMD_DPM_FORCED_LEVEL_HIGH) ?

"high" :

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

- (level == AMD_DPM_FORCED_LEVEL_MANUAL) ?

"manual" :

Quoted 1 line
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD) ? "profile_standard" :

Quoted 1 line
                       (level ==

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK) ? "profile_min_sclk" :

Quoted 1 line
                       (level ==
Quoted 8 lines
Quoted 8 lines

AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) ? "profile_min_mclk" :

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
@@ -186,7 +185,7 @@ static ssize_t

amdgpu_set_dpm_forced_performance_level(struct device *dev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
       } else if (strncmp("auto", buf, strlen("auto")) == 0) {
               level = AMD_DPM_FORCED_LEVEL_AUTO;
       } else if (strncmp("manual", buf, strlen("manual")) == 0) {
-             level = AMD_DPM_FORCED_LEVEL_MANUAL;
+             pr_info("No need to set manual mode, Just go

ahead\n");

Quoted 129 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 189

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
       } else if (strncmp("profile_exit", buf,

strlen("profile_exit")) == 0) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c static ssize_t · line 191

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -0
               level = AMD_DPM_FORCED_LEVEL_PROFILE_EXIT;
       } else if (strncmp("profile_standard", buf,

strlen("profile_standard")) == 0) {

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_force_clock_level(void

Quoted 4 lines

index ab45232..8ddc978 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
@@ -6639,11 +6639,6 @@ static int ci_dpm_force_clock_level(void

*handle,

Quoted 86 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -5
       struct amdgpu_device *adev = (struct amdgpu_device
 *)handle;
       struct ci_power_info *pi = ci_get_pi(adev);
 
-     if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!pi->sclk_dpm_key_disabled) diff --git
Quoted 1 line

a/drivers/gpu/drm/amd/include/kgd_pp_interface.h

b/drivers/gpu/drm/amd/include/kgd_pp_interface.h

Review

Quoted 26 lines

index b9aa9f4..3fab686 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h +7 -8
@@ -41,14 +41,13 @@ struct amd_vce_state {
 
 enum amd_dpm_forced_level {
       AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
-     AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
-     AMD_DPM_FORCED_LEVEL_LOW = 0x4,
-     AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
-     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
-     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
-     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
-     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
+     AMD_DPM_FORCED_LEVEL_LOW = 0x2,
+     AMD_DPM_FORCED_LEVEL_HIGH = 0x4,
+     AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x8,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x10,
+     AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x20,
+     AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x40,
+     AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x80,
 };
 
 enum amd_pm_state_type {
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_dpm_force_dpm_level(struct

Quoted 4 lines

index dec8dd9..60d280c 100644

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -0
@@ -1250,7 +1250,6 @@ static int cz_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c static int cz_get_dal_power_level(struct

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -1
       case AMD_DPM_FORCED_LEVEL_AUTO:
               ret = cz_phm_unforce_dpm_levels(hwmgr);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -1558,9 +1557,6 @@ static int cz_get_dal_power_level(struct

pp_hwmgr *hwmgr,

Review

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
               enum pp_clock_type type, uint32_t mask)  {
-     if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               smum_send_msg_to_smc_with_parameter(hwmgr,
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c static int rv_dpm_force_dpm_level(struct

Quoted 4 lines

index 409a56b..eddcbcd 100644

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -0
@@ -605,7 +605,6 @@ static int rv_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 1 line

PPSMC_MSG_SetSoftMaxFclkByFreq,

Quoted 1 line

RAVEN_UMD_PSTATE_MIN_FCLK);

Review

Quoted 6 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_dpm_level(struct

Quoted 4 lines

index 13db75c..e3a8374 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -2798,7 +2798,6 @@ static int smu7_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 13 lines

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_force_clock_level(struct

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
               smu7_force_clock_level(hwmgr, PP_MCLK,
 1<<mclk_mask);
               smu7_force_clock_level(hwmgr, PP_PCIE,
 1<<pcie_mask);
               break;
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
@@ -4311,11 +4310,6 @@ static int smu7_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
 {
       struct smu7_hwmgr *data = (struct smu7_hwmgr

*)(hwmgr->backend);

Quoted 17 lines
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                                     AMD_DPM_FORCED_LEVEL_LOW |
-                                     AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               if (!data->sclk_dpm_key_disabled) diff --git

a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 5 lines

index 6b28896..828677e 100644

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
@@ -4241,7 +4241,6 @@ static int

vega10_dpm_force_dpm_level(struct

pp_hwmgr *hwmgr,

Quoted 28 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_SCLK,

1<<sclk_mask);

Quoted 1 line
Quoted 1 line
Quoted 1 line

vega10_force_clock_level(hwmgr, PP_MCLK,

1<<mclk_mask);

Quoted 23 lines
Quoted 22 lines
Quoted 7 lines
               break;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -1
-     case AMD_DPM_FORCED_LEVEL_MANUAL:
       case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
       default:
               break;
@@ -4500,11 +4499,6 @@ static int

vega10_force_clock_level(struct

pp_hwmgr *hwmgr,

Quoted 2 lines

{
struct vega10_hwmgr *data = (struct vega10_hwmgr

*)(hwmgr->backend);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
-     if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-                             AMD_DPM_FORCED_LEVEL_LOW |
-                             AMD_DPM_FORCED_LEVEL_HIGH))
-             return -EINVAL;
-
       switch (type) {
       case PP_SCLK:
               data->smc_state_table.gfx_boot_level = mask ?

(ffs(mask) - 1) : 0;

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx