From: Wyes Karny <wyes.karny@amd.com>
To: <ray.huang@amd.com>, <rafael@kernel.org>,
<viresh.kumar@linaro.org>, <srinivas.pandruvada@linux.intel.com>,
<lenb@kernel.org>
Cc: <mingo@redhat.com>, <peterz@infradead.org>,
<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>,
<dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
<bsegall@google.com>, <mgorman@suse.de>, <joel@joelfernandes.org>,
<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Wyes Karny <wyes.karny@amd.com>
Subject: [PATCH v2 0/2] cpufreq/schedutil: Fix null pointer dereference in sugov_update_single_freq
Date: Tue, 9 May 2023 18:05:01 +0000 [thread overview]
Message-ID: <20230509180503.739208-1-wyes.karny@amd.com> (raw)
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
next reply other threads:[~2023-05-09 18:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 18:05 Wyes Karny [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230509180503.739208-1-wyes.karny@amd.com \
--to=wyes.karny@amd.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=rostedt@goodmis.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®