From: Francisco Jerez <currojerez@riseup.net>
To: linux-pm@vger.kernel.org, intel-gfx@lists.freedesktop.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Eero Tamminen <eero.t.tamminen@intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: [PATCH 8/9] OPTIONAL: cpufreq/intel_pstate: Expose LP controller parameters via debugfs.
Date: Tue, 27 Mar 2018 23:38:44 -0700 [thread overview]
Message-ID: <20180328063845.4884-9-currojerez@riseup.net> (raw)
In-Reply-To: <20180328063845.4884-1-currojerez@riseup.net>
This is not required for the controller to work but has proven very
useful for debugging and testing of alternative heuristic parameters,
which may offer a better trade-off between energy efficiency and
latency -- The default parameters are rather aggressively
latency-minimizing in order to keep up with the big-core controller
and avoid regressions in latency-sensitive applications, however a
more energy-efficient trade-off may be preferable in practice. E.g.:
{
.sample_interval_ms = 10,
.setpoint_pml = 700,
.p_base_avg_hz = 3,
.io_active_threshold_pml = 950,
.io_active_avg_hz = 10
}
A warning is printed out which should taint the kernel for the
non-standard calibration of the heuristic to be obvious in bug
reports.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
---
drivers/cpufreq/intel_pstate.c | 90 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index d0e212387755..7b1666c34273 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -862,6 +862,92 @@ static void intel_pstate_update_policies(void)
cpufreq_update_policy(cpu);
}
+/************************** debugfs begin ************************/
+static void intel_pstate_lp_reset(struct cpudata *cpu);
+
+static int lp_param_set(void *data, u64 val)
+{
+ unsigned int cpu;
+
+ *(u32 *)data = val;
+ for_each_possible_cpu(cpu) {
+ if (all_cpu_data[cpu])
+ intel_pstate_lp_reset(all_cpu_data[cpu]);
+ }
+
+ WARN_ONCE(1, "Unsupported P-state LP parameter update via debugging interface");
+
+ return 0;
+}
+
+static int lp_param_get(void *data, u64 *val)
+{
+ *val = *(u32 *)data;
+ return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(fops_lp_param, lp_param_get, lp_param_set, "%llu\n");
+
+static struct dentry *debugfs_parent;
+
+struct lp_param {
+ char *name;
+ void *value;
+ struct dentry *dentry;
+};
+
+static struct lp_param lp_files[] = {
+ {"lp_sample_interval_ms", &lp_params.sample_interval_ms, },
+ {"lp_setpoint_pml", &lp_params.setpoint_pml, },
+ {"lp_p_base_avg_hz", &lp_params.p_base_avg_hz, },
+ {"lp_io_active_threshold_pml", &lp_params.io_active_threshold_pml, },
+ {"lp_io_active_avg_hz", &lp_params.io_active_avg_hz, },
+ {NULL, NULL, }
+};
+
+static void intel_pstate_update_util_lp(struct update_util_data *data,
+ u64 time, unsigned int flags);
+
+static void intel_pstate_debug_expose_params(void)
+{
+ int i;
+
+ if (hwp_active ||
+ pstate_funcs.update_util != intel_pstate_update_util_lp)
+ return;
+
+ debugfs_parent = debugfs_create_dir("pstate_snb", NULL);
+ if (IS_ERR_OR_NULL(debugfs_parent))
+ return;
+
+ for (i = 0; lp_files[i].name; i++) {
+ struct dentry *dentry;
+
+ dentry = debugfs_create_file(lp_files[i].name, 0660,
+ debugfs_parent, lp_files[i].value,
+ &fops_lp_param);
+ if (!IS_ERR(dentry))
+ lp_files[i].dentry = dentry;
+ }
+}
+
+static void intel_pstate_debug_hide_params(void)
+{
+ int i;
+
+ if (IS_ERR_OR_NULL(debugfs_parent))
+ return;
+
+ for (i = 0; lp_files[i].name; i++) {
+ debugfs_remove(lp_files[i].dentry);
+ lp_files[i].dentry = NULL;
+ }
+
+ debugfs_remove(debugfs_parent);
+ debugfs_parent = NULL;
+}
+
+/************************** debugfs end ************************/
+
/************************** sysfs begin ************************/
#define show_one(file_name, object) \
static ssize_t show_##file_name \
@@ -2423,6 +2509,8 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
global.min_perf_pct = min_perf_pct_min();
+ intel_pstate_debug_expose_params();
+
return 0;
}
@@ -2431,6 +2519,8 @@ static int intel_pstate_unregister_driver(void)
if (hwp_active)
return -EBUSY;
+ intel_pstate_debug_hide_params();
+
cpufreq_unregister_driver(intel_pstate_driver);
intel_pstate_driver_cleanup();
--
2.16.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-03-28 6:38 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 6:38 [PATCH 0/9] GPU-bound energy efficiency improvements for the intel_pstate driver Francisco Jerez
2018-03-28 6:38 ` [PATCH 1/9] cpufreq: Implement infrastructure keeping track of aggregated IO active time Francisco Jerez
2018-03-28 6:38 ` [PATCH 2/9] Revert "cpufreq: intel_pstate: Replace bxt_funcs with core_funcs" Francisco Jerez
2018-03-28 6:38 ` [PATCH 3/9] Revert "cpufreq: intel_pstate: Shorten a couple of long names" Francisco Jerez
2018-03-28 6:38 ` [PATCH 4/9] Revert "cpufreq: intel_pstate: Simplify intel_pstate_adjust_pstate()" Francisco Jerez
2018-03-28 6:38 ` [PATCH 5/9] Revert "cpufreq: intel_pstate: Drop ->update_util from pstate_funcs" Francisco Jerez
2018-03-28 6:38 ` [PATCH 6/9] cpufreq/intel_pstate: Implement variably low-pass filtering controller for small core Francisco Jerez
2018-03-28 6:38 ` [PATCH 7/9] SQUASH: cpufreq/intel_pstate: Enable LP controller based on ACPI FADT profile Francisco Jerez
2018-03-28 6:38 ` Francisco Jerez [this message]
2018-03-28 6:38 ` [PATCH 9/9] drm/i915/execlists: Report GPU rendering as IO activity to cpufreq Francisco Jerez
2018-03-28 8:02 ` Chris Wilson
2018-03-28 18:55 ` Francisco Jerez
2018-03-28 19:20 ` Chris Wilson
2018-03-28 23:19 ` Chris Wilson
2018-03-29 0:32 ` Francisco Jerez
2018-03-29 1:01 ` Chris Wilson
2018-03-29 1:20 ` Chris Wilson
2018-03-30 18:50 ` [PATCH 0/9] GPU-bound energy efficiency improvements for the intel_pstate driver Francisco Jerez
2018-04-10 22:28 ` Francisco Jerez
2018-04-11 3:14 ` Srinivas Pandruvada
2018-04-11 16:10 ` Francisco Jerez
2018-04-11 16:26 ` Francisco Jerez
2018-04-11 17:35 ` Juri Lelli
2018-04-12 21:38 ` Francisco Jerez
2018-04-12 6:17 ` Srinivas Pandruvada
2018-04-14 2:00 ` Francisco Jerez
2018-04-14 4:01 ` Srinivas Pandruvada
2018-04-16 14:04 ` Eero Tamminen
2018-04-16 17:27 ` Srinivas Pandruvada
2018-04-12 8:58 ` Peter Zijlstra
2018-04-12 18:34 ` Francisco Jerez
2018-04-12 19:33 ` Peter Zijlstra
2018-04-12 19:55 ` Francisco Jerez
2018-04-13 18:15 ` Peter Zijlstra
2018-04-14 1:57 ` Francisco Jerez
2018-04-14 9:49 ` Peter Zijlstra
2018-04-17 14:03 ` Chris Wilson
2018-04-17 15:34 ` Srinivas Pandruvada
2018-04-17 19:27 ` Francisco Jerez
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=20180328063845.4884-9-currojerez@riseup.net \
--to=currojerez@riseup.net \
--cc=eero.t.tamminen@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).