public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] cpufreq/schedutil: Fix null pointer dereference in sugov_update_single_freq
@ 2023-05-09 18:05 Wyes Karny
  2023-05-09 18:05 ` [PATCH v2 1/2] cpufreq/schedutil: Remove fast_switch_possible flag if driver doesn't set fast_switch Wyes Karny
  2023-05-09 18:05 ` [PATCH v2 2/2] amd_pstate: Add ->fast_switch() callback Wyes Karny
  0 siblings, 2 replies; 8+ messages in thread
From: Wyes Karny @ 2023-05-09 18:05 UTC (permalink / raw)
  To: ray.huang, rafael, viresh.kumar, srinivas.pandruvada, lenb
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, joel, linux-pm, linux-kernel,
	Wyes Karny

Currently, amd_pstate only uses `adjust_perf` and `target` callback
functions to get the frequency/effective utilization data from scaling
governors.  Schedutil generally avoids calling `target` and `fast_switch`
functions if `adjust_perf` function pointer is set for the driver. But in
some rare cases, schedutil tries to call `fast_switch` function even the
function pointer is not set. This happens when frequency invariance is
turned off.  When frequency invariance is turned off schedutil falls
back to `sugov_update_single_freq` which currently relies on the
`fast_switch` callback.

Currently, frequency invariance is turned off when any anomaly is
detected with aperf/mperf readings. Which triggers this problem.

Fix this by disabling `fast_switch_enabled` flag if `fast_switch`
callback is not set and removing `fast_switch_enabled` flag dependency
for adjust_perf callback.  But this will force schedutil to take a slower
path to update frequency.  Therefore to fix this add fast_switch
function on amd_pstate to take advantage of fast frequency update.

Changelog:
v1 -> v2
- Remove fast_switch_enabled flag dependency for adjust_perf callback

v1: https://lore.kernel.org/linux-pm/20230410095045.14872-1-wyes.karny@amd.com/

Gautham R. Shenoy (1):
  amd_pstate: Add ->fast_switch() callback

Wyes Karny (1):
  cpufreq/schedutil: Remove fast_switch_possible flag if driver doesn't
    set fast_switch

 drivers/cpufreq/amd-pstate.c     | 46 +++++++++++++++++++++++++-------
 drivers/cpufreq/cpufreq.c        | 20 +++++++++++++-
 drivers/cpufreq/intel_pstate.c   |  3 +--
 include/linux/cpufreq.h          |  1 +
 kernel/sched/cpufreq_schedutil.c |  2 +-
 5 files changed, 59 insertions(+), 13 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-12 12:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 18:05 [PATCH v2 0/2] cpufreq/schedutil: Fix null pointer dereference in sugov_update_single_freq Wyes Karny
2023-05-09 18:05 ` [PATCH v2 1/2] cpufreq/schedutil: Remove fast_switch_possible flag if driver doesn't set fast_switch Wyes Karny
2023-05-09 18:18   ` Rafael J. Wysocki
2023-05-09 18:39     ` Rafael J. Wysocki
2023-05-10  5:42       ` Wyes Karny
2023-05-10 12:24         ` Rafael J. Wysocki
2023-05-12 12:26     ` Wyes Karny
2023-05-09 18:05 ` [PATCH v2 2/2] amd_pstate: Add ->fast_switch() callback Wyes Karny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox