Currently, there can't be multiple instances of single governor_type. If we have
a multi-package system, where we have multiple instances of struct policy (per
package), we can't have multiple instances of same governor. i.e. We can't have
multiple instances of ondemand governor for multiple packages.
Governors directory in sysfs is created at /sys/devices/system/cpu/cpufreq/
governor-name/. Which again reflects that there can be only one instance of a
governor_type in the system.
This is a bottleneck for multicluster system, where we want different packages
to use same governor type, but with different tunables.
This patchset is inclined towards fixing this issue.
Viresh Kumar (4):
cpufreq: Don't check cpu_online(policy->cpu)
cpufreq: stats: Get rid of CPUFREQ_STATDEVICE_ATTR
cpufreq: Add per policy governor-init/exit infrastructure
cpufreq: governor: Implement per policy instances of governors
drivers/cpufreq/cpufreq.c | 41 ++++---
drivers/cpufreq/cpufreq_conservative.c | 142 +++++++++++++----------
drivers/cpufreq/cpufreq_governor.c | 140 +++++++++++++---------
drivers/cpufreq/cpufreq_governor.h | 42 ++++---
drivers/cpufreq/cpufreq_ondemand.c | 205 +++++++++++++++++++--------------
drivers/cpufreq/cpufreq_stats.c | 18 +--
drivers/cpufreq/cpufreq_userspace.c | 2 -
drivers/cpufreq/freq_table.c | 6 -
include/linux/cpufreq.h | 26 +----
9 files changed, 346 insertions(+), 276 deletions(-)
--
1.7.12.rc2.18.g61b472e
Set devfreq device min and max frequency limits when device
is added to devfreq, provided frequency table is supplied.
This helps governors to suggest target frequency with in
limits.
Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
drivers/devfreq/devfreq.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index a8f0173..5782c9b 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -69,6 +69,29 @@ static struct devfreq *find_device_devfreq(struct device *dev)
}
/**
+ * devfreq_set_freq_limits() - Set min and max frequency from freq_table
+ * @devfreq: the devfreq instance
+ */
+static void devfreq_set_freq_limits(struct devfreq *devfreq)
+{
+ int idx;
+ unsigned long min = ~0, max = 0;
+
+ if (!devfreq->profile->freq_table)
+ return;
+
+ for (idx = 0; idx < devfreq->profile->max_state; idx++) {
+ if (min > devfreq->profile->freq_table[idx])
+ min = devfreq->profile->freq_table[idx];
+ if (max < devfreq->profile->freq_table[idx])
+ max = devfreq->profile->freq_table[idx];
+ }
+
+ devfreq->min_freq = min;
+ devfreq->max_freq = max;
+}
+
+/**
* devfreq_get_freq_level() - Lookup freq_table for the frequency
* @devfreq: the devfreq instance
* @freq: the target frequency
@@ -476,6 +499,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq->profile->max_state,
GFP_KERNEL);
devfreq->last_stat_updated = jiffies;
+ devfreq_set_freq_limits(devfreq);
dev_set_name(&devfreq->dev, dev_name(dev));
err = device_register(&devfreq->dev);
--
1.7.10.4
For multicore SoC's, with cores sharing clock line, we are required to set
policy->cpus and policy->related_cpus with mask of cpus.
With following patch, we need to set policy->cpus with mask of all possible cpus
and policy->related_cpus would be filled automatically by the cpufreq core.
commit 4948b355e90080cd5ec1e91189f65a01e4186ef2
Author: Viresh Kumar <viresh.kumar(a)linaro.org>
Date: Tue Jan 29 14:39:08 2013 +0000
cpufreq: Simplify cpufreq_add_dev()
Current Tegra driver fills only ->related_cpus and not ->cpus, which looks to be
incorrect. Lets fix it.
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
Cc: Stephen Warren <swarren(a)nvidia.com>
---
arch/arm/mach-tegra/cpu-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index a74d3c7..e7ddcb2 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -244,7 +244,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = 300 * 1000;
policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
- cpumask_copy(policy->related_cpus, cpu_possible_mask);
+ cpumask_copy(policy->cpus, cpu_possible_mask);
if (policy->cpu == 0)
register_pm_notifier(&tegra_cpu_pm_notifier);
--
1.7.12.rc2.18.g61b472e
This patchset does some cleanup. It could have been folded in a single
patch but the review would have been less clean than splitting it into
small and trivial patches.
The main purpose of this patch is to remove the usage of the driver_data
field from the state_usage structure. Len Brown is doing this cleanup in
the intel_idle.c file. With this patchset, the processor_idle.c file will
be the last user of this field.
Also, the patchset simplify the code and makes it a bit more clear to read.
I don't have this hardware, the code is not tested.
Daniel Lezcano (4):
davinci: cpuidle - use global variable for ddr2 flag
davinci: cpuidle - move code to prevent forward declaration
davinci: cpuidle - remove the ops
davinci: cpuidle - remove useless initialization
arch/arm/mach-davinci/cpuidle.c | 84 ++++++++++++---------------------------
1 file changed, 25 insertions(+), 59 deletions(-)
--
1.7.9.5
On 02/02/2013 03:16 AM, Len Brown wrote:
>
>>> intel_idle already uses a driver-specific flag:
>>>
>>> #define CPUIDLE_FLAG_TLB_FLUSHED 0x10000
>>>
>>> This patch just uses 4 more bits along with that one.
>>
>> Ok. In this case it would make sense to move this flag out of the
>> generic core code to the intel_idle.c file ?
>
> This flag is already local to intel_idle.c.
> If another architecture finds it useful,
> then yes, it would make sense to move it to the shared header.
Oh, right. Sorry I puzzled myself with the name. I was convinced it was
in the shared header.
>> and move the [dec/en]coding
>> macro flags_2_MWAIT_EAX and MWAIT_EAX_2_flags (with a more appropriate
>> name for a generic code) to the cpuidle.h file ?
>
> I think that a driver's private flag definitions
> should remain local to the driver. It makes no sense
> to pollute the name space of other drivers for stuff
> that doesn't mean anything to them. MWAIT is pretty
> specific to x86 -- and re-naming it to something 'generic'
> isn't going to make the code easier to read.
Ok, let me rephrase it because I think how it was presented was not clear.
As we want to use the half of the state flags for private purpose, I
suggested to add the encoding/decoding function in the shared header file.
The mwait eax flags are not encoded and the CPUIDLE_FLAG_TLB_FLUSHED is
encoded.
I suggested to unify both and to use an encoding function from the
shared header file.
#define CPUIDLE_PRIVATE_FLAGS(_flags_) \
((_flags_) << 16) & CPUIDLE_DRIVER_FLAGS_MASK
For example:
#define FLAG_TLB_FLUSHED CPUIDLE_PRIVATE_FLAGS(0x1)
#define FLAG_MWAIT_C1 CPUIDLE_PRIVATE_FLAGS(0x0)
#define FLAG_MWAIT_C2 CPUIDLE_PRIVATE_FLAGS(0x10)
#define FLAG_MWAIT_C3 CPUIDLE_PRIVATE_FLAGS(0x20)
#define FLAG_MWAIT_C4 CPUIDLE_PRIVATE_FLAGS(0x30)
#define FLAG_MWAIT_C5 CPUIDLE_PRIVATE_FLAGS(0x40)
#define FLAG_MWAIT_C6 CPUIDLE_PRIVATE_FLAGS(0x52)
And then:
...
.flags = FLAG_TLB_FLUSHED | FLAG_MWAIT_C2 | CPUIDLE_FLAG_TIME_VALID
...
But in the idle function, you need to retrieve the 'value' of the EAX
not a flag, so there is the need for an extra macro conversion and mask
the TLB flag.
Well, this is a detail, so feel free to ignore this suggestion :)
Thanks
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
These patches are against the v3.8-rc4.
Guenter Roeck, Jean Delvare,
Please help to have a look at this.
Samuel Ortiz,
Please review 1/2 and leave your Acked-by: if no problem, I think these patches
should be merged into HWMON tree.
Thanks for all.
Hongbo Zhang (2):
ARM: ux500: rename ab8500 to abx500 for hwmon driver
hwmon: add ST-Ericsson ABX500 hwmon driver
drivers/hwmon/Kconfig | 13 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/ab8500.c | 160 +++++++++++
drivers/hwmon/abx500.c | 681 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/hwmon/abx500.h | 88 ++++++
drivers/mfd/ab8500-core.c | 6 +-
6 files changed, 946 insertions(+), 3 deletions(-)
create mode 100644 drivers/hwmon/ab8500.c
create mode 100644 drivers/hwmon/abx500.c
create mode 100644 drivers/hwmon/abx500.h
--
1.8.0