06 Dec, 2008
2 commits
-
Previously driver resume would always set the current policy min/max with
the cpuinfo min/max, defined by user_policy.min/max. Resulting in a reset
of policy settings when policy.min/max != cpuinfo.min/max when coming out
of suspend. Now user_policy is saved as the policy instead of cpuinfo to
preserve what the user actually set.Signed-off-by: Mike Chan
Signed-off-by: Dave Jones -
p4-clockmod has a long history of abuse. It pretends to be a CPU
frequency scaling driver, even though it doesn't actually change
the CPU frequency, but instead just modulates the frequency with
wait-states.
The biggest misconception is that when running at the lower 'frequency'
p4-clockmod is saving power. This isn't the case, as workloads running
slower take longer to complete, preventing the CPU from entering deep C states.However p4-clockmod does have a purpose. It can prevent overheating.
Having it hooked up to the cpufreq interfaces is the wrong way to achieve
cooling however. It should instead be hooked up to ACPI.This diff introduces a means for a cpufreq driver to register with the
cpufreq core, but not present a sysfs interface.Signed-off-by: Matthew Garrett
Signed-off-by: Dave Jones
10 Oct, 2008
10 commits
-
Use get_cpu()/put_cpu() in cpufreq_ondemand init routine, instead of
smp_processor_id() to avoid the following BUG:[ 35.313118] BUG: using smp_processor_id() in preemptible [00000000] code=: modprobe/4952
[ 35.313132] caller is cpufreq_gov_dbs_init+0xa/0x8f [cpufreq_ondemand]
[ 35.313140] Pid: 4952, comm: modprobe Not tainted 2.6.27-rc5-mm1 #23
[ 35.313145] Call Trace:
[ 35.313158] [] debug_smp_processor_id+0xd7/0xe0
[ 35.313167] [] cpufreq_gov_dbs_init+0xa/0x8f [cpufreq_ondemand]
[ 35.313176] [] _stext+0x3b/0x160
[ 35.313185] [] __mutex_unlock_slowpath+0xe5/0x190
[ 35.313195] [] trace_hardirqs_on_caller+0xca/0x140
[ 35.313205] [] sys_init_module+0xdc/0x210
[ 35.313212] [] system_call_fastpath+0x16/0x1bSigned-off-by: Andrea Righi
Signed-off-by: Dave Jones -
We don't need to export the governors for use as the default governor,
because the default governor will be built-in anyway and we can access
the symbol directly.This also fixes the following sparse warnings:
drivers/cpufreq/cpufreq_conservative.c:578:25: warning: symbol 'cpufreq_gov_conservative' was not declared. Should it be static?
drivers/cpufreq/cpufreq_ondemand.c:582:25: warning: symbol 'cpufreq_gov_ondemand' was not declared. Should it be static?
drivers/cpufreq/cpufreq_performance.c:39:25: warning: symbol 'cpufreq_gov_performance' was not declared. Should it be static?
drivers/cpufreq/cpufreq_powersave.c:38:25: warning: symbol 'cpufreq_gov_powersave' was not declared. Should it be static?
drivers/cpufreq/cpufreq_userspace.c:190:25: warning: symbol 'cpufreq_gov_userspace' was not declared. Should it be static?Signed-off-by: Sven Wegener
Signed-off-by: Dave Jones -
Use get_cpu_idle_time_us() to get micro-accounted idle information.
This enables ondemand to get more accurate idle and busy timings
than the jiffy based calculation. As a result, we can decrease
the ondemand safety gaurd band from 80-10 to 95-3.Results in more aggressive power savings.
Signed-off-by: Venkatesh Pallipadi
Signed-off-by: Dave Jones -
Use a parameter for down differential, instead of hardcoded 10%. Follow-on
patch changes the down-differential dynamically, based on whether
we are using idle micro-accounting or not.Signed-off-by: Venkatesh Pallipadi
Signed-off-by: Dave Jones -
Preparatory changes for doing idle micro-accounting in ondemand governor.
get_cpu_idle_time() gets extra parameter and returns idle time and also the
wall time that corresponds to the idle time measurement.Signed-off-by: Venkatesh Pallipadi
Signed-off-by: Dave Jones -
Change the load calculation algorithm in ondemand to work well with software
coordination of frequency across the dependent cpus.Multiply individual CPU utilization with the average freq of that logical CPU
during the measurement interval (using getavg call). And find the max CPU
utilization number in terms of CPU freq. That number is then used to
get to the target freq for next sampling interval.Signed-off-by: Venkatesh Pallipadi
Signed-off-by: Dave Jones -
Add a cpu parameter to __cpufreq_driver_getavg(). This is needed for software
cpufreq coordination where policy->cpu may not be same as the CPU on which we
want to getavg frequency.A follow-on patch will use this parameter to getavg freq from all cpus
in policy->cpus.Change since last patch. Fix the offline/online and suspend/resume
oops reported by Youquan SongSigned-off-by: Venkatesh Pallipadi
Signed-off-by: Dave Jones -
Venki Pallipadi made a similar change to the ondemand governor a while
back (in commit 28287033e12463c8ff89f1ea8038783d0360391c). It seems to
work just as well in the conservative governor, leading to fewer wakeups
as reported by powertop.Signed-off-by: Ben Slusky
Signed-off-by: Dave Jones -
After calling cpufreq_cpu_get, error handling code should call
cpufreq_cpu_put.The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)//
@r@
expression x,E;
statement S;
position p1,p2,p3;
@@(
if ((x = cpufreq_cpu_get@p1(...)) == NULL || ...) S
|
x = cpufreq_cpu_get@p1(...)
... when != x
if (x == NULL || ...) S
)(
return x;
|
return 0;
|
x = E
|
E = x
|
cpufreq_cpu_put(x)
)@exists@
position r.p1,r.p2,r.p3;
expression x;
int ret != 0;
statement S;
@@* x = cpufreq_cpu_get@p1(...)
* return@p2 \(NULL\|ret\);
//Signed-off-by: Julia Lawall
Signed-off-by: Dave Jones -
Add error handling for cpufreq_register_governor() error
Signed-off-by: Akinobu Mita
Cc: cpufreq@lists.linux.org.uk
Signed-off-by: Dave Jones
09 Aug, 2008
1 commit
-
drivers/cpufreq/cpufreq_conservative.c:336:15: warning: symbol 'freq_step' shadows an earlier one
Just rename the local variable.
Signed-off-by: Dave Jones
31 Jul, 2008
1 commit
-
Ingo Molnar provided a fix to not call _PPC at processor driver
initialization time in "[PATCH] ACPI: fix cpufreq regression" (git
commit e4233dec749a3519069d9390561b5636a75c7579)But it can still happen that _PPC is called at processor driver
initialization time.This patch should make sure that this is not possible anymore.
Signed-off-by: Thomas Renninger
Cc: Andi Kleen
Cc: Len Brown
Cc: Dave Jones
Cc: Ingo Molnar
Cc: Venkatesh Pallipadi
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
24 Jul, 2008
1 commit
-
* 'cpus4096-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (31 commits)
NR_CPUS: Replace NR_CPUS in speedstep-centrino.c
cpumask: Provide a generic set of CPUMASK_ALLOC macros, FIXUP
NR_CPUS: Replace NR_CPUS in cpufreq userspace routines
NR_CPUS: Replace per_cpu(..., smp_processor_id()) with __get_cpu_var
NR_CPUS: Replace NR_CPUS in arch/x86/kernel/genapic_flat_64.c
NR_CPUS: Replace NR_CPUS in arch/x86/kernel/genx2apic_uv_x.c
NR_CPUS: Replace NR_CPUS in arch/x86/kernel/cpu/proc.c
NR_CPUS: Replace NR_CPUS in arch/x86/kernel/cpu/mcheck/mce_64.c
cpumask: Optimize cpumask_of_cpu in lib/smp_processor_id.c, fix
cpumask: Use optimized CPUMASK_ALLOC macros in the centrino_target
cpumask: Provide a generic set of CPUMASK_ALLOC macros
cpumask: Optimize cpumask_of_cpu in lib/smp_processor_id.c
cpumask: Optimize cpumask_of_cpu in kernel/time/tick-common.c
cpumask: Optimize cpumask_of_cpu in drivers/misc/sgi-xp/xpc_main.c
cpumask: Optimize cpumask_of_cpu in arch/x86/kernel/ldt.c
cpumask: Optimize cpumask_of_cpu in arch/x86/kernel/io_apic_64.c
cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptr
Revert "cpumask: introduce new APIs"
cpumask: make for_each_cpu_mask a bit smaller
net: Pass reference to cpumask variable in net/sunrpc/svc.c
...Fix up trivial conflicts in drivers/cpufreq/cpufreq.c manually
22 Jul, 2008
1 commit
-
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
[CPUFREQ] cpufreq: remove CVS keywords
[CPUFREQ] change cpu freq arrays to per_cpu variables
20 Jul, 2008
1 commit
-
* Replace arrays sized by NR_CPUS with percpu variables.
Prior reference: http://marc.info/?l=linux-kernel&m=120251421825989&w=4
Subject: [PATCH 1/4] cpufreq: change cpu freq tables to per_cpu variables
From: Mike Travis
Date: 2008-02-08 23:37:39Signed-off-by: Mike Travis
Signed-off-by: Ingo Molnar
06 Jul, 2008
1 commit
10 Jun, 2008
2 commits
-
* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
[CPUFREQ] Fix format string bug. -
Format string bug. Not exploitable, as this is only writable by root,
but worth fixing all the same.Spotted-by: Ilja van Sprundel
Signed-off-by: Dave Jones
07 Jun, 2008
1 commit
-
If cpu specific cpufreq driver(i.e. longrun) has "setpolicy" function,
governor object isn't set into cpufreq_policy object at "__cpufreq_set_policy"
function in driver/cpufreq/cpufreq.c .This causes a null object access at "store_scaling_setspeed" and
"show_scaling_setspeed" function in driver/cpufreq/cpufreq.c when reading or
writing through /sys interface (ex. cat
/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed)Addresses:
http://bugzilla.kernel.org/show_bug.cgi?id=10654
https://bugzilla.redhat.com/show_bug.cgi?id=443354Signed-off-by: CHIKAMA Masaki
Cc: Dave Jones
Cc: Chuck Ebbert
Acked-by: Dominik Brodowski
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 May, 2008
1 commit
-
In drivers/cpufreq/cpufreq.c the function cpufreq_add_dev() takes the
error exit 'err_out_unregister' from different places once with the
'cpu_policy_rwsem' lock held, once with the lock released:
| if (ret)
| goto err_out_unregister;
| }
|
| policy->governor = NULL; /* to assure that the starting sequence is
| * run in cpufreq_set_policy */
|
| /* set default policy */
| ret = __cpufreq_set_policy(policy, &new_policy);
| policy->user_policy.policy = policy->policy;
| policy->user_policy.governor = policy->governor;
|
| unlock_policy_rwsem_write(cpu);
|
| if (ret) {
| dprintk("setting policy failed\n");
| goto err_out_unregister;
| }This leads to the following error message in case of a failing
__cpufreq_set_policy() call:
=====================================
[ BUG: bad unlock balance detected! ]
-------------------------------------
swapper/1 is trying to release lock (&per_cpu(cpu_policy_rwsem, cpu)) at:
[] unlock_policy_rwsem_write+0x30/0x40
but there are no more locks to release!other info that might help us debug this:
1 lock held by swapper/1:
#0: (sysdev_drivers_lock){--..}, at: [] sysdev_driver_register+0x74/0x130stack backtrace:
[] (dump_stack+0x0/0x14) from [] (print_unlock_inbalance_bug+0xc8/0x104)
[] (print_unlock_inbalance_bug+0x0/0x104) from [] (lock_release_non_nested+0xc4/0x19c)
r6:00000028 r5:c3c1ab80 r4:c01b4564
[] (lock_release_non_nested+0x0/0x19c) from [] (lock_release+0x15c/0x18c)
r8:60000013 r7:00000001 r6:c01b4564 r5:c0541bb4 r4:c3c1ab80
[] (lock_release+0x0/0x18c) from [] (up_write+0x24/0x30)
r8:c0541b80 r7:00000000 r6:ffffffea r5:c3c34828 r4:c0541b8c
[] (up_write+0x0/0x30) from [] (unlock_policy_rwsem_write+0x30/0x40)
r4:c3c34884
[] (unlock_policy_rwsem_write+0x0/0x40) from [] (cpufreq_add_dev+0x324/0x398)
[] (cpufreq_add_dev+0x0/0x398) from [] (sysdev_driver_register+0xc0/0x130)
[] (sysdev_driver_register+0x0/0x130) from [] (cpufreq_register_driver+0xbc/0x174)Signed-off-by: Lothar Waßmann
Signed-off-by: Dave Jones
24 May, 2008
1 commit
-
Change references from for_each_cpu_mask to for_each_cpu_mask_nr
where appropriateReviewed-by: Paul Jackson
Reviewed-by: Christoph Lameter
Signed-off-by: Mike Travis
Signed-off-by: Ingo Molnar
Signed-off-by: Thomas Gleixner
23 May, 2008
1 commit
-
Signed-off-by: Dominik Brodowski
Signed-off-by: Dave Jones
20 May, 2008
1 commit
-
Change cpufreq_policy and cpufreq_governor pointer tables
from arrays to per_cpu variables in the cpufreq subsystem.Also some minor complaints from checkpatch.pl fixed.
Based on:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.gitSigned-off-by: Mike Travis
Signed-off-by: Dave Jones
29 Apr, 2008
9 commits
-
Sometimes old_index != stat->last_index, see cpufreq_update_policy, bios can
change cpu setting in resume. In my test, after resume cpu is in lowest
speed, but the stat info shows cpu is in full speed. This patch makes the
stat info correct after a resume.Signed-off-by: Shaohua Li
Signed-off-by: Andrew Morton
Signed-off-by: Dave Jones -
Allow use of the powersave cpufreq governor as the default one for EMBEDDED
configs.Signed-off-by: Alessandro Guido
Signed-off-by: Andrew Morton
Signed-off-by: Dave Jones -
Currently, affected_cpus shows which CPUs need to have their frequency
coordinated in software. When hardware coordination is in use, the contents
of this file appear the same as when no coordination is required. This can
lead to some confusion among user-space programs, for example, that do not
know that extra coordination is required to force a CPU core to a particular
speed to control power consumption.To fix this, create a "related_cpus" attribute that always displays the
coordination map regardless of whatever coordination strategy the cpufreq
driver uses (sw or hw). If the cpufreq driver does not provide a value, fall
back to policy->cpus.Signed-off-by: Darrick J. Wong
Signed-off-by: Andrew Morton
Signed-off-by: Dave Jones -
Fix show_trans_table when it overflows PAGE_SIZE.
* Not all snprintf calls were protected against being passed a negative
length.
* When show_trans_table overflows, len might be > PAGE_SIZE. In that case,
returns PAGE_SIZE.Signed-off-by: Cesar Eduardo Barros
Signed-off-by: Dave Jones -
If cpufreq_register_notifier is called before pure initcalls,
init_cpufreq_transition_notifier_list will overwrite whatever it did,
causing notifiers to be ignored.Print some noise to the kernel log if that happens.
Signed-off-by: Cesar Eduardo Barros
Signed-off-by: Dave Jones -
Simplify this by moving the unlocking out of the error
paths into the exit path.Signed-off-by: Dave Jones
-
void * p -> void *p
no space between function parameters
removed excess whitespaceSigned-off-by: Dave Jones
-
return is not a function.
Signed-off-by: Dave Jones
-
Signed-off-by: Dave Jones
06 Mar, 2008
3 commits
-
Fix the following warnings:
WARNING: vmlinux.o(.text+0xfe6711): Section mismatch in reference from the function cpufreq_unregister_driver() to the variable .cpuinit.data:cpufreq_cpu_notifier
WARNING: vmlinux.o(.text+0xfe68af): Section mismatch in reference from the function cpufreq_register_driver() to the variable .cpuinit.data:cpufreq_cpu_notifier
WARNING: vmlinux.o(.exit.text+0xc4fa): Section mismatch in reference from the function cpufreq_stats_exit() to the variable .cpuinit.data:cpufreq_stat_cpu_notifierThe warnings were casued by references to unregister_hotcpu_notifier()
from normal functions or exit functions.
This is flagged by modpost as a potential error because
it does not know that for the non HOTPLUG_CPU
scenario the unregister_hotcpu_notifier() is a nop.
Silence the warning by replacing the __initdata
annotation with a __refdata annotation.Signed-off-by: Sam Ravnborg
Signed-off-by: Dave Jones -
refactor to use gotos instead of explicit exit paths
Signed-off-by: Dave Jones
-
refactor to use gotos instead of explicit exit paths
Signed-off-by: Dave Jones
22 Feb, 2008
1 commit
-
The cpufreq core should not take an extra kobject reference count for no
reason, and then refuse to release it. This has been reported as
keeping machines from properly powering down all the way.Signed-off-by: Balaji Rao
Cc: Dave Jones
Cc: Yi Yang
Cc: Alan Stern
Cc: Frans Pop
Cc: Yinghai Lu
Cc: Ingo Molnar
Signed-off-by: Greg Kroah-Hartman
07 Feb, 2008
2 commits
-
cpufreq support can't be built as a module. Fix the related configuration
help message.Signed-off-by: Stefano Brivio
Signed-off-by: Dave Jones -
Eliminate cpufreq_userspace scaling_setspeed deadlock.
Luming Yu recently uncovered yet another cpufreq related deadlock.
One thread that continuously switches the governors and the other thread that
repeatedly cats the contents of cpufreq directory causes both these threads to
go into a deadlock.Detailed examination of the deadlock showed the exact flow before the deadlock
as:Thread 1 Thread 2
________ ________
cats files under /sys/devices/.../cpufreq/
Set governor to userspace
Adds a new sysfs entry for
scaling_setspeed
cats files under /sys/devices/.../cpufreq/Set governor to performance
Holds cpufreq_rw_sem in write
mode
Sends a STOP notify to
userspace governor
cat /sys/devices/.../cpufreq/scaling_setspeed
Gets a handle on the above sysfs entry with
sysfs_get_active
Blocks while trying to get cpufreq_rw_sem
in read mode
Remove a sysfs entry for
scaling_setspeed
Blocks on sysfs_deactivate
while waiting for earlier
get_active (on other thread)
to drainAt this point both threads go into deadlock and any other thread that tries to
do anything with sysfs cpufreq will also block.There seems to be no easy way to avoid this deadlock as long as
cpufreq_userspace adds/removes the sysfs entry under same kobject as cpufreq.
Below patch moves scaling_setspeed to cpufreq.c, keeping it always and calling
back the governor on read/write. This is the cleanest fix I could think of,
even though adding two callbacks in governor structure just for this seems
unnecessary.Note that the change makes scaling_setspeed under /sys/.../cpufreq permanent
and returns when governor is not userspace.Signed-off-by: Venkatesh Pallipadi
Signed-off-by: Dave Jones