Commit 702ed6ef authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq

* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] Fix sysfs_create_file return value handling
  [CPUFREQ] ondemand: fix tickless accounting and software coordination bug
  [CPUFREQ] ondemand: add a check to avoid negative load calculation
  [CPUFREQ] Keep userspace governor quiet when it is not being used
  [CPUFREQ] Longhaul - Proper register access
  [CPUFREQ] Kconfig powernow-k8 driver should depend on ACPI P-States driver
  [CPUFREQ] Longhaul - Replace ACPI functions with direct I/O
  [CPUFREQ] Longhaul - Remove duplicate multipliers
  [CPUFREQ] Longhaul - Embedded "conservative"
  [CPUFREQ] acpi-cpufreq: Proper ReadModifyWrite of PERF_CTL MSR
  [CPUFREQ] check return value of sysfs_create_file
  [CPUFREQ] Longhaul - Check ACPI "BM DMA in progress" bit
  [CPUFREQ] Longhaul - Move old_ratio to correct place
  [CPUFREQ] Longhaul - VT8237 support
  [CPUFREQ] Longhaul - Use all kinds of support
  [CPUFREQ] powernow-k8: clarify number of cores.
parents 2f41fc80 58a7295b
...@@ -90,10 +90,17 @@ config X86_POWERNOW_K8 ...@@ -90,10 +90,17 @@ config X86_POWERNOW_K8
If in doubt, say N. If in doubt, say N.
config X86_POWERNOW_K8_ACPI config X86_POWERNOW_K8_ACPI
bool bool "ACPI Support"
depends on X86_POWERNOW_K8 && ACPI_PROCESSOR select ACPI_PROCESSOR
depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m) depends on X86_POWERNOW_K8
default y default y
help
This provides access to the K8s Processor Performance States via ACPI.
This driver is probably required for CPUFreq to work with multi-socket and
SMP systems. It is not required on at least some single-socket yet
multi-core systems, even if SMP is enabled.
It is safe to say Y here.
config X86_GX_SUSPMOD config X86_GX_SUSPMOD
tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
......
...@@ -167,11 +167,13 @@ static void do_drv_read(struct drv_cmd *cmd) ...@@ -167,11 +167,13 @@ static void do_drv_read(struct drv_cmd *cmd)
static void do_drv_write(struct drv_cmd *cmd) static void do_drv_write(struct drv_cmd *cmd)
{ {
u32 h = 0; u32 lo, hi;
switch (cmd->type) { switch (cmd->type) {
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
wrmsr(cmd->addr.msr.reg, cmd->val, h); rdmsr(cmd->addr.msr.reg, lo, hi);
lo = (lo & ~INTEL_MSR_RANGE) | (cmd->val & INTEL_MSR_RANGE);
wrmsr(cmd->addr.msr.reg, lo, hi);
break; break;
case SYSTEM_IO_CAPABLE: case SYSTEM_IO_CAPABLE:
acpi_os_write_port((acpi_io_address)cmd->addr.io.port, acpi_os_write_port((acpi_io_address)cmd->addr.io.port,
...@@ -372,7 +374,6 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, ...@@ -372,7 +374,6 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
cpumask_t online_policy_cpus; cpumask_t online_policy_cpus;
struct drv_cmd cmd; struct drv_cmd cmd;
unsigned int msr;
unsigned int next_state = 0; /* Index into freq_table */ unsigned int next_state = 0; /* Index into freq_table */
unsigned int next_perf_state = 0; /* Index into perf table */ unsigned int next_perf_state = 0; /* Index into perf table */
unsigned int i; unsigned int i;
...@@ -417,11 +418,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, ...@@ -417,11 +418,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
cmd.type = SYSTEM_INTEL_MSR_CAPABLE; cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
cmd.addr.msr.reg = MSR_IA32_PERF_CTL; cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
msr = cmd.val = (u32) perf->states[next_perf_state].control;
(u32) perf->states[next_perf_state].
control & INTEL_MSR_RANGE;
cmd.val = get_cur_val(online_policy_cpus);
cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;
break; break;
case SYSTEM_IO_CAPABLE: case SYSTEM_IO_CAPABLE:
cmd.type = SYSTEM_IO_CAPABLE; cmd.type = SYSTEM_IO_CAPABLE;
......
This diff is collapsed.
...@@ -180,7 +180,7 @@ static const int __initdata ezrat_clock_ratio[32] = { ...@@ -180,7 +180,7 @@ static const int __initdata ezrat_clock_ratio[32] = {
-1, /* 0000 -> RESERVED (10.0x) */ -1, /* 0000 -> RESERVED (10.0x) */
110, /* 0001 -> 11.0x */ 110, /* 0001 -> 11.0x */
120, /* 0010 -> 12.0x */ -1, /* 0010 -> 12.0x */
-1, /* 0011 -> RESERVED (9.0x)*/ -1, /* 0011 -> RESERVED (9.0x)*/
105, /* 0100 -> 10.5x */ 105, /* 0100 -> 10.5x */
115, /* 0101 -> 11.5x */ 115, /* 0101 -> 11.5x */
...@@ -237,7 +237,7 @@ static const int __initdata ezrat_eblcr[32] = { ...@@ -237,7 +237,7 @@ static const int __initdata ezrat_eblcr[32] = {
static const int __initdata nehemiah_clock_ratio[32] = { static const int __initdata nehemiah_clock_ratio[32] = {
100, /* 0000 -> 10.0x */ 100, /* 0000 -> 10.0x */
160, /* 0001 -> 16.0x */ -1, /* 0001 -> 16.0x */
40, /* 0010 -> 4.0x */ 40, /* 0010 -> 4.0x */
90, /* 0011 -> 9.0x */ 90, /* 0011 -> 9.0x */
95, /* 0100 -> 9.5x */ 95, /* 0100 -> 9.5x */
...@@ -252,10 +252,10 @@ static const int __initdata nehemiah_clock_ratio[32] = { ...@@ -252,10 +252,10 @@ static const int __initdata nehemiah_clock_ratio[32] = {
75, /* 1101 -> 7.5x */ 75, /* 1101 -> 7.5x */
85, /* 1110 -> 8.5x */ 85, /* 1110 -> 8.5x */
120, /* 1111 -> 12.0x */ 120, /* 1111 -> 12.0x */
100, /* 0000 -> 10.0x */ -1, /* 0000 -> 10.0x */
110, /* 0001 -> 11.0x */ 110, /* 0001 -> 11.0x */
120, /* 0010 -> 12.0x */ -1, /* 0010 -> 12.0x */
90, /* 0011 -> 9.0x */ -1, /* 0011 -> 9.0x */
105, /* 0100 -> 10.5x */ 105, /* 0100 -> 10.5x */
115, /* 0101 -> 11.5x */ 115, /* 0101 -> 11.5x */
125, /* 0110 -> 12.5x */ 125, /* 0110 -> 12.5x */
...@@ -267,7 +267,7 @@ static const int __initdata nehemiah_clock_ratio[32] = { ...@@ -267,7 +267,7 @@ static const int __initdata nehemiah_clock_ratio[32] = {
145, /* 1100 -> 14.5x */ 145, /* 1100 -> 14.5x */
155, /* 1101 -> 15.5x */ 155, /* 1101 -> 15.5x */
-1, /* 1110 -> RESERVED (13.0x) */ -1, /* 1110 -> RESERVED (13.0x) */
120, /* 1111 -> 12.0x */ -1, /* 1111 -> 12.0x */
}; };
static const int __initdata nehemiah_eblcr[32] = { static const int __initdata nehemiah_eblcr[32] = {
......
...@@ -1330,8 +1330,9 @@ static int __cpuinit powernowk8_init(void) ...@@ -1330,8 +1330,9 @@ static int __cpuinit powernowk8_init(void)
if (supported_cpus == num_online_cpus()) { if (supported_cpus == num_online_cpus()) {
printk(KERN_INFO PFX "Found %d %s " printk(KERN_INFO PFX "Found %d %s "
"processors (" VERSION ")\n", supported_cpus, "processors (%d cpu cores) (" VERSION ")\n",
boot_cpu_data.x86_model_id); supported_cpus/cpu_data[0].booted_cores,
boot_cpu_data.x86_model_id, supported_cpus);
return cpufreq_register_driver(&cpufreq_amd64_driver); return cpufreq_register_driver(&cpufreq_amd64_driver);
} }
......
...@@ -826,13 +826,21 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) ...@@ -826,13 +826,21 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
/* set up files for this cpu device */ /* set up files for this cpu device */
drv_attr = cpufreq_driver->attr; drv_attr = cpufreq_driver->attr;
while ((drv_attr) && (*drv_attr)) { while ((drv_attr) && (*drv_attr)) {
sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
if (ret)
goto err_out_driver_exit;
drv_attr++; drv_attr++;
} }
if (cpufreq_driver->get) if (cpufreq_driver->get){
sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
if (cpufreq_driver->target) if (ret)
sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); goto err_out_driver_exit;
}
if (cpufreq_driver->target){
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
if (ret)
goto err_out_driver_exit;
}
spin_lock_irqsave(&cpufreq_driver_lock, flags); spin_lock_irqsave(&cpufreq_driver_lock, flags);
for_each_cpu_mask(j, policy->cpus) { for_each_cpu_mask(j, policy->cpus) {
......
...@@ -96,15 +96,25 @@ static struct dbs_tuners { ...@@ -96,15 +96,25 @@ static struct dbs_tuners {
static inline cputime64_t get_cpu_idle_time(unsigned int cpu) static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
{ {
cputime64_t retval; cputime64_t idle_time;
cputime64_t cur_jiffies;
cputime64_t busy_time;
retval = cputime64_add(kstat_cpu(cpu).cpustat.idle, cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
kstat_cpu(cpu).cpustat.iowait); busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user,
kstat_cpu(cpu).cpustat.system);
if (dbs_tuners_ins.ignore_nice) busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq);
retval = cputime64_add(retval, kstat_cpu(cpu).cpustat.nice); busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq);
busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal);
return retval; if (!dbs_tuners_ins.ignore_nice) {
busy_time = cputime64_add(busy_time,
kstat_cpu(cpu).cpustat.nice);
}
idle_time = cputime64_sub(cur_jiffies, busy_time);
return idle_time;
} }
/* /*
...@@ -325,7 +335,7 @@ static struct attribute_group dbs_attr_group = { ...@@ -325,7 +335,7 @@ static struct attribute_group dbs_attr_group = {
static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
{ {
unsigned int idle_ticks, total_ticks; unsigned int idle_ticks, total_ticks;
unsigned int load; unsigned int load = 0;
cputime64_t cur_jiffies; cputime64_t cur_jiffies;
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
...@@ -339,7 +349,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) ...@@ -339,7 +349,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
cur_jiffies = jiffies64_to_cputime64(get_jiffies_64()); cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
total_ticks = (unsigned int) cputime64_sub(cur_jiffies, total_ticks = (unsigned int) cputime64_sub(cur_jiffies,
this_dbs_info->prev_cpu_wall); this_dbs_info->prev_cpu_wall);
this_dbs_info->prev_cpu_wall = cur_jiffies; this_dbs_info->prev_cpu_wall = get_jiffies_64();
if (!total_ticks) if (!total_ticks)
return; return;
/* /*
...@@ -370,6 +381,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) ...@@ -370,6 +381,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
if (tmp_idle_ticks < idle_ticks) if (tmp_idle_ticks < idle_ticks)
idle_ticks = tmp_idle_ticks; idle_ticks = tmp_idle_ticks;
} }
if (likely(total_ticks > idle_ticks))
load = (100 * (total_ticks - idle_ticks)) / total_ticks; load = (100 * (total_ticks - idle_ticks)) / total_ticks;
/* Check for frequency increase */ /* Check for frequency increase */
......
...@@ -37,6 +37,7 @@ static unsigned int cpu_set_freq[NR_CPUS]; /* CPU freq desired by userspace */ ...@@ -37,6 +37,7 @@ static unsigned int cpu_set_freq[NR_CPUS]; /* CPU freq desired by userspace */
static unsigned int cpu_is_managed[NR_CPUS]; static unsigned int cpu_is_managed[NR_CPUS];
static DEFINE_MUTEX (userspace_mutex); static DEFINE_MUTEX (userspace_mutex);
static int cpus_using_userspace_governor;
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg) #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg)
...@@ -47,7 +48,11 @@ userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val, ...@@ -47,7 +48,11 @@ userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
{ {
struct cpufreq_freqs *freq = data; struct cpufreq_freqs *freq = data;
dprintk("saving cpu_cur_freq of cpu %u to be %u kHz\n", freq->cpu, freq->new); if (!cpu_is_managed[freq->cpu])
return 0;
dprintk("saving cpu_cur_freq of cpu %u to be %u kHz\n",
freq->cpu, freq->new);
cpu_cur_freq[freq->cpu] = freq->new; cpu_cur_freq[freq->cpu] = freq->new;
return 0; return 0;
...@@ -142,6 +147,13 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, ...@@ -142,6 +147,13 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
if (rc) if (rc)
goto start_out; goto start_out;
if (cpus_using_userspace_governor == 0) {
cpufreq_register_notifier(
&userspace_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
}
cpus_using_userspace_governor++;
cpu_is_managed[cpu] = 1; cpu_is_managed[cpu] = 1;
cpu_min_freq[cpu] = policy->min; cpu_min_freq[cpu] = policy->min;
cpu_max_freq[cpu] = policy->max; cpu_max_freq[cpu] = policy->max;
...@@ -153,6 +165,13 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, ...@@ -153,6 +165,13 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
break; break;
case CPUFREQ_GOV_STOP: case CPUFREQ_GOV_STOP:
mutex_lock(&userspace_mutex); mutex_lock(&userspace_mutex);
cpus_using_userspace_governor--;
if (cpus_using_userspace_governor == 0) {
cpufreq_unregister_notifier(
&userspace_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
}
cpu_is_managed[cpu] = 0; cpu_is_managed[cpu] = 0;
cpu_min_freq[cpu] = 0; cpu_min_freq[cpu] = 0;
cpu_max_freq[cpu] = 0; cpu_max_freq[cpu] = 0;
...@@ -198,7 +217,6 @@ EXPORT_SYMBOL(cpufreq_gov_userspace); ...@@ -198,7 +217,6 @@ EXPORT_SYMBOL(cpufreq_gov_userspace);
static int __init cpufreq_gov_userspace_init(void) static int __init cpufreq_gov_userspace_init(void)
{ {
cpufreq_register_notifier(&userspace_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
return cpufreq_register_governor(&cpufreq_gov_userspace); return cpufreq_register_governor(&cpufreq_gov_userspace);
} }
...@@ -206,7 +224,6 @@ static int __init cpufreq_gov_userspace_init(void) ...@@ -206,7 +224,6 @@ static int __init cpufreq_gov_userspace_init(void)
static void __exit cpufreq_gov_userspace_exit(void) static void __exit cpufreq_gov_userspace_exit(void)
{ {
cpufreq_unregister_governor(&cpufreq_gov_userspace); cpufreq_unregister_governor(&cpufreq_gov_userspace);
cpufreq_unregister_notifier(&userspace_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment