[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230410095045.14872-1-wyes.karny@amd.com>
Date: Mon, 10 Apr 2023 09:50:43 +0000
From: Wyes Karny <wyes.karny@....com>
To: <ray.huang@....com>, <rafael@...nel.org>, <viresh.kumar@...aro.org>
CC: <mingo@...hat.com>, <peterz@...radead.org>,
<juri.lelli@...hat.com>, <vincent.guittot@...aro.org>,
<dietmar.eggemann@....com>, <rostedt@...dmis.org>,
<bsegall@...gle.com>, <mgorman@...e.de>, <bristot@...hat.com>,
<vschneid@...hat.com>, <joel@...lfernandes.org>,
<gautham.shenoy@....com>, <linux-pm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Wyes Karny <wyes.karny@....com>
Subject: [PATCH 0/2] cpufreq/schedutil: Fix null pointer dereference in sugov_update_single_freq
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 adding a NULL check before calling `fast_switch` in
`sugov_update_single_freq`. 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.
Gautham R. Shenoy (1):
amd_pstate: Add ->fast_switch() callback
Wyes Karny (1):
cpufreq/schedutil: Add fast_switch callback check
drivers/cpufreq/amd-pstate.c | 33 ++++++++++++++++++++++++++------
drivers/cpufreq/cpufreq.c | 11 +++++++++++
include/linux/cpufreq.h | 1 +
kernel/sched/cpufreq_schedutil.c | 2 +-
4 files changed, 40 insertions(+), 7 deletions(-)
--
2.34.1
Powered by blists - more mailing lists