drm/amd/pm: report the default performance level after a reset
Subsystems (3)
cover drm/amd/pm: report the default performance level after a reset
After a GPU reset the level reported through power_dpm_force_performance_level no longer describes the hardware. The reset reinitialises PMFW, which comes back on its default curve, but smu_dpm.dpm_level still holds the level the user forced, and that cached value is what sysfs reports.
On an SMU 14.0.1 APU this shows up as gfxclk dropping from 2.8GHz to 600MHz while sysfs still reports high, with no thermal or power event involved:
before level: high freq: 2799000000
amdgpu 0000:c5:00.0: MODE2 reset
amdgpu 0000:c5:00.0: SMU is resumed successfully!after level: high freq: 600000000
The stale value also leaves the user with no way back. Writing the same level again is dropped by amdgpu_dpm_force_performance_level(), which returns early when the requested level matches the cached one, so only a genuine change of level reaches the hardware:
after reset : 600000000
re-write "high" (same) : 600000000
toggle auto -> high : 2691000000
Since the reset often goes unnoticed, the machine quietly runs at a fraction of the requested clock with no indication to the user.
The patch resets the cached level once PMFW has been reinitialised, so that it describes the hardware and writing the level again takes effect. It is scoped to reset recovery only, as PMFW retains its state across s2idle and the forced level still applies on resume.
Tested on an SMU 14.0.1 APU. For each level: set it, trigger a reset through debugfs, then write the same level again.
level set after reset after writing it again high 2691MHz auto 600MHz high 2691MHz low 600MHz auto 600MHz low 600MHz auto 600MHz auto 600MHz auto 600MHz manual 600MHz auto 600MHz manual 600MHz profile_peak 2081MHz auto 600MHz profile_peak 2201MHz
Every level reports auto after the reset, matching the hardware, and writing the level again takes effect in each case. profile_peak sets a ceiling rather than a floor, so its sampled clock varies with load.
Suspend/resume is unaffected: high at 2771MHz before suspend, still high at 2799MHz after resume.
This is the only configuration I have available to test. The change is in generic SMU code, so it applies to every ASIC going through smu_late_init().
Priya Hosur (1):
drm/amd/pm: report the default performance level after a reset
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++++ 1 file changed, 4 insertions(+)
Signature · 1 line
2.43.0
PATCH 1/1 drm/amd/pm: report the default performance level after a reset
A GPU reset reinitialises PMFW, which comes back on its default curve, but smu_dpm.dpm_level still holds the level the user forced. sysfs keeps reporting that level while the hardware runs at the default one. On an SMU 14.0.1 APU gfxclk drops from 2.8GHz to 600MHz while sysfs still reports high.
The stale value also stops the user from recovering, as writing the same level again is dropped by amdgpu_dpm_force_performance_level().
Reset the cached level once PMFW has been reinitialised, so that it describes the hardware. Suspend/resume is not covered, as PMFW retains its state across s2idle.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -0
@@ -998,6 +998,10 @@ static int smu_late_init(struct amdgpu_ip_block *ip_block)smu_get_fan_parameters (smu); +/* PMFW is reinitialised by the reset, so the cached level must follow */ +if (amdgpu_reset_in_recovery (adev)) + smu->smu_dpm.dpm_level =AMD_DPM_FORCED_LEVEL_AUTO ; +smu_handle_task (smu, smu->smu_dpm.dpm_level,AMD_PP_TASK_COMPLETE_INIT );
Signature · 1 line
2.43.0
Quoted 45 lines · Priya Hosur
After a GPU reset the level reported through
power_dpm_force_performance_levelno longer describes the hardware. The reset reinitialises PMFW, which comes back on its default curve, but smu_dpm.dpm_level still holds the level the user forced, and that cached value is what sysfs reports.On an SMU 14.0.1 APU this shows up as gfxclk dropping from 2.8GHz to 600MHz while sysfs still reports high, with no thermal or power event involved:
before level: high freq: 2799000000 amdgpu 0000:c5:00.0: MODE2 reset amdgpu 0000:c5:00.0: SMU is resumed successfully! after level: high freq: 600000000The stale value also leaves the user with no way back. Writing the same level again is dropped by
amdgpu_dpm_force_performance_level(), which returns early when the requested level matches the cached one, so only a genuine change of level reaches the hardware:after reset : 600000000 re-write "high" (same) : 600000000 toggle auto -> high : 2691000000Since the reset often goes unnoticed, the machine quietly runs at a fraction of the requested clock with no indication to the user.
The patch resets the cached level once PMFW has been reinitialised, so that it describes the hardware and writing the level again takes effect. It is scoped to reset recovery only, as PMFW retains its state across s2idle and the forced level still applies on resume.
Tested on an SMU 14.0.1 APU. For each level: set it, trigger a reset through debugfs, then write the same level again.
level set after reset after writing it again high 2691MHz auto 600MHz high 2691MHz low 600MHz auto 600MHz low 600MHz auto 600MHz auto 600MHz auto 600MHz manual 600MHz auto 600MHz manual 600MHz profile_peak 2081MHz auto 600MHz profile_peak 2201MHzEvery level reports auto after the reset, matching the hardware, and writing the level again takes effect in each case.
profile_peaksets a ceiling rather than a floor, so its sampled clock varies with load.
Quoted 6 lines
Suspend/resume is unaffected: high at 2771MHz before suspend, still high at 2799MHz after resume.
This is the only configuration I have available to test. The change is in generic SMU code, so it applies to every ASIC going through
smu_late_init().
The expectation is driver to restore the level. User may not be monitoring resets.
Thanks,
Lijo
Quoted 6 lines
Priya Hosur (1):
drm/amd/pm: report the default performance level after a resetdrivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++++ 1 file changed, 4 insertions(+)