0 MHz is not a valid current frequency
Subsystems (3)
cover 0 MHz is not a valid current frequency
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_
Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Rename cur_value to curr_value drm/amd/pm: Rename freq_values --> freq_value dpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency
.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Signature · 1 line
2.33.1.558.g2bd2f258f4
PATCH 1/5 drm/amd/pm: Slight function rename
Renamesienna_cichlid_is_support_fine_grained_dpm() tosienna_cichlid_support_fine_grained_dpm().
Renamenavi10_is_support_fine_grained_dpm() tonavi10_supports_fine_grained_dpm().
--- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 7 ++++--- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +4 -3
@@ -1231,7 +1231,8 @@ static int navi10_get_current_clk_freq_by_table(struct smu_context *smu, value); } -static bool navi10_is_support_fine_grained_dpm (struct smu_context *smu,enum smu_clk_type clk_type) +static bool navi10_supports_fine_grained_dpm (struct smu_context *smu, +enum smu_clk_type clk_type) {PPTable_t *pptable = smu->smu_table.driver_pptable;DpmDescriptor_t *dpm_desc =NULL ;
@@ -1299,7 +1300,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (ret)return size; -if (!navi10_is_support_fine_grained_dpm (smu, clk_type)) { +if (!navi10_supports_fine_grained_dpm (smu, clk_type)) {for (i =0 ; i < count; i++) { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, i, &value);if (ret)
@@ -1465,7 +1466,7 @@ static int navi10_force_clk_levels(struct smu_context *smu,case SMU_UCLK :case SMU_FCLK :/* There is only 2 levels for fine grained DPM */ -if (navi10_is_support_fine_grained_dpm (smu, clk_type)) { +if (navi10_supports_fine_grained_dpm (smu, clk_type)) { soft_max_level = (soft_max_level >=1 ?1 :0 ); soft_min_level = (soft_min_level >=1 ?1 :0 ); }
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +4 -3
@@ -1006,7 +1006,8 @@ static int sienna_cichlid_get_current_clk_freq_by_table(struct smu_context *smu, } -static bool sienna_cichlid_is_support_fine_grained_dpm (struct smu_context *smu,enum smu_clk_type clk_type) +static bool sienna_cichlid_supports_fine_grained_dpm (struct smu_context *smu, +enum smu_clk_type clk_type) {DpmDescriptor_t *dpm_desc =NULL ;DpmDescriptor_t *table_member;
@@ -1084,7 +1085,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,if (ret) goto print_clk_out; -if (!sienna_cichlid_is_support_fine_grained_dpm (smu, clk_type)) { +if (!sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) {for (i =0 ; i < count; i++) { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, i, &value);if (ret)
@@ -1235,7 +1236,7 @@ static int sienna_cichlid_force_clk_levels(struct smu_context *smu,case SMU_UCLK :case SMU_FCLK :/* There is only 2 levels for fine grained DPM */ -if (sienna_cichlid_is_support_fine_grained_dpm (smu, clk_type)) { +if (sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) { soft_max_level = (soft_max_level >=1 ?1 :0 ); soft_min_level = (soft_min_level >=1 ?1 :0 ); }
Signature · 1 line
2.33.1.558.g2bd2f258f4
RE: [PATCH 1/5] drm/amd/pm: Slight function rename
[AMD Official Use Only]
Pedantic tiny thing:
Quoted 11 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Luben Tuikov
Sent: Tuesday, October 12, 2021 11:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Tuikov, Luben <[email protected]>
Subject: [PATCH 1/5] drm/amd/pm: Slight function renameRename
sienna_cichlid_is_support_fine_grained_dpm()tosienna_cichlid_support_fine_grained_dpm().
^You would want cichlid_supports_fine_grained_dpm . The function is correct below, but anyone grepping git logs would miss it.
Kent
Quoted 87 lines
Rename
navi10_is_support_fine_grained_dpm()tonavi10_supports_fine_grained_dpm().Signed-off-by Luben Tuikov <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 7 ++++--- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +2
-1@@ -1231,7 +1231,8 @@ static int navi10_get_current_clk_freq_by_table(structsmu_context *smu, value); } -static bool navi10_is_support_fine_grained_dpm (struct smu_context *smu,enum smu_clk_type clk_type) +static bool navi10_supports_fine_grained_dpm (struct smu_context *smu, +enum smu_clk_type clk_type) {drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1
-1PPTable_t *pptable = smu->smu_table.driver_pptable;DpmDescriptor_t *dpm_desc =NULL ;@@ -1299,7 +1300,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (ret)return size; -if (!navi10_is_support_fine_grained_dpm (smu, clk_type)) { +if (!navi10_supports_fine_grained_dpm (smu, clk_type)) {for (i =0 ; i < count; i++) { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, i, &value);drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1
-1if (ret)@@ -1465,7 +1466,7 @@ static int navi10_force_clk_levels(struct smu_context *smu,case SMU_UCLK :case SMU_FCLK :/* There is only 2 levels for fine grained DPM */ -if (navi10_is_support_fine_grained_dpm (smu, clk_type)) { +if (navi10_supports_fine_grained_dpm (smu, clk_type)) { soft_max_level = (soft_max_level >=1 ?1 :0 ); soft_min_level = (soft_min_level >=1 ?1 :0 ); }drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +2
-1@@ -1006,7 +1006,8 @@ static int sienna_cichlid_get_current_clk_freq_by_table(struct smu_context *smu, } -static bool sienna_cichlid_is_support_fine_grained_dpm (struct smu_context *smu,enum smu_clk_type clk_type) +static bool sienna_cichlid_supports_fine_grained_dpm (struct smu_context *smu, +enum smu_clk_type clk_type) {drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1
-1DpmDescriptor_t *dpm_desc =NULL ;DpmDescriptor_t *table_member;@@ -1084,7 +1085,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, if (ret) goto print_clk_out; -if (!sienna_cichlid_is_support_fine_grained_dpm (smu, clk_type)) { +if (!sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) {for (i =0 ; i < count; i++) { ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, i,&value);
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1
-1if (ret)@@ -1235,7 +1236,7 @@ static int sienna_cichlid_force_clk_levels(struct smu_context *smu, case SMU_UCLK:case SMU_FCLK :/* There is only 2 levels for fine grained DPM */ -if (sienna_cichlid_is_support_fine_grained_dpm (smu, clk_type)) { +if (sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) { soft_max_level = (soft_max_level >=1 ?1 :0 ); soft_min_level = (soft_min_level >=1 ?1 :0 );}
--
2.33.1.558.g2bd2f258f4
Re: [PATCH 1/5] drm/amd/pm: Slight function rename
Quoted 12 lines · Kent
[AMD Official Use Only]
Pedantic tiny thing:
Quoted 8 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Luben Tuikov
Sent: Tuesday, October 12, 2021 11:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Tuikov, Luben <[email protected]>
Subject: [PATCH 1/5] drm/amd/pm: Slight function rename
Quoted 4 lines
Quoted 3 lines
Rename
sienna_cichlid_is_support_fine_grained_dpm()tosienna_cichlid_support_fine_grained_dpm().^You would want
cichlid_supports_fine_grained_dpm. The function is correct below, but anyone grepping git logs would miss it.
Ah, yes, thank you Kent--I'll fix the description to add the missing 's'.
Regards,
Luben
Quoted 89 lines
Kent
Quoted 86 lines
Rename
navi10_is_support_fine_grained_dpm()tonavi10_supports_fine_grained_dpm().Signed-off-by Luben Tuikov <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 7 ++++--- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +2
-1@@ -1231,7 +1231,8 @@ static int navi10_get_current_clk_freq_by_table(structsmu_context *smu, value); } -static bool navi10_is_support_fine_grained_dpm (struct smu_context *smu,enum smu_clk_type clk_type) +static bool navi10_supports_fine_grained_dpm (struct smu_context *smu, +enum smu_clk_type clk_type) {drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1
-1PPTable_t *pptable = smu->smu_table.driver_pptable;DpmDescriptor_t *dpm_desc =NULL ;@@ -1299,7 +1300,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (ret)return size; -if (!navi10_is_support_fine_grained_dpm (smu, clk_type)) { +if (!navi10_supports_fine_grained_dpm (smu, clk_type)) {for (i =0 ; i < count; i++) { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, i, &value);drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1
-1if (ret)@@ -1465,7 +1466,7 @@ static int navi10_force_clk_levels(struct smu_context *smu,case SMU_UCLK :case SMU_FCLK :/* There is only 2 levels for fine grained DPM */ -if (navi10_is_support_fine_grained_dpm (smu, clk_type)) { +if (navi10_supports_fine_grained_dpm (smu, clk_type)) { soft_max_level = (soft_max_level >=1 ?1 :0 ); soft_min_level = (soft_min_level >=1 ?1 :0 ); }drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +2
-1@@ -1006,7 +1006,8 @@ static int sienna_cichlid_get_current_clk_freq_by_table(struct smu_context *smu, } -static bool sienna_cichlid_is_support_fine_grained_dpm (struct smu_context *smu,enum smu_clk_type clk_type) +static bool sienna_cichlid_supports_fine_grained_dpm (struct smu_context *smu, +enum smu_clk_type clk_type) {drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1
-1DpmDescriptor_t *dpm_desc =NULL ;DpmDescriptor_t *table_member;@@ -1084,7 +1085,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, if (ret) goto print_clk_out; -if (!sienna_cichlid_is_support_fine_grained_dpm (smu, clk_type)) { +if (!sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) {for (i =0 ; i < count; i++) { ret = smu_v11_0_get_dpm_freq_by_index(smu, clk_type, i,&value);
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1
-1if (ret)@@ -1235,7 +1236,7 @@ static int sienna_cichlid_force_clk_levels(struct smu_context *smu, case SMU_UCLK:case SMU_FCLK :/* There is only 2 levels for fine grained DPM */ -if (sienna_cichlid_is_support_fine_grained_dpm (smu, clk_type)) { +if (sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) { soft_max_level = (soft_max_level >=1 ?1 :0 ); soft_min_level = (soft_min_level >=1 ?1 :0 );}
--
2.33.1.558.g2bd2f258f4
Re: [PATCH 1/5] drm/amd/pm: Slight function rename
In reply to Luben TuikovDear Luben,
Am 13.10.21 um 05:10 schrieb Luben Tuikov:
[…]
A small nit regarding the subject. It’d be great if you made it a statement by adding a verb (in imperative mood). git standard messages are doing the same with *Merge …* and *Revert …*.
Kind regards,
Paul
Re: [PATCH 1/5] drm/amd/pm: Slight function rename
Okay, no problem--I'll add a verb there and resend the patch set. Thanks for letting me know.
Regards,
Luben
Quoted 15 lines · Paul Menzel
Dear Luben,
Am 13.10.21 um 05:10 schrieb Luben Tuikov:
[…]
A small nit regarding the subject. It’d be great if you made it a statement by adding a verb (in imperative mood). git standard messages are doing the same with *Merge …* and *Revert …*.
Kind regards,
Paul
PATCH 2/5 drm/amd/pm: Rename cur_value to curr_value
In reply to Luben TuikovRename "cur_value", which stands for "cursor
value" to "curr_value", which stands for "current
value".
--- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 12 ++++++------ .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +6 -6
@@ -1267,7 +1267,7 @@ static int navi10_print_clk_levels(struct smu_context *smu, {uint16_t *curve_settings;int i, size =0 , ret =0 ; -uint32_t cur_value =0 , value =0 , count =0 ; +uint32_t curr_value =0 , value =0 , count =0 ;uint32_t freq_values[3 ] = {0 };uint32_t mark_index =0 ;struct smu_table_context *table_context = &smu->smu_table;
@@ -1292,7 +1292,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,case SMU_VCLK :case SMU_DCLK :case SMU_DCEFCLK : - ret =navi10_get_current_clk_freq_by_table (smu, clk_type, &cur_value); + ret =navi10_get_current_clk_freq_by_table (smu, clk_type, &curr_value);if (ret)return size;
@@ -1307,7 +1307,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,return size; size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, value, - cur_value == value ?"*" :"" ); + curr_value == value ?"*" :"" ); } }else { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_values[0 ]);
@@ -1317,9 +1317,9 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (ret)return size; - freq_values[1 ] = cur_value; - mark_index = cur_value == freq_values[0 ] ?0 : - cur_value == freq_values[2 ] ?2 :1 ; + freq_values[1 ] = curr_value; + mark_index = curr_value == freq_values[0 ] ?0 : + curr_value == freq_values[2 ] ?2 :1 ;if (mark_index !=1 ) freq_values[1 ] = (freq_values[0 ] + freq_values[2 ]) /2 ;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +8 -7
@@ -1052,7 +1052,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,OverDriveTable_t *od_table = (OverDriveTable_t *)table_context->overdrive_table;int i, size =0 , ret =0 ; -uint32_t cur_value =0 , value =0 , count =0 ; +uint32_t curr_value =0 , value =0 , count =0 ;uint32_t freq_values[3 ] = {0 };uint32_t mark_index =0 ;uint32_t gen_speed, lane_width;
@@ -1073,10 +1073,11 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,case SMU_DCLK :case SMU_DCLK1 :case SMU_DCEFCLK : - ret =sienna_cichlid_get_current_clk_freq_by_table (smu, clk_type, &cur_value); + ret =sienna_cichlid_get_current_clk_freq_by_table (smu, clk_type, &curr_value);if (ret) goto print_clk_out; +/* no need to disable gfxoff when retrieving the current gfxclk */ if ((clk_type ==SMU_GFXCLK ) || (clk_type ==SMU_SCLK ))amdgpu_gfx_off_ctrl (adev, false);
@@ -1092,7 +1093,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, goto print_clk_out; size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, value, - cur_value == value ?"*" :"" ); + curr_value == value ?"*" :"" ); } }else { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_values[0 ]);
@@ -1102,9 +1103,9 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,if (ret) goto print_clk_out; - freq_values[1 ] = cur_value; - mark_index = cur_value == freq_values[0 ] ?0 : - cur_value == freq_values[2 ] ?2 :1 ; + freq_values[1 ] = curr_value; + mark_index = curr_value == freq_values[0 ] ?0 : + curr_value == freq_values[2 ] ?2 :1 ; count =3 ;if (mark_index !=1 ) {
@@ -1114,7 +1115,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,for (i =0 ; i < count; i++) { size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_values[i], - cur_value == freq_values[i] ?"*" :"" ); + curr_value == freq_values[i] ?"*" :"" ); } }
Signature · 1 line
2.33.1.558.g2bd2f258f4
PATCH 3/5 drm/amd/pm: Rename freq_values --> freq_value
In reply to Luben TuikovBy usage: read freq_values[x] to freq_value[x].
--- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 16 ++++++++-------- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +8 -8
@@ -1268,7 +1268,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,uint16_t *curve_settings;int i, size =0 , ret =0 ;uint32_t curr_value =0 , value =0 , count =0 ; -uint32_t freq_values[3 ] = {0 }; +uint32_t freq_value[3 ] = {0 ,0 ,0 };uint32_t mark_index =0 ;struct smu_table_context *table_context = &smu->smu_table;uint32_t gen_speed, lane_width;
@@ -1310,21 +1310,21 @@ static int navi10_print_clk_levels(struct smu_context *smu, curr_value == value ? "*" : ""); } }else { - ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_values[0 ]); + ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_value[0 ]);if (ret)return size; - ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, count -1 , &freq_values[2 ]); + ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, count -1 , &freq_value[2 ]);if (ret)return size; - freq_values[1 ] = curr_value; - mark_index = curr_value == freq_values[0 ] ?0 : - curr_value == freq_values[2 ] ?2 :1 ; + freq_value[1 ] = curr_value; + mark_index = curr_value == freq_value[0 ] ?0 : + curr_value == freq_value[2 ] ?2 :1 ;if (mark_index !=1 ) - freq_values[1 ] = (freq_values[0 ] + freq_values[2 ]) /2 ; + freq_value[1 ] = (freq_value[0 ] + freq_value[2 ]) /2 ;for (i =0 ; i <3 ; i++) { - size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_values[i], + size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_value[i], i == mark_index ?"*" :"" ); }
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +9 -9
@@ -1053,7 +1053,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, (OverDriveTable_t *)table_context->overdrive_table;int i, size =0 , ret =0 ;uint32_t curr_value =0 , value =0 , count =0 ; -uint32_t freq_values[3 ] = {0 }; +uint32_t freq_value[3 ] = {0 ,0 ,0 };uint32_t mark_index =0 ;uint32_t gen_speed, lane_width;uint32_t min_value, max_value;
@@ -1096,26 +1096,26 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, curr_value == value ? "*" : ""); } }else { - ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_values[0 ]); + ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_value[0 ]);if (ret) goto print_clk_out; - ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, count -1 , &freq_values[2 ]); + ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, count -1 , &freq_value[2 ]);if (ret) goto print_clk_out; - freq_values[1 ] = curr_value; - mark_index = curr_value == freq_values[0 ] ?0 : - curr_value == freq_values[2 ] ?2 :1 ; + freq_value[1 ] = curr_value; + mark_index = curr_value == freq_value[0 ] ?0 : + curr_value == freq_value[2 ] ?2 :1 ; count =3 ;if (mark_index !=1 ) { count =2 ; - freq_values[1 ] = freq_values[2 ]; + freq_value[1 ] = freq_value[2 ]; }for (i =0 ; i < count; i++) { - size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_values[i], - curr_value == freq_values[i] ?"*" :"" ); + size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_value[i], + curr_value == freq_value[i] ?"*" :"" ); } }
Signature · 1 line
2.33.1.558.g2bd2f258f4
PATCH 4/5 dpm/amd/pm: Sienna: 0 MHz is not a current clock frequency
In reply to Luben TuikovA current value of a clock frequency of 0, means that the IP block is in some kind of low power state. Ignore it and don't report it here. Here we only report the possible operating (non-zero) frequencies of the block requested. So, if the current clock value is 0, then report as the current clock the minimum operating one, which is non-zero.
--- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 57 +++++++++++++------ 1 file changed, 39 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +39 -18
@@ -1054,10 +1054,10 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,int i, size =0 , ret =0 ;uint32_t curr_value =0 , value =0 , count =0 ;uint32_t freq_value[3 ] = {0 ,0 ,0 }; -uint32_t mark_index =0 ;uint32_t gen_speed, lane_width;uint32_t min_value, max_value;uint32_t smu_version; +bool fine_grained;smu_cmn_get_sysfs_buf (&buf, &size);
@@ -1077,6 +1077,22 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,if (ret) goto print_clk_out; + ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , + &freq_value[0 ]); +if (ret) + goto print_clk_out; + +/* A current value of a clock frequency of 0, means +* that the IP block is in some kind of low power +* state. Ignore it and don't report it here. Here we +* only report the possible operating (non-zero) +* frequencies of the block requested. So, if the +* current clock value is 0, then report as the +* current clock the minimum operating one, which is +* non-zero. +*/ +if (curr_value ==0 ) + curr_value = freq_value[0 ];/* no need to disable gfxoff when retrieving the current gfxclk */ if ((clk_type ==SMU_GFXCLK ) || (clk_type ==SMU_SCLK ))
@@ -1086,38 +1102,43 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu,if (ret) goto print_clk_out; -if (!sienna_cichlid_supports_fine_grained_dpm (smu, clk_type)) { -for (i =0 ; i < count; i++) { + fine_grained =sienna_cichlid_supports_fine_grained_dpm (smu, clk_type); +if (!fine_grained) { +/* We already got the 0-th index--print it +* here and continue thereafter. +*/ + size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" ,0 , freq_value[0 ], + curr_value == freq_value[0 ] ?"*" :"" ); +for (i =1 ; i < count; i++) { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, i, &value);if (ret) goto print_clk_out; - size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, value, curr_value == value ?"*" :"" ); } }else { - ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_value[0 ]); -if (ret) - goto print_clk_out; + freq_value[1 ] = curr_value; ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, count -1 , &freq_value[2 ]);if (ret) goto print_clk_out; - freq_value[1 ] = curr_value; - mark_index = curr_value == freq_value[0 ] ?0 : - curr_value == freq_value[2 ] ?2 :1 ; - - count =3 ; -if (mark_index !=1 ) { +if (freq_value[1 ] == freq_value[0 ]) { + i =1 ; + count =3 ; + }else if (freq_value[1 ] == freq_value[2 ]) { + i =0 ; count =2 ; - freq_value[1 ] = freq_value[2 ]; + }else { + i =0 ; + count =3 ; } -for (i =0 ; i < count; i++) { - size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_value[i], - curr_value == freq_value[i] ?"*" :"" ); +for ( ; i < count; i++) { + size +=sysfs_emit_at (buf, size, +"%d: %uMhz %s\n" , + i, freq_value[i], + curr_value == freq_value[i] ?"*" :"" ); } - }break ;case SMU_PCIE :
Signature · 1 line
2.33.1.558.g2bd2f258f4
PATCH 5/5 dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency
In reply to Luben TuikovA current value of a clock frequency of 0, means that the IP block is in some kind of low power state. Ignore it and don't report it here. Here we only report the possible operating (non-zero) frequencies of the block requested. So, if the current clock value is 0, then report as the current clock the minimum operating one, which is non-zero.
--- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +30 -15
@@ -1269,7 +1269,6 @@ static int navi10_print_clk_levels(struct smu_context *smu,int i, size =0 , ret =0 ;uint32_t curr_value =0 , value =0 , count =0 ;uint32_t freq_value[3 ] = {0 ,0 ,0 }; -uint32_t mark_index =0 ;struct smu_table_context *table_context = &smu->smu_table;uint32_t gen_speed, lane_width;struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
@@ -1279,6 +1278,7 @@ static int navi10_print_clk_levels(struct smu_context *smu, (OverDriveTable_t *)table_context->overdrive_table;struct smu_11_0_overdrive_table *od_settings = smu->od_settings;uint32_t min_value, max_value; +bool fine_grained;smu_cmn_get_sysfs_buf (&buf, &size);
@@ -1296,12 +1296,23 @@ static int navi10_print_clk_levels(struct smu_context *smu,if (ret)return size; + ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , + &freq_value[0 ]); +if (ret) +return size; + +if (curr_value ==0 ) + curr_value = freq_value[0 ]; + ret =smu_v11_0_get_dpm_level_count (smu, clk_type, &count);if (ret)return size; -if (!navi10_supports_fine_grained_dpm (smu, clk_type)) { -for (i =0 ; i < count; i++) { + fine_grained =navi10_supports_fine_grained_dpm (smu, clk_type); +if (!fine_grained) { + size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" ,0 , freq_value[0 ], + curr_value == freq_value[0 ] ?"*" :"" ); +for (i =1 ; i < count; i++) { ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, i, &value);if (ret)return size;
@@ -1310,24 +1321,28 @@ static int navi10_print_clk_levels(struct smu_context *smu, curr_value == value ? "*" : ""); } }else { - ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type,0 , &freq_value[0 ]); -if (ret) -return size; + freq_value[1 ] = curr_value; ret =smu_v11_0_get_dpm_freq_by_index (smu, clk_type, count -1 , &freq_value[2 ]);if (ret)return size; - freq_value[1 ] = curr_value; - mark_index = curr_value == freq_value[0 ] ?0 : - curr_value == freq_value[2 ] ?2 :1 ; -if (mark_index !=1 ) - freq_value[1 ] = (freq_value[0 ] + freq_value[2 ]) /2 ; - -for (i =0 ; i <3 ; i++) { - size +=sysfs_emit_at (buf, size,"%d: %uMhz %s\n" , i, freq_value[i], - i == mark_index ?"*" :"" ); +if (freq_value[1 ] == freq_value[0 ]) { + i =1 ; + count =3 ; + }else if (freq_value[1 ] == freq_value[2 ]) { + i =0 ; + count =2 ; + }else { + i =0 ; + count =3 ; } +for ( ; i < count; i++) { + size +=sysfs_emit_at (buf, size, +"%d: %uMhz %s\n" , + i, freq_value[i], + curr_value == freq_value[i] ?"*" :"" ); + } }break ;case SMU_PCIE :
Signature · 1 line
2.33.1.558.g2bd2f258f4
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_
Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.
If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
Thanks,
Lijo
Quoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
[AMD Official Use Only]
I agree with Lijo.
Reporting a "round to the smallest operating frequency" just makes user more confusing. As per designed, the frequency marked with "*" should reflect the current clock frequency.
BR
Evan
Quoted 60 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Wednesday, October 13, 2021 12:14 PM
To: Tuikov, Luben <[email protected]>; amd- [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyQuoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).Thanks,
LijoQuoted 12 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequencyQuoted 2 lines
.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++-------
Quoted 2 lines
2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 24 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 8 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
I don't think this interface is really supposed to be the way to get the current clock, although some use it that way. It's supposed to show the DPM states and which are active. conflating the interface with other information confuses things in my opinion. Why is the current clock less than the minimum clock? Whether or not an IP is turned off or in deep sleep or not is independent of DPM states. When the IP is active, it will never go below the minimum DPM level. If we want to query deep sleep or gfxoff we can use the amdgpu_pm_info debugfs interface or add some other new interface.
Alex
Quoted 19 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 34 lines · Alex Deucher
Quoted 24 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 8 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
Quoted 10 lines
I don't think this interface is really supposed to be the way to get the current clock, although some use it that way. It's supposed to show the DPM states and which are active. conflating the interface with other information confuses things in my opinion. Why is the current clock less than the minimum clock? Whether or not an IP is turned off or in deep sleep or not is independent of DPM states. When the IP is active, it will never go below the minimum DPM level. If we want to query deep sleep or gfxoff we can use the
amdgpu_pm_infodebugfs interface or add some other new interface.
The idea of DPM level is deprecated with fine grained clock which provides only min and max. For fine grained clock, we fetch the current clock frequency and show it as an artificial DPM level between min/max. That itself should have confused users but it is not which means the users use the * to fetch the current frequency and not really bothered about the DPM level per se.
Also, some ASICs define 'min' as as the least possible freq (that happens during a throttle) and not the DPM level 0 min in the traditional sense (that is defined as idle frequency which doesn't come into min/max levels). It's usually from the idle frequency that GFX gets power gated. Showing a * against min in such cases would be confusing because that could be misinterpreted as a throttle scenario.
Thanks,
Lijo
Quoted 22 lines
Alex
Quoted 19 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 8 lines · Lijo
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
That seems reasonable to me.
Alex
Quoted 86 lines
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyQuoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
LubenQuoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Deucher, Alexander
maintainer[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
I think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use amdgpu_pm_info?
Regards,
Luben
On 2021-10-18 16:19, Deucher, Alexander wrote:
P {margin-top:0;margin-bottom:0;} [Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
From:Quan, Evan <[email protected]>
Sent:Thursday, October 14, 2021 10:25 PM
To:Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]> Cc:Deucher, Alexander <[email protected]>
Subject:RE: [PATCH 0/5] 0 MHz is not a valid current frequency [AMD Official Use Only]
+Kent who maintains the Rocm tool
From:amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent:Thursday, October 14, 2021 1:07 AM
To:Tuikov, Luben <[email protected]>; [email protected]
Cc:Deucher, Alexander <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
From:Tuikov, Luben <[email protected]>
Sent:Wednesday, October 13, 2021 9:52:09 PM
To:Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc:Deucher, Alexander <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like "NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++-------
2 files changed, 86 insertions(+), 47 deletions(-)
[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
I think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use amdgpu_pm_info?
Regards,
Luben
On 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]><mailto:[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]><mailto:[email protected]>; Tuikov, Luben <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
[AMD Official Use Only]
The * is required for the rocm-smi's functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a "show current clocks" and uses the * to determine which one is active
Kent
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Monday, October 18, 2021 9:05 PM
To: Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
I think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use amdgpu_pm_info?
Regards,
Luben
On 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]><mailto:[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]><mailto:[email protected]>; Tuikov, Luben <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Kent,
What is the command which fails?
I can try to duplicate it here.
So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
Luben
On 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi’s functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a “show current clocks” and uses the * to determine which one is active
Kent
From:amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent:Monday, October 18, 2021 9:05 PM
To:Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc:Kasiviswanathan, Harish <[email protected]>
Subject:RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From:Tuikov, Luben <[email protected]>
Sent:Monday, October 18, 2021 4:30 PM
To:Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
I think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use amdgpu_pm_info?
Regards,
Luben
On 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
From:Quan, Evan <[email protected]>
Sent:Thursday, October 14, 2021 10:25 PM
To:Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]> Cc:Deucher, Alexander <[email protected]>
Subject:RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From:amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent:Thursday, October 14, 2021 1:07 AM
To:Tuikov, Luben <[email protected]>; [email protected]
Cc:Deucher, Alexander <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
From:Tuikov, Luben <[email protected]>
Sent:Wednesday, October 13, 2021 9:52:09 PM
To:Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc:Deucher, Alexander <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like "NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++-------
2 files changed, 86 insertions(+), 47 deletions(-)
[AMD Official Use Only]
It was the rocm-smi -c flag. Maybe some work was done to make it more robust, that would be nice. But the -c flag is supposed to show the current frequency for each clock type. -g would do the same, but just for SCLK.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Tuesday, October 19, 2021 12:27 AM
To: Russell, Kent <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Kent,
What is the command which fails?
I can try to duplicate it here.
So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
Luben
On 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi's functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a "show current clocks" and uses the * to determine which one is active
Kent
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Russell, Kent
Sent: Monday, October 18, 2021 9:05 PM
To: Tuikov, Luben <[email protected]><mailto:[email protected]>; Deucher, Alexander <[email protected]><mailto:[email protected]>; Quan, Evan <[email protected]><mailto:[email protected]>; Lazar, Lijo <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: Kasiviswanathan, Harish <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
I think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use amdgpu_pm_info?
Regards,
Luben
On 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]><mailto:[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]><mailto:[email protected]>; Tuikov, Luben <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>; Russell, Kent <[email protected]><mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]><mailto:[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
________________________________
From: Tuikov, Luben <[email protected]<mailto:[email protected]>>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
It again fails with the same message!
But this time it is different!
Here's why:
openat(AT_FDCWD, "/sys/class/drm/card0/device/pp_dpm_fclk", O_RDONLY) = 3read(3, "0: 571Mhz \n1: 1274Mhz *\n2: 1221M"..., 8191) = 36read(3, "", 8191) = 0
close(3) = 0
write(2, "python3: /home/ltuikov/proj/amd/"..., 220python3: /home/ltuikov/proj/amd/rocm_smi_lib/src/rocm_smi.cc:913: rsmi_status_t get_frequencies(amd::smi::DevInfoTypes, uint32_t, rsmi_frequencies_t*, uint32_t*): Assertion `f->frequency[i-1] <= f->frequency[i]' failed. ) = 220mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f531f9bc000rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
getpid() = 37861
gettid() = 37861tgkill(37861, 37861, SIGABRT) = 0rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=37861, si_uid=1000} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)
$cat /sys/class/drm/card0/device/pp_dpm_fclk
0: 571Mhz
1: 1274Mhz *
2: 1221Mhz
$_
Why is the mid frequency larger than the last?
Why does get_frequencies() insists that they be ordered when they're not? (Does the tool need fixing or the kernel?)
The current patchset doesn't report 0, and doesn't report any current if 0 would've been reported as current. But anything else is reported as it would've been reported before the patch. And I tested it with vanilla amd-staging-drm-next--same thing.
Regards,
Luben
On 2021-10-19 09:25, Russell, Kent wrote:
[AMD Official Use Only]
It was the rocm-smi -c flag. Maybe some work was done to make it more robust, that would be nice. But the -c flag is supposed to show the current frequency for each clock type. -g would do the same, but just for SCLK.
Kent
From:Tuikov, Luben <[email protected]>
Sent:Tuesday, October 19, 2021 12:27 AM
To:Russell, Kent <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected] Cc:Kasiviswanathan, Harish <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Kent,
What is the command which fails?
I can try to duplicate it here.
So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
Luben
On 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi’s functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a “show current clocks” and uses the * to determine which one is active
Kent
From:amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent:Monday, October 18, 2021 9:05 PM
To:Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc:Kasiviswanathan, Harish <[email protected]>
Subject:RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From:Tuikov, Luben <[email protected]>
Sent:Monday, October 18, 2021 4:30 PM
To:Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
I think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use amdgpu_pm_info?
Regards,
Luben
On 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
From:Quan, Evan <[email protected]>
Sent:Thursday, October 14, 2021 10:25 PM
To:Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]> Cc:Deucher, Alexander <[email protected]>
Subject:RE: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
+Kent who maintains the Rocm tool
From:amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent:Thursday, October 14, 2021 1:07 AM
To:Tuikov, Luben <[email protected]>; [email protected]
Cc:Deucher, Alexander <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo
From:Tuikov, Luben <[email protected]>
Sent:Wednesday, October 13, 2021 9:52:09 PM
To:Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc:Deucher, Alexander <[email protected]>
Subject:Re: [PATCH 0/5] 0 MHz is not a valid current frequency
Quoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like "NA" - not available (frequency cannot be fetched at the moment).
There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_
Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat /sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_
What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
Luben
Quoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++-------
2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 27 lines · Luben Tuikov
It again fails with the same message!
But this time it is different!
Here's why:
openat(AT_FDCWD, "/sys/class/drm/card0/device/pp_dpm_fclk", O_RDONLY)= 3read(3, "0: 571Mhz \n1: 1274Mhz *\n2: 1221M"..., 8191)= 36read(3, "", 8191)= 0
close(3) = 0
write(2, "python3:/home/ltuikov/proj/amd/"..., 220python3:/home/ltuikov/proj/amd/rocm_smi_lib/src/rocm_smi.cc:913:rsmi_status_tget_frequencies(amd::smi::DevInfoTypes, uint32_t, rsmi_frequencies_t*, uint32_t*): Assertion `f->frequency[i-1] <= f->frequency[i]' failed. ) = 220mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)=0x7f531f9bc000rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8)= 0rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8)= 0getpid() = 37861 gettid() = 37861 tgkill(37861, 37861, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8)= 0killed by SIGABRT (core dumped) +++ renamed from SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=37861, si_uid=1000} --- +0
-0Aborted (core dumped)
$cat/sys/class/drm/card0/device/pp_dpm_fclk
0: 571Mhz
1: 1274Mhz *
2: 1221Mhz
$_
Quoted 5 lines
Why is the mid frequency larger than the last?
Why doesget_frequencies()insists that they be ordered when they're not? (Does the tool need fixing or the kernel?)The current patchset doesn't report 0, and doesn't report any current if 0 would've been reported as current. But anything else is reported as it would've been reported before the patch. And I tested it with vanilla amd-staging-drm-next--same thing.
Seems to crash both ways. I'd rather either:
1. Remove the * when the clock is outside of the min and max ranges or
2. Clamp the clock to the max or min if it's above or below.
And then fix the tools accordingly. Those seem like the choices of least surprise considering the interface is supposed to show the current and available DPM levels.
Alex
Quoted 235 lines
Regards,
LubenOn 2021-10-19 09:25, Russell, Kent wrote:
[AMD Official Use Only]
It was the rocm-smi -c flag. Maybe some work was done to make it more robust, that would be nice. But the -c flag is supposed to show the current frequency for each clock type. -g would do the same, but just for SCLK.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Tuesday, October 19, 2021 12:27 AM
To: Russell, Kent <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyKent,
What is the command which fails?
I can try to duplicate it here.So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
LubenOn 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi’s functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a “show current clocks” and uses the * to determine which one is active
Kent
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Monday, October 18, 2021 9:05 PM
To: Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyI think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use
amdgpu_pm_info?Regards,
LubenOn 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyQuoted 21 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
LubenQuoted 20 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 37 lines · Alex Deucher
Quoted 26 lines · Luben Tuikov
It again fails with the same message!
But this time it is different!
Here's why:
openat(AT_FDCWD, "/sys/class/drm/card0/device/pp_dpm_fclk", O_RDONLY)= 3read(3, "0: 571Mhz \n1: 1274Mhz *\n2: 1221M"..., 8191)= 36read(3, "", 8191)= 0
close(3) = 0
write(2, "python3:/home/ltuikov/proj/amd/"..., 220python3:/home/ltuikov/proj/amd/rocm_smi_lib/src/rocm_smi.cc:913:rsmi_status_tget_frequencies(amd::smi::DevInfoTypes, uint32_t, rsmi_frequencies_t*, uint32_t*): Assertion `f->frequency[i-1] <= f->frequency[i]' failed. ) = 220mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)=0x7f531f9bc000rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8)= 0rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8)= 0getpid() = 37861 gettid() = 37861 tgkill(37861, 37861, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8)= 0killed by SIGABRT (core dumped) +++ renamed from SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=37861, si_uid=1000} --- +0
-0Aborted (core dumped)
$cat/sys/class/drm/card0/device/pp_dpm_fclk
0: 571Mhz
1: 1274Mhz *
2: 1221Mhz
$_Quoted 5 lines
Why is the mid frequency larger than the last?
Why doesget_frequencies()insists that they be ordered when they're not? (Does the tool need fixing or the kernel?)The current patchset doesn't report 0, and doesn't report any current if 0 would've been reported as current. But anything else is reported as it would've been reported before the patch. And I tested it with vanilla amd-staging-drm-next--same thing.
Seems to crash both ways. I'd rather either:
1. Remove the * when the clock is outside of the min and max ranges or
2. Clamp the clock to the max or min if it's above or below.
Quoted 3 lines
And then fix the tools accordingly. Those seem like the choices of least surprise considering the interface is supposed to show the current and available DPM levels.
So, if we get a case such as the one above, we remove the whole line at 1:, not just the asterisk, right? (for option 1 above). The rocm-smi lib would fail if they're out of order, so only removing the * char would still confuse the tool.
What does it mean when the current frequency (line 1:) is above the "max" (line 2:) as shown in my output above?
Do we perhaps want to sort them and report current still, and swap lines 1 and 2?
Or should we simply remove the ordering requirement in rocm-smi lib?
Regards,
Luben
Quoted 234 lines
Alex
Quoted 230 lines
Regards,
LubenOn 2021-10-19 09:25, Russell, Kent wrote:
[AMD Official Use Only]
It was the rocm-smi -c flag. Maybe some work was done to make it more robust, that would be nice. But the -c flag is supposed to show the current frequency for each clock type. -g would do the same, but just for SCLK.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Tuesday, October 19, 2021 12:27 AM
To: Russell, Kent <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyKent,
What is the command which fails?
I can try to duplicate it here.So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
LubenOn 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi’s functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a “show current clocks” and uses the * to determine which one is active
Kent
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Monday, October 18, 2021 9:05 PM
To: Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyI think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use
amdgpu_pm_info?Regards,
LubenOn 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyQuoted 20 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
LubenQuoted 19 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 42 lines · Luben Tuikov
Quoted 37 lines · Alex Deucher
Quoted 26 lines · Luben Tuikov
It again fails with the same message!
But this time it is different!
Here's why:
openat(AT_FDCWD, "/sys/class/drm/card0/device/pp_dpm_fclk", O_RDONLY)= 3read(3, "0: 571Mhz \n1: 1274Mhz *\n2: 1221M"..., 8191)= 36read(3, "", 8191)= 0
close(3) = 0
write(2, "python3:/home/ltuikov/proj/amd/"..., 220python3:/home/ltuikov/proj/amd/rocm_smi_lib/src/rocm_smi.cc:913:rsmi_status_tget_frequencies(amd::smi::DevInfoTypes, uint32_t, rsmi_frequencies_t*, uint32_t*): Assertion `f->frequency[i-1] <= f->frequency[i]' failed. ) = 220mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)=0x7f531f9bc000rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8)= 0rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8)= 0getpid() = 37861 gettid() = 37861 tgkill(37861, 37861, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8)= 0killed by SIGABRT (core dumped) +++ renamed from SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=37861, si_uid=1000} --- +0
-0Aborted (core dumped)
$cat/sys/class/drm/card0/device/pp_dpm_fclk
0: 571Mhz
1: 1274Mhz *
2: 1221Mhz
$_Quoted 5 lines
Why is the mid frequency larger than the last?
Why doesget_frequencies()insists that they be ordered when they're not? (Does the tool need fixing or the kernel?)The current patchset doesn't report 0, and doesn't report any current if 0 would've been reported as current. But anything else is reported as it would've been reported before the patch. And I tested it with vanilla amd-staging-drm-next--same thing.
Seems to crash both ways. I'd rather either:
1. Remove the * when the clock is outside of the min and max ranges or
2. Clamp the clock to the max or min if it's above or below.Quoted 3 lines
And then fix the tools accordingly. Those seem like the choices of least surprise considering the interface is supposed to show the current and available DPM levels.
Quoted 9 lines
So, if we get a case such as the one above, we remove the whole line at 1:, not just the asterisk, right? (for option 1 above). The rocm-smi lib would fail if they're out of order, so only removing the * char would still confuse the tool.
What does it mean when the current frequency (line 1:) is above the "max" (line 2:) as shown in my output above?
Do we perhaps want to sort them and report current still, and swap lines 1 and 2?
Or should we simply remove the ordering requirement in rocm-smi lib?
These nodes help to find the current state of ASIC. Clamping the values will just erase questions like these and possible improvements/fixes.
For ex: if the situation above is a case of OD (this is only example, don't know what is really the case above) that goes beyond regular DPM min/max levels, then we could add + as improvement.
IMO, the node should reflect the current state of ASIC and masking the values shouldn't be done. Other cases could be 0 or FW handshake failures where * itself will be missing.
Thanks,
Lijo
Quoted 238 lines
Regards,
LubenQuoted 234 lines
Alex
Quoted 230 lines
Regards,
LubenOn 2021-10-19 09:25, Russell, Kent wrote:
[AMD Official Use Only]
It was the rocm-smi -c flag. Maybe some work was done to make it more robust, that would be nice. But the -c flag is supposed to show the current frequency for each clock type. -g would do the same, but just for SCLK.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Tuesday, October 19, 2021 12:27 AM
To: Russell, Kent <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyKent,
What is the command which fails?
I can try to duplicate it here.So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
LubenOn 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi’s functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a “show current clocks” and uses the * to determine which one is active
Kent
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Monday, October 18, 2021 9:05 PM
To: Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyI think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use
amdgpu_pm_info?Regards,
LubenOn 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyQuoted 20 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
LubenQuoted 19 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)
Quoted 49 lines · Lijo
Quoted 45 lines · Luben Tuikov
Quoted 37 lines · Alex Deucher
Quoted 26 lines · Luben Tuikov
It again fails with the same message!
But this time it is different!
Here's why:
openat(AT_FDCWD, "/sys/class/drm/card0/device/pp_dpm_fclk", O_RDONLY)= 3read(3, "0: 571Mhz \n1: 1274Mhz *\n2: 1221M"..., 8191)= 36read(3, "", 8191)= 0
close(3) = 0
write(2, "python3:/home/ltuikov/proj/amd/"..., 220python3:/home/ltuikov/proj/amd/rocm_smi_lib/src/rocm_smi.cc:913:rsmi_status_tget_frequencies(amd::smi::DevInfoTypes, uint32_t, rsmi_frequencies_t*, uint32_t*): Assertion `f->frequency[i-1] <= f->frequency[i]' failed. ) = 220mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)=0x7f531f9bc000rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8)= 0rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8)= 0getpid() = 37861 gettid() = 37861 tgkill(37861, 37861, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8)= 0killed by SIGABRT (core dumped) +++ renamed from SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=37861, si_uid=1000} --- +0
-0Aborted (core dumped)
$cat/sys/class/drm/card0/device/pp_dpm_fclk
0: 571Mhz
1: 1274Mhz *
2: 1221Mhz
$_Quoted 5 lines
Why is the mid frequency larger than the last?
Why doesget_frequencies()insists that they be ordered when they're not? (Does the tool need fixing or the kernel?)The current patchset doesn't report 0, and doesn't report any current if 0 would've been reported as current. But anything else is reported as it would've been reported before the patch. And I tested it with vanilla amd-staging-drm-next--same thing.
Seems to crash both ways. I'd rather either:
1. Remove the * when the clock is outside of the min and max ranges or
2. Clamp the clock to the max or min if it's above or below.Quoted 3 lines
And then fix the tools accordingly. Those seem like the choices of least surprise considering the interface is supposed to show the current and available DPM levels.
So, if we get a case such as the one above, we remove the whole line at 1:, not just the asterisk, right? (for option 1 above). The rocm-smi lib would fail if they're out of order, so only removing the * char would still confuse the tool.
Quoted 9 lines
Quoted 6 lines
What does it mean when the current frequency (line 1:) is above the "max" (line 2:) as shown in my output above?
Do we perhaps want to sort them and report current still, and swap lines 1 and 2?
Or should we simply remove the ordering requirement in rocm-smi lib?
These nodes help to find the current state of ASIC. Clamping the values will just erase questions like these and possible improvements/fixes.
I don't really think that is the case. E.g., rocm-smi expects the values to be ordered. As was previously discussed, this was originally added as an interface to see what the current DPM state was and as a way to mask out specific DPM states. When discrete DPM states went away, we end up with just a min and max so a middle step was added to show the current clock in relation to the min and max. When the clock is on, DPM is active and the clock should be >= min and <= max.
Quoted 3 lines
For ex: if the situation above is a case of OD (this is only example, don't know what is really the case above) that goes beyond regular DPM min/max levels, then we could add + as improvement.
With over- or under-clocking, shouldn't the min/max change instead?
Quoted 4 lines
IMO, the node should reflect the current state of ASIC and masking the values shouldn't be done. Other cases could be 0 or FW handshake failures where * itself will be missing.
I'm fine with dropping the * for cases outside of the min/max, but I think clamping works as well. E.g., while SMU reports 0 in some cases, that could be due to the clock being off or the block being powergated. It's still in the lowest state. If the clock were on, it would be in the lowest state. Same thing on the high end. It's possible there is a little slop in the clock calculations for stability. E.g., the clock may be a few Mhz above the max because SMU determined that the current max frequency was not stable in combination with some other clock. It's still ostensibly in the highest DPM state.
Alex
Quoted 242 lines
Thanks,
LijoQuoted 238 lines
Regards,
LubenQuoted 234 lines
Alex
Quoted 230 lines
Regards,
LubenOn 2021-10-19 09:25, Russell, Kent wrote:
[AMD Official Use Only]
It was the rocm-smi -c flag. Maybe some work was done to make it more robust, that would be nice. But the -c flag is supposed to show the current frequency for each clock type. -g would do the same, but just for SCLK.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Tuesday, October 19, 2021 12:27 AM
To: Russell, Kent <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyKent,
What is the command which fails?
I can try to duplicate it here.So far, things I've tried, I cannot make rocm-smi fail. Command arguments?
Regards,
LubenOn 2021-10-18 21:06, Russell, Kent wrote:
[AMD Official Use Only]
The * is required for the rocm-smi’s functionality for showing what the current clocks are. We had a bug before where the * was removed, then the SMI died fantastically. Work could be done to try to handle that type of situation, but the SMI has a “show current clocks” and uses the * to determine which one is active
Kent
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Monday, October 18, 2021 9:05 PM
To: Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Cc: Kasiviswanathan, Harish <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Harish, rocm-smi falls under his purview now.
Kent
From: Tuikov, Luben <[email protected]>
Sent: Monday, October 18, 2021 4:30 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]; Russell, Kent <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyI think Kent is already seen these patches as he did comment on 1/5 patch.
The v3 version of the patch, posted last week, removes the asterisk to report the lowest frequency as the current frequency, when the current frequency is 0, i.e. when the block is in low power state. Does the tool rely on the asterisk? If this information is necessary could it not use
amdgpu_pm_info?Regards,
LubenOn 2021-10-18 16:19, Deucher, Alexander wrote:
[Public]
We the current behavior (0 for clock) already crashes the tool, so I don't think we can really make things worse.
Alex
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, October 14, 2021 10:25 PM
To: Lazar, Lijo <[email protected]>; Tuikov, Luben <[email protected]>; [email protected] <[email protected]>; Russell, Kent <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
+Kent who maintains the Rocm tool
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, October 14, 2021 1:07 AM
To: Tuikov, Luben <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequency[AMD Official Use Only]
[AMD Official Use Only]
Quoted 1 line
Or maybe just a list without default hint, i.e. no asterisk?
I think this is also fine meaning we are having trouble in determining the current frequency or DPM level. Evan/Alex? Don't know if this will crash the tools.
Thanks,
Lijo________________________________
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, October 13, 2021 9:52:09 PM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 0/5] 0 MHz is not a valid current frequencyQuoted 20 lines · Lijo
Quoted 10 lines · Luben Tuikov
Some ASIC support low-power functionality for the whole ASIC or just an IP block. When in such low-power mode, some sysfs interfaces would report a frequency of 0, e.g.,
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz
1: 0Mhz *
2: 2200Mhz
$_Quoted 7 lines
An operating frequency of 0 MHz doesn't make sense, and this interface is designed to report only operating clock frequencies, i.e. non-zero, and possibly the current one.
When in this low-power state, round to the smallest operating frequency, for this interface, as follows,
Would rather avoid this -
Quoted 7 lines
1) It is manipulating FW reported value. If at all there is an uncaught issue in FW reporting of frequency values, that is masked here.
2) Otherwise, if 0MHz is described as GFX power gated case, this provides a convenient interface to check if GFX is power gated.If seeing a '0' is not pleasing, consider changing to something like
"NA" - not available (frequency cannot be fetched at the moment).There's a ROCm tool which literally asserts if the values are not ordered in increasing order. Now since 0 < 550, but 0 is listed as the second entry, the tool simply asserts and crashes.
It is not clear what you'd rather see here:
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: N/A *
2: 2200MHz
$_Is this what you want to see? (That'll crash other tools which expect %uMhz.)
Or maybe just a list without default hint, i.e. no asterisk?
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 550Mhz
1: 2200MHz
$_What should the output be?
We want to avoid showing 0, but still show numbers.
Regards,
LubenQuoted 19 lines
Thanks,
LijoQuoted 16 lines
$cat
/sys/class/drm/card0/device/pp_dpm_sclk
0: 500Mhz *
1: 2200Mhz
$_Luben Tuikov (5):
drm/amd/pm: Slight function rename
drm/amd/pm: Renamecur_valuetocurr_valuedrm/amd/pm: Renamefreq_values-->freq_valuedpm/amd/pm: Sienna: 0 MHz is not a current clock frequency dpm/amd/pm: Navi10: 0 MHz is not a current clock frequency.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 60 +++++++++------ .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 73 ++++++++++++------- 2 files changed, 86 insertions(+), 47 deletions(-)