Skip to contentSkip to conversation

drm/amd/pm: update deep sleep status on smu v14.0.2/3

PATCH Superseded Kenneth Feng 3 participants 4 messages Oct 16, 2024 – Oct 17, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kenneth Feng

author maintainer
#0 lore raw

PATCH 1/1 drm/amd/pm: update deep sleep status on smu v14.0.2/3

disable deep sleep during the compute workload for the potential performance loss on smu v14.0.2/3

---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +6 -1
index 27f4e0ce447d..ecdd11a87311 100644
@@ -1784,7 +1784,7 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
 	DpmActivityMonitorCoeffInt_t *activity_monitor =
 		&(activity_monitor_external.DpmActivityMonitorCoeffInt);
 	int workload_type, ret = 0;
-
+	uint32_t temp_profile_mode = smu->power_profile_mode;
 	smu->power_profile_mode = input[size];
 
 	if (smu->power_profile_mode >= PP_SMC_POWER_PROFILE_COUNT) {
@@ -1842,6 +1842,11 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
 		}
 	}
 
+	if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+		smu_v14_0_deep_sleep_control(smu, false);
+	else if (temp_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+		smu_v14_0_deep_sleep_control(smu, true);
+
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type = smu_cmn_to_asic_specific_index(smu,
 						       CMN2ASIC_MAPPING_WORKLOAD,
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Kenneth Feng <[email protected]>
Sent: Wednesday, October 16, 2024 3:19 PM
To: [email protected]
Cc: Wang, Yang(Kevin) <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: update deep sleep status on smu v14.0.2/3

disable deep sleep during the compute workload for the potential performance loss on smu v14.0.2/3

---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +1 -1
index 27f4e0ce447d..ecdd11a87311 100644
@@ -1784,7 +1784,7 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
        DpmActivityMonitorCoeffInt_t *activity_monitor =
                &(activity_monitor_external.DpmActivityMonitorCoeffInt);
        int workload_type, ret = 0;
-
+       uint32_t temp_profile_mode = smu->power_profile_mode;
        smu->power_profile_mode = input[size];
 
        if (smu->power_profile_mode >= PP_SMC_POWER_PROFILE_COUNT) { @@ -1842,6 +1842,11 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
                }
        }

+ if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+ smu_v14_0_deep_sleep_control(smu, false);
+ else if (temp_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+ smu_v14_0_deep_sleep_control(smu, true);
[Kevin]:

This code logic doesn't seem easy to understand, If I understand correctly, can I modify it to the following writing style:

If (new profile != current profile) {

            smu_v14_0_deep_sleep_control(smu, new profile == compute profile ? false : true);
            smu->power_profile_mode = new profile.
}


Best Regards,
Kevin
/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ workload_type = smu_cmn_to_asic_specific_index(smu,
CMN2ASIC_MAPPING_WORKLOAD,
--
2.34.1

author maintainer
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

The logic is that when entering the compute workload, enable deep sleep. When exiting the compute workload, disable deep sleep.
It's not required to do the deep sleep setting in other workload type. Thanks.

-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, October 16, 2024 8:38 PM
To: Feng, Kenneth <[email protected]>; [email protected]
Cc: Feng, Kenneth <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: update deep sleep status on smu v14.0.2/3

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Kenneth Feng <[email protected]>
Sent: Wednesday, October 16, 2024 3:19 PM
To: [email protected]
Cc: Wang, Yang(Kevin) <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: update deep sleep status on smu v14.0.2/3

disable deep sleep during the compute workload for the potential performance loss on smu v14.0.2/3

---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +1 -1
index 27f4e0ce447d..ecdd11a87311 100644
@@ -1784,7 +1784,7 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
        DpmActivityMonitorCoeffInt_t *activity_monitor =
                &(activity_monitor_external.DpmActivityMonitorCoeffInt);
        int workload_type, ret = 0;
-
+       uint32_t temp_profile_mode = smu->power_profile_mode;
        smu->power_profile_mode = input[size];
 
        if (smu->power_profile_mode >= PP_SMC_POWER_PROFILE_COUNT) { @@ -1842,6 +1842,11 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
                }
        }

+ if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+ smu_v14_0_deep_sleep_control(smu, false);
+ else if (temp_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+ smu_v14_0_deep_sleep_control(smu, true);
[Kevin]:

This code logic doesn't seem easy to understand, If I understand correctly, can I modify it to the following writing style:

If (new profile != current profile) {

            smu_v14_0_deep_sleep_control(smu, new profile == compute profile ? false : true);
            smu->power_profile_mode = new profile.
}


Best Regards,
Kevin
/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ workload_type = smu_cmn_to_asic_specific_index(smu,
CMN2ASIC_MAPPING_WORKLOAD,
--
2.34.1

Reviewed-by
#3 lore raw
Quoted 9 lines · Kenneth

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

The logic is that when entering the compute workload, enable deep sleep. When exiting the compute workload, disable deep sleep.
It's not required to do the deep sleep setting in other workload type. Thanks.

This patch looks good. Please name temp_profile_mode as current_profile for clarity and may be comment about smu->power_profile_mode as the new/target mode.

With those -

Thanks,
Lijo

Quoted 62 lines

-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, October 16, 2024 8:38 PM
To: Feng, Kenneth <[email protected]>; [email protected]
Cc: Feng, Kenneth <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: update deep sleep status on smu v14.0.2/3

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Kenneth Feng <[email protected]>
Sent: Wednesday, October 16, 2024 3:19 PM
To: [email protected]
Cc: Wang, Yang(Kevin) <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: update deep sleep status on smu v14.0.2/3

disable deep sleep during the compute workload for the potential performance loss on smu v14.0.2/3

---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +1 -1
index 27f4e0ce447d..ecdd11a87311 100644
@@ -1784,7 +1784,7 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
        DpmActivityMonitorCoeffInt_t *activity_monitor =
                &(activity_monitor_external.DpmActivityMonitorCoeffInt);
        int workload_type, ret = 0;
-
+       uint32_t temp_profile_mode = smu->power_profile_mode;
        smu->power_profile_mode = input[size];
 
        if (smu->power_profile_mode >= PP_SMC_POWER_PROFILE_COUNT) { @@ -1842,6 +1842,11 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
                }
        }
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +4 -0
+       if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+               smu_v14_0_deep_sleep_control(smu, false);
+       else if (temp_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+               smu_v14_0_deep_sleep_control(smu, true);

[Kevin]:

This code logic doesn't seem easy to understand, If I understand correctly, can I modify it to the following writing style:

If (new profile != current profile) {

            smu_v14_0_deep_sleep_control(smu, new profile == compute profile ? false : true);
            smu->power_profile_mode = new profile.
}


Best Regards,
Kevin
/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ workload_type = smu_cmn_to_asic_specific_index(smu,
CMN2ASIC_MAPPING_WORKLOAD,
--
2.34.1