All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: andrew-sh.cheng@mediatek.com, hsinyi@chromium.org,
	sibis@codeaurora.org, saravanak@google.com,
	myungjoo.ham@samsung.com, kyungmin.park@samsung.com,
	chanwoo@kernel.org, cwchoi00@gmail.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Saravana Kannan <skannan@codeaurora.org>
Subject: Re: [PATCH 3/4] PM / devfreq: Add cpu based scaling support to passive governor
Date: Tue, 22 Jun 2021 11:36:40 -0700	[thread overview]
Message-ID: <YNItuDsinxDCVDGa@google.com> (raw)
In-Reply-To: <20210617060546.26933-4-cw00.choi@samsung.com>

On Thu, Jun 17, 2021 at 03:05:45PM +0900, Chanwoo Choi wrote:
> From: Saravana Kannan <skannan@codeaurora.org>
> 
> Many CPU architectures have caches that can scale independent of the
> CPUs. Frequency scaling of the caches is necessary to make sure that the
> cache is not a performance bottleneck that leads to poor performance and
> power. The same idea applies for RAM/DDR.
> 
> To achieve this, this patch adds support for cpu based scaling to the
> passive governor. This is accomplished by taking the current frequency
> of each CPU frequency domain and then adjust the frequency of the cache
> (or any devfreq device) based on the frequency of the CPUs. It listens
> to CPU frequency transition notifiers to keep itself up to date on the
> current CPU frequency.
> 
> To decide the frequency of the device, the governor does one of the
> following:
> * Derives the optimal devfreq device opp from required-opps property of
>   the parent cpu opp_table.
> 
> * Scales the device frequency in proportion to the CPU frequency. So, if
>   the CPUs are running at their max frequency, the device runs at its
>   max frequency. If the CPUs are running at their min frequency, the
>   device runs at its min frequency. It is interpolated for frequencies
>   in between.
> 
> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
> [Sibi: Integrated cpu-freqmap governor into passive_governor]
> Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
> [Chanwoo: Fix conflict with latest code and clean code up]
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/devfreq/governor.h         |  22 +++
>  drivers/devfreq/governor_passive.c | 264 ++++++++++++++++++++++++++++-
>  include/linux/devfreq.h            |  16 +-
>  3 files changed, 293 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h
> index 9a9495f94ac6..3c36c92c89a9 100644
> --- a/drivers/devfreq/governor.h
> +++ b/drivers/devfreq/governor.h
> @@ -47,6 +47,28 @@
>  #define DEVFREQ_GOV_ATTR_POLLING_INTERVAL		BIT(0)
>  #define DEVFREQ_GOV_ATTR_TIMER				BIT(1)
>  
> +/**
> + * struct devfreq_cpu_data - Hold the per-cpu data
> + * @dev:	reference to cpu device.
> + * @first_cpu:	the cpumask of the first cpu of a policy.
> + * @opp_table:	reference to cpu opp table.
> + * @cur_freq:	the current frequency of the cpu.
> + * @min_freq:	the min frequency of the cpu.
> + * @max_freq:	the max frequency of the cpu.
> + *
> + * This structure stores the required cpu_data of a cpu.
> + * This is auto-populated by the governor.
> + */
> +struct devfreq_cpu_data {
> +	struct device *dev;
> +	unsigned int first_cpu;
> +
> +	struct opp_table *opp_table;
> +	unsigned int cur_freq;
> +	unsigned int min_freq;
> +	unsigned int max_freq;
> +};
> +
>  /**
>   * struct devfreq_governor - Devfreq policy governor
>   * @node:		list node - contains registered devfreq governors
> diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
> index fc09324a03e0..07e864509b7e 100644
> --- a/drivers/devfreq/governor_passive.c
> +++ b/drivers/devfreq/governor_passive.c
> @@ -8,11 +8,84 @@
>   */
>  
>  #include <linux/module.h>
> +#include <linux/cpu.h>
> +#include <linux/cpufreq.h>
> +#include <linux/cpumask.h>
> +#include <linux/slab.h>
>  #include <linux/device.h>
>  #include <linux/devfreq.h>
>  #include "governor.h"
>  
> -static int devfreq_passive_get_target_freq(struct devfreq *devfreq,
> +#define HZ_PER_KHZ	1000
> +
> +static unsigned long get_taget_freq_by_required_opp(struct device *p_dev,
> +						struct opp_table *p_opp_table,
> +						struct opp_table *opp_table,
> +						unsigned long freq)
> +{

s/get_taget_freq_by_required_opp/get_target_freq_by_required_opp/

  parent reply	other threads:[~2021-06-22 18:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210617054647epcas1p3f1ef3ddef736496151ff77df4f50749a@epcas1p3.samsung.com>
2021-06-17  6:05 ` [PATCH 0/4] PM / devfreq: Add cpu based scaling support to passive governor Chanwoo Choi
2021-06-17  6:05   ` [PATCH 1/4] PM / devfreq: passive: Fix get_target_freq when not using required-opp Chanwoo Choi
2021-06-24  1:38     ` Chanwoo Choi
2021-06-17  6:05   ` [PATCH 2/4] PM / devfreq: Export devfreq_get_freq_ragne symbol within devfreq Chanwoo Choi
2021-06-22 18:23     ` Matthias Kaehlcke
2021-07-13 19:36       ` Chanwoo Choi
2021-06-17  6:05   ` [PATCH 3/4] PM / devfreq: Add cpu based scaling support to passive governor Chanwoo Choi
2021-06-17  5:51     ` Hsin-Yi Wang
2021-06-17  6:13       ` Chanwoo Choi
2021-06-22 17:42     ` Matthias Kaehlcke
2021-06-22 18:36     ` Matthias Kaehlcke [this message]
2021-06-23 20:50     ` kernel test robot
2021-06-17  6:05   ` [PATCH 4/4] PM / devfreq: passive: Reduce duplicate code when passive_devfreq case Chanwoo Choi
2021-06-22 18:35     ` Matthias Kaehlcke
2021-07-13 19:31       ` Chanwoo Choi

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=YNItuDsinxDCVDGa@google.com \
    --to=mka@chromium.org \
    --cc=andrew-sh.cheng@mediatek.com \
    --cc=chanwoo@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=cwchoi00@gmail.com \
    --cc=hsinyi@chromium.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=saravanak@google.com \
    --cc=sibis@codeaurora.org \
    --cc=skannan@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.