cpufreq/amd-pstate: Fix null pointer dereference when frequency invariance is disabled
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest3 patches 4 repliesIn review
- v32 patches 3 repliesSuperseded
Changes in v4 from the cover letter
- Add extra patch to remove fast_switch_possible flag from amd_pstate active mode driver.
- Fail to load such drivers which sets fast_switch_possible flag but not fast_switch.
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | amd_pstate: Add ->fast_switch() callbackdrivers/ | +30 | 2 replies | |
| 2/3 | cpufreq/amd-pstate: Remove fast_switch_possible flag from active driverdrivers/ | +0 | 0 replies | |
| 3/3 | cpufreq: Return failure if fast_switch is not set and fast_switch_possible is setdrivers/ include/ | +8 | 4 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH v4 0/3] cpufreq/amd-pstate: Fix null pointer dereference when frequency invariance is disabled
Currently, amd_pstate only uses adjust_perf and target callback functions to get the frequency/effective utilization data from scaling governors. But the governor can switch back to fast_switch (as fast_switch_possible is set) when frequency invariance is disabled. In that case, if the driver didn't set fast_switch function pointer, null pointer dereference can happen and the kernel will crash.
Currently, frequency invariance is turned off when any anomaly is detected with aperf/mperf readings. Which triggers this problem.
Fix this by adding fast_switch function in the amd_pstate driver.
The same problem could arise with any scaling driver which doesn't set fast_switch but sets fast_switch_possible. Return failure while loading such drivers.
Changelog:
v3 -> v4:
- Add extra patch to remove fast_switch_possible flag from amd_pstate active mode driver.
- Fail to load such drivers which sets fast_switch_possible flag but not fast_switch.
v2 -> v3
- Add fast_switch callback in amd_pstate and warn if any driver sets fast_swich_possible flag but not fast_switch function pointer.
v1 -> v2
- Remove fast_switch_enabled flag dependency for adjust_perf callback
v1: https://lore.kernel.org/linux-pm/[email protected]/
v2: https://lore.kernel.org/linux-pm/[email protected]/
v3: https://lore.kernel.org/lkml/[email protected]/
Gautham R. Shenoy (1):
amd_pstate: Add ->fast_switch() callback
Wyes Karny (2):
cpufreq/amd-pstate: Remove fast_switch_possible flag from active
driver
cpufreq: Return failure if fast_switch is not set and
fast_switch_possible is set
drivers/cpufreq/amd-pstate.c | 38 ++++++++++++++++++++++++++++-------- drivers/cpufreq/cpufreq.c | 5 +++++ include/linux/cpufreq.h | 4 +++- 3 files changed, 38 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1