summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/cpu-tegra3.c
diff options
context:
space:
mode:
authorXiao Bo Zhao <xiaoboz@nvidia.com>2012-07-09 14:53:18 -0700
committerSimone Willett <swillett@nvidia.com>2012-07-30 20:46:43 -0700
commit4bf13aec557cea6d36247b1a561321066fc9ed76 (patch)
treed57a3d1276a598f774264836dc122441a1cf2663 /arch/arm/mach-tegra/cpu-tegra3.c
parentda93e26a4e7aca61db257f8aae75df5740e57a3b (diff)
arm: tegra: Added sysfs knobs for RT thresholds
Added different bias levels to RT and added the option to modify the bias level through sysfs knobs Bug 1003531 Reviewed-on: http://git-master/r/114271 Reviewed-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Tested-by: Xiao Bo Zhao <xiaoboz@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> (cherry picked from commit 654bc674034f384d8826806fb443d4e9c67b9b3b) Change-Id: I2e647a65fb89926dd9f0b2ac3edc3dca8eb659a1 Reviewed-on: http://git-master/r/118201 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Aleksandr Frid <afrid@nvidia.com> Tested-by: Xiao Bo Zhao <xiaoboz@nvidia.com> Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com> Reviewed-by: Sai Gurrappadi <sgurrappadi@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/cpu-tegra3.c')
-rw-r--r--arch/arm/mach-tegra/cpu-tegra3.c58
1 files changed, 53 insertions, 5 deletions
diff --git a/arch/arm/mach-tegra/cpu-tegra3.c b/arch/arm/mach-tegra/cpu-tegra3.c
index 051381297f6f..e833680617cf 100644
--- a/arch/arm/mach-tegra/cpu-tegra3.c
+++ b/arch/arm/mach-tegra/cpu-tegra3.c
@@ -3,7 +3,7 @@
*
* CPU auto-hotplug for Tegra3 CPUs
*
- * Copyright (c) 2011-2012, NVIDIA Corporation.
+ * Copyright (c) 2011-2012, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -189,10 +189,33 @@ enum {
};
#define NR_FSHIFT 2
-static unsigned int nr_run_thresholds[] = {
+
+static unsigned int rt_profile_sel;
+
+/* avg run threads * 4 (e.g., 9 = 2.25 threads) */
+
+static unsigned int rt_profile_default[] = {
+/* 1, 2, 3, 4 - on-line cpus target */
+ 5, 9, 10, UINT_MAX
+};
+
+static unsigned int rt_profile_1[] = {
/* 1, 2, 3, 4 - on-line cpus target */
- 5, 9, 10, UINT_MAX /* avg run threads * 4 (e.g., 9 = 2.25 threads) */
+ 8, 9, 10, UINT_MAX
};
+
+static unsigned int rt_profile_2[] = {
+/* 1, 2, 3, 4 - on-line cpus target */
+ 5, 13, 14, UINT_MAX
+};
+
+static unsigned int *rt_profiles[] = {
+ rt_profile_default,
+ rt_profile_1,
+ rt_profile_2
+};
+
+
static unsigned int nr_run_hysteresis = 2; /* 0.5 thread */
static unsigned int nr_run_last;
@@ -216,8 +239,10 @@ static noinline int tegra_cpu_speed_balance(void)
* TEGRA_CPU_SPEED_BIASED to keep CPU core composition unchanged
* TEGRA_CPU_SPEED_SKEWED to remove CPU core off-line
*/
- for (nr_run = 1; nr_run < ARRAY_SIZE(nr_run_thresholds); nr_run++) {
- unsigned int nr_threshold = nr_run_thresholds[nr_run - 1];
+
+ unsigned int *current_profile = rt_profiles[rt_profile_sel];
+ for (nr_run = 1; nr_run < ARRAY_SIZE(rt_profile_default); nr_run++) {
+ unsigned int nr_threshold = current_profile[nr_run - 1];
if (nr_run_last <= nr_run)
nr_threshold += nr_run_hysteresis;
if (avg_nr_run <= (nr_threshold << (FSHIFT - NR_FSHIFT)))
@@ -527,6 +552,25 @@ static const struct file_operations hp_stats_fops = {
.release = single_release,
};
+static int rt_bias_get(void *data, u64 *val)
+{
+ *val = rt_profile_sel;
+ return 0;
+}
+static int rt_bias_set(void *data, u64 val)
+{
+ if (val < ARRAY_SIZE(rt_profiles))
+ rt_profile_sel = (u32)val;
+
+ pr_debug("rt_profile_sel set to %d\nthresholds are now [%d, %d, %d]\n",
+ rt_profile_sel,
+ rt_profiles[rt_profile_sel][0],
+ rt_profiles[rt_profile_sel][1],
+ rt_profiles[rt_profile_sel][2]);
+ return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(rt_bias_fops, rt_bias_get, rt_bias_set, "%llu\n");
+
static int min_cpus_get(void *data, u64 *val)
{
*val = pm_qos_request(PM_QOS_MIN_ONLINE_CPUS);
@@ -577,6 +621,10 @@ static int __init tegra_auto_hotplug_debug_init(void)
"stats", S_IRUGO, hp_debugfs_root, NULL, &hp_stats_fops))
goto err_out;
+ if (!debugfs_create_file(
+ "core_bias", S_IRUGO, hp_debugfs_root, NULL, &rt_bias_fops))
+ goto err_out;
+
return 0;
err_out: