aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/cpufreq
Commit message (Collapse)AuthorAgeFilesLines
* cpufreq: missing check of copy_from_guest()Tim Deegan2013-09-121-2/+6
| | | | | | | | | Coverity CID 1055131 Coverity CID 1055132 Signed-off-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
* cpufreq: avoid integer overflows.Tim Deegan2013-09-121-3/+4
| | | | | | | | | | | | | The def_sampling_rate() one is, I think, a real bug. The others were spotted at the same time and are probably not bugs until we start dealing with 40GHz CPus. Coverity CID 1055682 Coverity CID 1055683 Signed-off-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
* cpufreq, xenpm: fix cpufreq and xenpm mismatchJacob Shin2013-07-021-1/+1
| | | | | | | | Currently cpufreq and xenpm are out of sync. Fix cpufreq reporting of if turbo mode is enabled or not. Fix xenpm to not decode for tristate, but a boolean. Signed-off-by: Jacob Shin <jacob.shin@amd.com>
* printk: prefer %#x et at over 0x%xJan Beulich2012-09-211-1/+1
| | | | | | | | | Performance is not an issue with printk(), so let the function do minimally more work and instead save a byte per affected format specifier. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* drivers: Remove some CONFIG_X86 ifdef'ery.Keir Fraser2012-09-121-3/+1
| | | | | | | | | | Not quite all, but a great deal was to specifically allow ia64 support to be retrofitted to x86 platform code. Since we no longer support ia64 we can happily remove the ifdefs. Any new platform which wanted to share this code would likely need a different set of ifdefs in any case, making it a brand new porting effort. Signed-off-by: Keir Fraser <keir@xen.org>
* x86, cpufreq: Change powernow's CPB status immediatelyBoris Ostrovsky2012-06-181-10/+25
| | | | | | | | | | | | | | When command to modify turbo mode (CPB on AMD processors) comes in the actual change happens later, when P-state transition is requested. There is no time limit on when this transition will occur and therefore change in CPB state may take long time from the moment when command to toggle it is issued. This patch makes CPB mode change happen immediately when request is made. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Committed-by: Keir Fraser <keir@xen.org>
* remove ia64Jan Beulich2012-04-031-11/+0
| | | | | | | | | | | It retains IA64-specific bits in code imported from elsewhere (e.g. ACPI, EFI) as well as in the public headers. It also doesn't touch the tools, mini-os, and unmodified_drivers sub-trees. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* Move cpufreq option parsing to cpufreq.cStefano Stabellini2012-01-231-0/+31
| | | | | | | | Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* remove inclusion of asm/config.hJan Beulich2012-01-133-3/+0
| | | | | | | | | This was always bogus (xen/config.h should have been used instead) and is superfluous now that xen/config.h gets included through the compiler command line. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: avoid crash enabling turbo modeIan Campbell2011-11-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a system which has not had P-state information pushed down into the hypervisor running "xenpm enable-turbo-mode" will reliably crash the host. (XEN) PM OP 38 on CPU0 (XEN) ----[ Xen-4.2-unstable x86_64 debug=y Not tainted ]---- (XEN) CPU: 0 (XEN) RIP: e008:[<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29 (XEN) RFLAGS: 0000000000010297 CONTEXT: hypervisor (XEN) rax: 0000000000000000 rbx: ffff82c48029fe40 rcx: 0000000000000000 (XEN) rdx: 0000000000000000 rsi: 000000000000000a rdi: 0000000000000000 (XEN) rbp: ffff82c48029fd08 rsp: ffff82c48029fd08 r8: 0000000000000004 (XEN) r9: 0000000000000000 r10: 00000000fffffffd r11: ffff82c480218f20 (XEN) r12: ffff830106e720b0 r13: 0000000000000000 r14: ffff82c4802bff80 (XEN) r15: ffff82c48025c0e4 cr0: 000000008005003b cr4: 00000000000026f0 (XEN) cr3: 000000011f459000 cr2: 0000000000000051 (XEN) ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0000 cs: e008 (XEN) Xen stack trace from rsp=ffff82c48029fd08: (XEN) ffff82c48029fdb8 ffff82c48014c427 ffff82c48029fd98 ffff82c48016b2d6 (XEN) ffff82c48029fdb8 ffff82c48029fd60 00000000001196c5 0000000116bbe025 (XEN) 0000000116bbe025 ffff8301196c5338 ffff82f6022d77c0 0000000000000000 (XEN) ffff82f60205edf0 0000000000000000 0000000000000000 ffff8300dffba000 (XEN) ffff82c48029fdb8 ffff82c48029ff18 0000000008050004 0000000000000000 (XEN) ffff82c4802bff80 ffff82c48025c0e4 ffff82c48029fef8 ffff82c480124fd8 (XEN) 0000000000000000 ffff83011f48c000 0000000116bbe025 0000000000000025 (XEN) ffff82c48029fe28 0000000080167722 ffff82c48029ff08 ffff83011f48c000 (XEN) ffff82f60232d8a0 ffff8300dffba000 ffff83011f48c000 ffff82f60232d8a0 (XEN) ffff82c48029fed8 ffff82c48017296a 000000080000000c 0000000000000026 (XEN) bfb338b000000000 bfb33874bfb33868 b78988f800000000 0000008800000000 (XEN) b787a6e0b78533a0 ffffffff00000001 080487aeb7897ff4 bfb3389000000001 (XEN) b7898ab0b7889626 0000000100000000 0000000000000001 0804867800000001 (XEN) 000000000804e998 00000000b78533a0 bfb33e70bfb33a7c 0000000000000000 (XEN) 0000000000000000 ffff8300dffba000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 00007d3b7fd600c7 ffff82c48021511e (XEN) 00000000c1002467 0000000000000023 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 00000000dbf5bef8 0000000008050004 (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000 (XEN) 0000000000000023 00000000bfb33874 00000000bfb33868 0000000000000000 (XEN) Xen call trace: (XEN) [<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29 (XEN) [<ffff82c48014c427>] do_pm_op+0x884/0x8e7 (XEN) [<ffff82c480124fd8>] do_sysctl+0x6d8/0x9f0 (XEN) [<ffff82c48021511e>] compat_hypercall+0xae/0x107 (XEN) (XEN) Pagetable walk from 0000000000000051: (XEN) L4[0x000] = 0000000116dbc027 000000000001bd22 (XEN) L3[0x000] = 0000000119ba8027 000000000001eb36 (XEN) L2[0x000] = 0000000000000000 ffffffffffffffff (XEN) (XEN) **************************************** (XEN) Panic on CPU 0: (XEN) FATAL PAGE FAULT (XEN) [error_code=0000] (XEN) Faulting linear address: 0000000000000051 (XEN) **************************************** (XEN) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* eliminate first_cpu() etcJan Beulich2011-11-081-2/+2
| | | | | | | | This includes the conversion from for_each_cpu_mask() to for_each-cpu(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* cpufreq: allocate CPU masks dynamicallyJan Beulich2011-11-072-19/+35
| | | | | | | | | | struct cpufreq_policy, including a cpumask_t member, gets copied in cpufreq_limit_change(), cpufreq_add_cpu(), set_cpufreq_gov(), and set_cpufreq_para(). Make the member a cpumask_var_t, thus reducing the amount of data needing copying (particularly with large NR_CPUS). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* cpufreq: error path fixesJan Beulich2011-10-142-4/+6
| | | | | | | | | | | | | This fixes an actual bug (failure to exit from a function after an allocation failure), an inconsistency (not removing the cpufreq_dom list member upon failure), and a latent bug (not clearing the current governor upon governor initialization failure when there was no old one; latent because the only current code path leading to this situation frees the policy upon failure and hence the governor not getting cleared is benign). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* use xzalloc in driver codeJan Beulich2011-10-042-13/+6
| | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* misc cpufreq cleanupJan Beulich2011-05-093-21/+52
| | | | | | | | | | - proper handling of governor command line options when using the default governor - warning message for unrecognized command line options - replacing a NR_CPUS sized array with per-CPU data - a couple of __read_mostly annotations Signed-off-by: Jan Beulich <jbeulich@novell.com>
* move various bits into .init.* sectionsJan Beulich2011-03-093-43/+1
| | | | | | | | | | This also includes the removal of some entirely unused functions. The patch builds upon the makefile adjustments done in the earlier sent patch titled "move more kernel decompression bits to .init.* sections". Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Xen: fix various checks of unsigned integers < 0Keir Fraser2010-10-291-2/+1
| | | | | | | Some of these could be benignly discarded by the compiler but some are actual bugs. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* cpufreq: eliminate unnecessary NR_CPUS-sized arraysKeir Fraser2010-07-094-35/+34
| | | | | | Replace them with per-CPU data. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86: Dynamically allocate percpu data area when a CPU comes online.Keir Fraser2010-05-181-1/+3
| | | | | | At the same time, the data area starts life zeroed. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Implement cpu hotplug notifiers. Use them.Keir Fraser2010-05-141-0/+36
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpufreq: fix racing issue for cpu hotplugKeir Fraser2010-04-121-4/+3
| | | | | | | | | | To eliminate racing between dbs timer handler and cpufreq_del_cpu, using kill_timer instead of stop_timer to make sure timer handler execution finished before other stuff in cpufreq_del_cpu. BTW, fix a lost point of cpufreq_statistic_lock taking sequence. Signed-off-by: Wei Gang <gang.wei@intel.com>
* Refactor Xen Support for Intel Turbo BoostKeir Fraser2010-04-092-31/+25
| | | | | | | | | | Refactor the existing code that supports the Intel Turbo feature to move all the driver specific bits in the cpufreq driver. Create a tri-state interface for the Turbo feature that can distinguish amongst enabled Turbo, disabled Turbo, and processors that don't support Turbo at all. Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
* cpufreq: don't re-init active dbs timer in S3 or cpu onlineKeir Fraser2010-03-261-2/+3
| | | | Signed-off-by: Wei Gang <gang.wei@intel.com>
* cpufreq: fix statistic lock problemKeir Fraser2010-03-261-4/+8
| | | | | | | | | | cpufreq_statistic_lock should not only protect the statistic memory pointed by cpufreq_statistic_data[cpu], but also have to protect the pointer in cpufreq_statistic_data[cpu] itself. So move the read operation of cpufreq_statistic_data[cpu] after spin_lock(cpufreq_statistic_lock). Signed-off-by: Wei Gang <gang.wei@intel.com>
* cpufreq: make non-verbose by defaultKeir Fraser2010-03-182-30/+51
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Fix a race condition for cpufreq dbs timer while S3 resumingKeir Fraser2010-03-171-0/+1
| | | | | | | | | | The cpufreq_dbs_timer_suspend/resume may race with dbs_timer_init while s3 resuming before this patch. This patch along with cset 21030 fix the bug 1586 http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1586. Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Wei Gang <gang.wei@intel.com>
* Add cpufreq sanity checkKeir Fraser2010-03-092-0/+16
| | | | | | | | | | | This fixes bug 1585 http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=3D1585 root cause: with incorrect BIOS info, cpufreq driver may not start. in this case, if user use xenpm to manipulate cpufreq driver, NULL pointer will cause xen panic. this patch add the sanity check and warning info to fix this issue. Signed-off-by: Yu Ke <ke.yu@intel.com>
* xenpm: Fix ia64 buildKeir Fraser2010-02-101-0/+2
| | | | | | cpuid_eax() is x86-specific. Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
* xenpm: Allow user to enable/disable dbs governor turbo mode.Keir Fraser2010-02-082-3/+47
| | | | Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
* x86: Fix RevF detection in powernow.cKeir Fraser2009-10-231-0/+3
| | | | | | | | | | | The PowerNow! driver does not support RevF and earlier parts. The current code checks for RevF processors in a function that is not called. Change the code path so that RevF processors are detected and the driver fails registration. Also fix cpufreq_add_cpu() to handle unsuccessful registration. Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
* x86, cpufreq: fix ondemand governor to take aperf/mperf feedbackKeir Fraser2009-05-191-19/+20
| | | | | | | | | APERF/MPERF MSRs provides feedback about actual freq in eplased time, which could be different from requested freq by governor. However currently ondemand governor only takes that feedback at freq down path. We should do that for scale up too. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* Fix cpufreq HW-ALL coordination handleKeir Fraser2009-04-142-58/+108
| | | | | | | | | | | | Currently cpufreq HW-ALL coordination is handled same way as SW-ALL. However, SW-ALL will bring more IPIs which is bad for cpuidle. This patch implement HW-ALL coordination handled in different way from SW-ALL, for the sake of performance and reduce IPIs. We also suspend/resume HW-ALL dbs timer for idle. Signed-off-by: Yu, Ke <ke.yu@intel.com> Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> Signed-off-by: Tian, Kevin <kevin.tian@intel.com>
* cpufreq: align dbs timer for better package C state residencyKeir Fraser2009-04-071-1/+2
| | | | Signed-off-by: Yu Ke <ke.yu@intel.com>
* cpufreq: Update cpufreq aperf and mperf read, so that it can be usedKeir Fraser2009-03-202-10/+14
| | | | | | | | | | | | by both ondemand gov and user program Current __get_measured_perf read aperf and mperf MSR and then clear them for the sake of ondemand governor. This solution block user program to get aperf and mperf on their purpose. In this patch, it no longer clear aperf and mperf MSR, so that it can be used by both ondemand gov and user program. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* Fix a cpufreq userspace limitation bugKeir Fraser2009-03-191-11/+38
| | | | | | | | Fix a cpufreq userspace limitation bug, so that userspace freq can return to correct freq when freq_limitation return to high value (like ppc event) Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>=
* cpufreq: fix the buildKeir Fraser2009-02-111-11/+9
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpufreq cmdline handlingKeir Fraser2009-02-113-18/+63
| | | | | | | | | | | | | | | | | | | | c/s 19147 adjust cpufreq cmdline handling, this patch is a complement to c/s 19147. In this patch: 1. add common para (governor independent para) handling; 2. change governor dependent para handling method, governor dependent para will only be handled by the handler of that governor (not by all governors); 3. add userspace governor dependent para handling; 4. change para name 'threshold' of ondemand governor to 'up_threshold' since ondemand has only 'up_threshold', and conservative governor (will be implemented later) has both 'up_threshold' and 'down_threshold'; 5. change some coding style (c/s 19147, drivers/cpufreq/cpufreq.c) to keep coordination with original drivers/cpufreq/cpufreq.c coding style; (originally this file is ported from linux, we partly use linux coding style) Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* cpufreq: attach __exit to the (unused) cpufreq governor exit handlersKeir Fraser2009-02-032-4/+4
| | | | | | | | ... in order to make them disappear from the final image. Of course they could as well be removed altogether, but I assumed that whoever added them had a reason to do so. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Consolidate cpufreq cmdline handlingKeir Fraser2009-02-032-52/+86
| | | | | | | | | | ... by moving as much of the option processing into cpufreq code as is possible, by folding the cpufreq_governor option into the cpufreq one (the governor name, if any, must be specified as the first thing after the separator following "cpufreq=xen"), and by allowing each governor to have an option processing routine. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* cpufreq: stats_lock doesn't appear to need to be irq-safe.Keir Fraser2009-01-071-15/+15
| | | | | | Changing this fixes some bugchecks (xmalloc() with irqs disabled). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Cpufreq: simplify cpufreq_statistic_lock initKeir Fraser2009-01-051-17/+1
| | | | Singed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* Cpufreq: prevent negative px resident time, add spinlock to avoid raceKeir Fraser2009-01-051-16/+80
| | | | | | | | | Due to NOW() value may drift between different cpus, we add protection to prevent negative px resident time. Due to both cpufreq logic and xenpm may race accessing cpufreq_statistic_data, we add spinlock to avoid race. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* cpufreq: xen is default cpufreq, userspace is default governor (override on ↵Keir Fraser2008-12-292-2/+19
| | | | | | | | | | | | | | cmdline) Set userspace governor as default, which stays same effect as when cpufreq in xen is not enabled. As a result, enable cpufreq in xen by default to avoid reboot to activate cpufreq. Now it's always on but w/o performance impact if user doesn't attempt to change governor. Add governor option at cmdline, add some warning info for debug. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* cpufreq: Fix a cpufreq cmdline parse bug, and change sample_rate unitKeir Fraser2008-12-291-2/+2
| | | | Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
* Avoid negative runstate pieces.Keir Fraser2008-12-101-15/+0
| | | | | | | Also consolidate all places to get cpu idle time. Signed-off-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Add user PM control interfaceKeir Fraser2008-12-102-3/+41
| | | | Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* Add cpufreq governors: performance, powersave, userspaceKeir Fraser2008-12-104-0/+219
| | | | | | | | | | | | This patch add 3 more governors beside original running ondemand cpufreq governor. performance governor is with best performance, keeping cpu always running at highest freq; powersave governor is with best power save effect, keeping cpu always running at lowest freq; userspace governor provide user setting freq ability; Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* cpufreq: allow customization of some parametersKeir Fraser2008-12-051-5/+75
| | | | | | | | | | | | | | | | | | Short of having a way for powersaved to dynamically adjust these values, at least allow specifying them on the command line. In particular, always running at an up-threshold of 80% is perhaps nice for laptop use, but certainly not desirable on servers. On shell scripts invoking large numbers of short-lived processes I noticed a 50% performance degradation on a dual-socket quad-core Barcelona just because of the load of an individual core never crossing the 80% boundary that would have resulted in increasing the frequency. (Powersaved on SLE10 sets this on native kernels to 60% or 80%, depending on whether performance or power reduction is preferred, *divided* by the number of CPUs, but capped at the lower limit of 20%.) Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Cpufreq: Enhance hypervisor px sanity checkKeir Fraser2008-11-031-1/+49
| | | | | | | | | This patch enhances hypervisor px sanity check in 2 level: Firstly, move per-cpu-level px sanity check from each cpufreq driver to common point (@ hypercall path). Secondly, add per-domain-level px sanity check to common point (@ cpufreq_add_cpu). Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
* cpufreq: Fix another build failure.Keir Fraser2008-10-291-1/+1
| | | | Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>