All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Longepe <philippe.longepe@linux.intel.com>
To: linux-pm@vger.kernel.org
Cc: srinivas.pandruvada@linux.intel.com,
	Philippe Longepe <philippe.longepe@intel.com>
Subject: [PATCH v1 4/5] cpufreq: intel_pstate: configurable busy calculation
Date: Mon, 23 Nov 2015 14:06:43 +0100	[thread overview]
Message-ID: <1448284006-13596-9-git-send-email-philippe.longepe@linux.intel.com> (raw)
In-Reply-To: <1448284006-13596-1-git-send-email-philippe.longepe@linux.intel.com>

From: Philippe Longepe <philippe.longepe@intel.com>

Allow a configurable busy calculation which account for non C0 time
based on APERF and TSC and one via estimates.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Philippe Longepe <philippe.longepe@intel.com>
---
 drivers/cpufreq/intel_pstate.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index f9acfb0..4f08fa7 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -134,6 +134,7 @@ struct pstate_funcs {
 	int (*get_scaling)(void);
 	void (*set)(struct cpudata*, int pstate);
 	void (*get_vid)(struct cpudata *);
+	int32_t (*get_busy_percent)(struct cpudata *);
 };
 
 struct cpu_defaults {
@@ -141,6 +142,9 @@ struct cpu_defaults {
 	struct pstate_funcs funcs;
 };
 
+static inline int32_t intel_pstate_calc_scaled_busy(struct cpudata *cpu);
+static inline int32_t intel_pstate_get_scaled_busy_estimate(struct cpudata *cpu);
+
 static struct pstate_adjust_policy pid_params;
 static struct pstate_funcs pstate_funcs;
 static int hwp_active;
@@ -739,6 +743,7 @@ static struct cpu_defaults core_params = {
 		.get_turbo = core_get_turbo_pstate,
 		.get_scaling = core_get_scaling,
 		.set = core_set_pstate,
+		.get_busy_percent = intel_pstate_get_scaled_busy_estimate,
 	},
 };
 
@@ -759,6 +764,7 @@ static struct cpu_defaults silvermont_params = {
 		.set = atom_set_pstate,
 		.get_scaling = silvermont_get_scaling,
 		.get_vid = atom_get_vid,
+		.get_busy_percent = intel_pstate_calc_scaled_busy,
 	},
 };
 
@@ -779,6 +785,7 @@ static struct cpu_defaults airmont_params = {
 		.set = atom_set_pstate,
 		.get_scaling = airmont_get_scaling,
 		.get_vid = atom_get_vid,
+		.get_busy_percent = intel_pstate_calc_scaled_busy,
 	},
 };
 
@@ -798,6 +805,7 @@ static struct cpu_defaults knl_params = {
 		.get_turbo = knl_get_turbo_pstate,
 		.get_scaling = core_get_scaling,
 		.set = core_set_pstate,
+		.get_busy_percent = intel_pstate_get_scaled_busy_estimate,
 	},
 };
 
@@ -1012,7 +1020,7 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
 	from = cpu->pstate.current_pstate;
 
 	pid = &cpu->pid;
-	busy_scaled = intel_pstate_calc_scaled_busy(cpu);
+	busy_scaled = pstate_funcs.get_busy_percent(cpu);
 
 	ctl = pid_calc(pid, busy_scaled);
 
@@ -1276,6 +1284,8 @@ static void copy_cpu_funcs(struct pstate_funcs *funcs)
 	pstate_funcs.get_scaling = funcs->get_scaling;
 	pstate_funcs.set       = funcs->set;
 	pstate_funcs.get_vid   = funcs->get_vid;
+	pstate_funcs.get_busy_percent = funcs->get_busy_percent;
+
 }
 
 #if IS_ENABLED(CONFIG_ACPI)
-- 
1.9.1


  parent reply	other threads:[~2015-11-23 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 13:06 [PATCH v1 0/5] intel_pstate: Use the cpu load first on Atom only Philippe Longepe
2015-11-23 13:06 ` Philippe Longepe
2015-11-23 13:06 ` [PATCH v1 1/5] cpufreq: intel_pstate: change function name for calculation for busy Philippe Longepe
2015-11-23 13:06 ` [PATCH " Philippe Longepe
2015-11-23 13:06 ` [PATCH v1 2/5] cpufreq: intel_pstate: Rename current busy calculation function Philippe Longepe
2015-11-23 13:06 ` Philippe Longepe
2015-11-23 13:06 ` [PATCH v1 3/5] cpufreq: intel_pstate: account for non C0 time Philippe Longepe
2015-11-23 13:06 ` Philippe Longepe
2015-11-23 13:06 ` Philippe Longepe [this message]
2015-11-23 13:06 ` [PATCH v1 4/5] cpufreq: intel_pstate: configurable busy calculation Philippe Longepe
2015-11-23 13:06 ` [PATCH v1 5/5] cpufreq: intel_pstate: try load instead of busy_scaled Philippe Longepe
2015-11-23 16:10   ` Doug Smythies
2015-11-23 16:26     ` Philippe Longepe
2015-11-24  1:33   ` Doug Smythies
2015-11-23 13:06 ` Philippe Longepe

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=1448284006-13596-9-git-send-email-philippe.longepe@linux.intel.com \
    --to=philippe.longepe@linux.intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=philippe.longepe@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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.