drm/amdgpu: Fix regression in adjusting power table/profile
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix regression in adjusting power table/profile
Regression was introduced in commit 38e0c89a19fd ("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made the set_pp_od_clk_voltage and set_pp_power_profile_mode return -EINVAL for previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7 -2
@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }
@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedQuoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>
Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hello all, I just did some testing with this applied, and while it no longer returns -EINVAL, running sudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage' results in sh spiking to, and staying at 100% CPU usage, with no indicating information in dmesg from the kernel.
It appeared to work at least ONCE, but potentially not after.
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 57 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 9 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hello Matt,
Thank you for your testing. It seems that my gpu (RX 570) does not support the vc setting so I can not exactly reproduce the issue. However I did trace the code path the test case takes and it seems to correctly pass through the while loop that parses the input and fails only in amdgpu_dpm_odn_edit_dpm_table. The 'parameter' array is populated the same way as the original code did. Since the amdgpu_dpm_odn_edit_dpm_table is reached, I think that your problem is unfortunately caused by something else.
Paweł Gronowski
Quoted 8 lines · Matt Coffin
Hello all, I just did some testing with this applied, and while it no longer returns
-EINVAL, runningsudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage'results inshspiking to, and staying at 100% CPU usage, with no indicating information indmesgfrom the kernel.It appeared to work at least ONCE, but potentially not after.
Quoted 74 lines
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 66 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hey Pawel,
I did confirm that this patch *introduced* the issue both with the bisect, and by testing reverting it.
Now, there's a lot of fragile pieces in the dpm handling, so it could be this patch's interaction with something else that's causing it and it may well not be the fault of this code, but this is the patch that introduced the issue.
I'll have some more time tomorrow to try to get down to root cause here, so maybe I'll have more to offer then.
Thanks for taking a look,
Matt
Quoted 11 lines · Paweł Gronowski
Hello Matt,
Thank you for your testing. It seems that my gpu (RX 570) does not support the vc setting so I can not exactly reproduce the issue. However I did trace the code path the test case takes and it seems to correctly pass through the while loop that parses the input and fails only in
amdgpu_dpm_odn_edit_dpm_table. The 'parameter' array is populated the same way as the original code did. Since theamdgpu_dpm_odn_edit_dpm_tableis reached, I think that your problem is unfortunately caused by something else.
Quoted 88 lines
Paweł Gronowski
Quoted 82 lines · Matt Coffin
Hello all, I just did some testing with this applied, and while it no longer returns
-EINVAL, runningsudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage'results inshspiking to, and staying at 100% CPU usage, with no indicating information indmesgfrom the kernel.It appeared to work at least ONCE, but potentially not after.
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 66 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hey Matt,
I have just tested the amd-staging-drm-next branch (dd654c76d6e854afad716ded899e4404734aaa10) with my patches reverted and I can reproduce your issue with:
sudo sh -c 'echo "s 0 305 750" > /sys/class/drm/card0/device/pp_od_clk_voltage'
Which makes the sh hang with 100% usage.
The issue does not happen on the mainline (d8b9faec54ae4bc2fff68bcd0befa93ace8256ce) both without and with my patches reapplied.
So the problem must be related to some commit that is present in the amd-staging-drm-next but not in the mainline.
Paweł Gronowski
Quoted 10 lines · Matt Coffin
Hey Pawel,
I did confirm that this patch *introduced* the issue both with the bisect, and by testing reverting it.
Now, there's a lot of fragile pieces in the dpm handling, so it could be this patch's interaction with something else that's causing it and it may well not be the fault of this code, but this is the patch that introduced the issue.
Quoted 107 lines
I'll have some more time tomorrow to try to get down to root cause here, so maybe I'll have more to offer then.
Thanks for taking a look,
MattQuoted 99 lines · Paweł Gronowski
Hello Matt,
Thank you for your testing. It seems that my gpu (RX 570) does not support the vc setting so I can not exactly reproduce the issue. However I did trace the code path the test case takes and it seems to correctly pass through the while loop that parses the input and fails only in
amdgpu_dpm_odn_edit_dpm_table. The 'parameter' array is populated the same way as the original code did. Since theamdgpu_dpm_odn_edit_dpm_tableis reached, I think that your problem is unfortunately caused by something else.Paweł Gronowski
Quoted 82 lines · Matt Coffin
Hello all, I just did some testing with this applied, and while it no longer returns
-EINVAL, runningsudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage'results inshspiking to, and staying at 100% CPU usage, with no indicating information indmesgfrom the kernel.It appeared to work at least ONCE, but potentially not after.
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 66 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hello again,
I just finished a bisect of amd-staging-drm-next and it looks like the hang is first introduced in edad8312cbbf9a33c86873fc4093664f150dd5c1 ("drm/amdgpu: fix system hang issue during GPU reset").
It is a bit tricky, because it is commited on top of my first faulty patch 7173949df45482 ("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") so it needs to be reverted fix the premature -INVAL.
Test case:
sudo sh -c 'echo "s 0 305 750" > /sys/class/drm/card0/device/pp_od_clk_voltage'
Results:
edad8312cbbf9a3 + revert 7173949df45482 = hang
edad8312cbbf9a3~1 + revert 7173949df45482 = no hang
Could you confirm that you get the same results?
Thanks,
Paweł Gronowski
Quoted 16 lines · Paweł Gronowski
Hey Matt,
I have just tested the amd-staging-drm-next branch (
dd654c76d6e854afad716ded899e4404734aaa10) with my patches reverted and I can reproduce your issue with:sudo sh -c 'echo "s 0 305 750" >
/sys/class/drm/card0/device/pp_od_clk_voltage'Which makes the sh hang with 100% usage.
The issue does not happen on the mainline (
d8b9faec54ae4bc2fff68bcd0befa93ace8256ce) both without and with my patches reapplied.
So the problem must be related to some commit that is present in the amd-staging-drm-next but not in the mainline.
Quoted 123 lines
Paweł Gronowski
Quoted 117 lines · Matt Coffin
Hey Pawel,
I did confirm that this patch *introduced* the issue both with the bisect, and by testing reverting it.
Now, there's a lot of fragile pieces in the dpm handling, so it could be this patch's interaction with something else that's causing it and it may well not be the fault of this code, but this is the patch that introduced the issue.
I'll have some more time tomorrow to try to get down to root cause here, so maybe I'll have more to offer then.
Thanks for taking a look,
MattQuoted 99 lines · Paweł Gronowski
Hello Matt,
Thank you for your testing. It seems that my gpu (RX 570) does not support the vc setting so I can not exactly reproduce the issue. However I did trace the code path the test case takes and it seems to correctly pass through the while loop that parses the input and fails only in
amdgpu_dpm_odn_edit_dpm_table. The 'parameter' array is populated the same way as the original code did. Since theamdgpu_dpm_odn_edit_dpm_tableis reached, I think that your problem is unfortunately caused by something else.Paweł Gronowski
Quoted 82 lines · Matt Coffin
Hello all, I just did some testing with this applied, and while it no longer returns
-EINVAL, runningsudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage'results inshspiking to, and staying at 100% CPU usage, with no indicating information indmesgfrom the kernel.It appeared to work at least ONCE, but potentially not after.
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 66 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
I actually *just* finished my bisect, and arrived at the same conclusion. The hang appears to be introduced in edad8312cbbf9a33c86873fc4093664f150dd5c1.
There are some conflicts with an automatic git revert, so I'm picking through the changes now to fully understand what happened and come up with a fix.
Thanks again for the help,
Matt
Quoted 16 lines · Paweł Gronowski
Hello again,
I just finished a bisect of amd-staging-drm-next and it looks like the hang is first introduced in
edad8312cbbf9a33c86873fc4093664f150dd5c1("drm/amdgpu: fix system hang issue during GPU reset").It is a bit tricky, because it is commited on top of my first faulty patch
7173949df45482("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") so it needs to be reverted fix the premature -INVAL.Test case:
sudo sh -c 'echo "s 0 305 750" >/sys/class/drm/card0/device/pp_od_clk_voltage'
Results:
edad8312cbbf9a3+ revert7173949df45482= hang
edad8312cbbf9a3~1 + revert7173949df45482= no hang
Quoted 146 lines
Could you confirm that you get the same results?
Thanks,
Paweł GronowskiQuoted 139 lines · Paweł Gronowski
Hey Matt,
I have just tested the amd-staging-drm-next branch (
dd654c76d6e854afad716ded899e4404734aaa10) with my patches reverted and I can reproduce your issue with:sudo sh -c 'echo "s 0 305 750" >
/sys/class/drm/card0/device/pp_od_clk_voltage'Which makes the sh hang with 100% usage.
The issue does not happen on the mainline (
d8b9faec54ae4bc2fff68bcd0befa93ace8256ce) both without and with my patches reapplied.
So the problem must be related to some commit that is present in the amd-staging-drm-next but not in the mainline.Paweł Gronowski
Quoted 117 lines · Matt Coffin
Hey Pawel,
I did confirm that this patch *introduced* the issue both with the bisect, and by testing reverting it.
Now, there's a lot of fragile pieces in the dpm handling, so it could be this patch's interaction with something else that's causing it and it may well not be the fault of this code, but this is the patch that introduced the issue.
I'll have some more time tomorrow to try to get down to root cause here, so maybe I'll have more to offer then.
Thanks for taking a look,
MattQuoted 99 lines · Paweł Gronowski
Hello Matt,
Thank you for your testing. It seems that my gpu (RX 570) does not support the vc setting so I can not exactly reproduce the issue. However I did trace the code path the test case takes and it seems to correctly pass through the while loop that parses the input and fails only in
amdgpu_dpm_odn_edit_dpm_table. The 'parameter' array is populated the same way as the original code did. Since theamdgpu_dpm_odn_edit_dpm_tableis reached, I think that your problem is unfortunately caused by something else.Paweł Gronowski
Quoted 82 lines · Matt Coffin
Hello all, I just did some testing with this applied, and while it no longer returns
-EINVAL, runningsudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage'results inshspiking to, and staying at 100% CPU usage, with no indicating information indmesgfrom the kernel.It appeared to work at least ONCE, but potentially not after.
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 66 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
My bisect resulted in the same conclusion, that the problem began with edad8312cbbf9a33c86873fc4093664f150dd5c1.
That commit has a LOT of changes, so I'm having problems following what might be relevant, so in case Hawking or Dennis have any insight they could contribute towards letting us know where to look, I've added them to the CC list.
If you guys know why those GPU reset changes would have effected the sysfs interfaces in this way, it could save me a bunch of investigation time.
Thanks in advance,
Matt
Quoted 16 lines · Paweł Gronowski
Hello again,
I just finished a bisect of amd-staging-drm-next and it looks like the hang is first introduced in
edad8312cbbf9a33c86873fc4093664f150dd5c1("drm/amdgpu: fix system hang issue during GPU reset").It is a bit tricky, because it is commited on top of my first faulty patch
7173949df45482("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") so it needs to be reverted fix the premature -INVAL.Test case:
sudo sh -c 'echo "s 0 305 750" >/sys/class/drm/card0/device/pp_od_clk_voltage'
Results:
edad8312cbbf9a3+ revert7173949df45482= hang
edad8312cbbf9a3~1 + revert7173949df45482= no hang
Quoted 146 lines
Could you confirm that you get the same results?
Thanks,
Paweł GronowskiQuoted 139 lines · Paweł Gronowski
Hey Matt,
I have just tested the amd-staging-drm-next branch (
dd654c76d6e854afad716ded899e4404734aaa10) with my patches reverted and I can reproduce your issue with:sudo sh -c 'echo "s 0 305 750" >
/sys/class/drm/card0/device/pp_od_clk_voltage'Which makes the sh hang with 100% usage.
The issue does not happen on the mainline (
d8b9faec54ae4bc2fff68bcd0befa93ace8256ce) both without and with my patches reapplied.
So the problem must be related to some commit that is present in the amd-staging-drm-next but not in the mainline.Paweł Gronowski
Quoted 117 lines · Matt Coffin
Hey Pawel,
I did confirm that this patch *introduced* the issue both with the bisect, and by testing reverting it.
Now, there's a lot of fragile pieces in the dpm handling, so it could be this patch's interaction with something else that's causing it and it may well not be the fault of this code, but this is the patch that introduced the issue.
I'll have some more time tomorrow to try to get down to root cause here, so maybe I'll have more to offer then.
Thanks for taking a look,
MattQuoted 99 lines · Paweł Gronowski
Hello Matt,
Thank you for your testing. It seems that my gpu (RX 570) does not support the vc setting so I can not exactly reproduce the issue. However I did trace the code path the test case takes and it seems to correctly pass through the while loop that parses the input and fails only in
amdgpu_dpm_odn_edit_dpm_table. The 'parameter' array is populated the same way as the original code did. Since theamdgpu_dpm_odn_edit_dpm_tableis reached, I think that your problem is unfortunately caused by something else.Paweł Gronowski
Quoted 82 lines · Matt Coffin
Hello all, I just did some testing with this applied, and while it no longer returns
-EINVAL, runningsudo sh -c 'echo "vc 2 2150 1195" > /sys/class/drm/card1/device/pp_od_clk_voltage'results inshspiking to, and staying at 100% CPU usage, with no indicating information indmesgfrom the kernel.It appeared to work at least ONCE, but potentially not after.
This is not unique to Navi, and caused the problem on a POLARIS10 card as well.
Sorry for the bad news, and thanks for any insight you may have, Matt Coffin
Quoted 66 lines · Alex Deucher
Quoted 8 lines · Paweł Gronowski
Regression was introduced in commit
38e0c89a19fd("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which made theset_pp_od_clk_voltageandset_pp_power_profile_modereturn-EINVALfor previously valid input. This was caused by an empty string (starting at the \0 character) being passed to the kstrtol.Signed-off-by Paweł Gronowski <[email protected]>Applied. Thanks!
Alex
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7
-3@@ -778,12 +778,14 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, tmp_str++;while (isspace (*++tmp_str)); -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; }@@ -1635,11 +1637,14 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, i++;memcpy (buf_cpy, buf, count-i); tmp_str = buf_cpy; -while ((sub_str =strsep (&tmp_str, delimiter)) !=NULL ) { +while ((sub_str =strsep (&tmp_str, delimiter)) && *sub_str) { ret =kstrtol (sub_str,0 , ¶meter[parameter_size]);if (ret)return -EINVAL ; parameter_size++; + +if (!tmp_str) +break ;while (isspace (*tmp_str)) tmp_str++; } --2.25.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx